mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 19:43:16 +00:00
63 lines
2.0 KiB
JavaScript
63 lines
2.0 KiB
JavaScript
/*
|
|
* This file is part of Phraseanet
|
|
*
|
|
* (c) 2005-2014 Alchemy
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
define([
|
|
"jquery",
|
|
"underscore",
|
|
"backbone"
|
|
], function ($, _, Backbone) {
|
|
var SchedulerView = Backbone.View.extend({
|
|
initialize: function () {
|
|
this.template = _.template($('#scheduler_template').html());
|
|
// render only parts of the model
|
|
this.model.on('change:configuration', this.renderConfiguration, this);
|
|
this.model.on('change:actual', this.renderActual, this);
|
|
this.model.on('change:process-id', this.renderPid, this);
|
|
this.model.on('change:name', this.renderName, this);
|
|
},
|
|
events: {
|
|
"click a": "clickAction"
|
|
},
|
|
tagName: "tr",
|
|
render: function () {
|
|
this.$el.empty();
|
|
this.$el.html(this.template({'scheduler':this.model.toJSON()}));
|
|
return this;
|
|
},
|
|
renderConfiguration: function () {
|
|
$(".confScheduler", this.$el).html(this.model.get("configuration"));
|
|
return this;
|
|
},
|
|
renderActual: function () {
|
|
$(".actualScheduler", this.$el).html(this.model.get("actual"));
|
|
return this;
|
|
},
|
|
renderPid: function () {
|
|
$(".pidScheduler", this.$el).html(this.model.get("process-id"));
|
|
return this;
|
|
},
|
|
renderName: function () {
|
|
$(".nameScheduler", this.$el).html(this.model.get("name"));
|
|
return this;
|
|
},
|
|
clickAction: function(e) {
|
|
e.preventDefault();
|
|
var link = $(e.target);
|
|
var url = link.attr('href');
|
|
|
|
if(url && url.indexOf('#') !== 0) {
|
|
// This is defined in admin/index.html.twig
|
|
window.loadRightAjax(url, link.attr("method") || "GET");
|
|
}
|
|
}
|
|
});
|
|
|
|
return SchedulerView;
|
|
});
|