mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 18:57:39 -07:00
Added backbone
This commit is contained in:
parent
b366f8fadc
commit
b101758957
28 changed files with 5507 additions and 3 deletions
37
NzbDrone.Web/Scripts/backbone/views/qualityProfiles.js
Normal file
37
NzbDrone.Web/Scripts/backbone/views/qualityProfiles.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
window.QualityProfilesView = Backbone.View.extend({
|
||||
|
||||
initialize: function () {
|
||||
this.render();
|
||||
},
|
||||
|
||||
render: function () {
|
||||
var profiles = this.model.models;
|
||||
var len = profiles.length;
|
||||
var startPos = (this.options.page - 1) * 8;
|
||||
var endPos = Math.min(startPos + 8, len);
|
||||
|
||||
$(this.el).html('<ul class="thumbnails"></ul>');
|
||||
|
||||
for (var i = startPos; i < endPos; i++) {
|
||||
$('.thumbnails', this.el).append(new QualityProfileView({ model: profiles[i] }).render().el);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
window.QualityProfileView = Backbone.View.extend({
|
||||
|
||||
tagName: "li",
|
||||
|
||||
initialize: function () {
|
||||
this.model.bind("change", this.render, this);
|
||||
this.model.bind("destroy", this.close, this);
|
||||
},
|
||||
|
||||
render: function () {
|
||||
$(this.el).html(this.template(this.model.toJSON()));
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue