mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Bootstrap loading profiles via ajax
This commit is contained in:
parent
44c7a58595
commit
0ecbb30345
18 changed files with 92 additions and 122 deletions
|
@ -1,37 +1,23 @@
|
|||
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;
|
||||
}
|
||||
QualityProfileView = Backbone.Marionette.ItemView.extend({
|
||||
tagName: "div",
|
||||
className: "quality-profile",
|
||||
template: "#QualityProfileTemplate"
|
||||
});
|
||||
|
||||
window.QualityProfileView = Backbone.View.extend({
|
||||
|
||||
tagName: "li",
|
||||
|
||||
QualityProfileCollectionView = Backbone.Marionette.CompositeView.extend({
|
||||
tagName: "div",
|
||||
id: "quality-profile-collection",
|
||||
itemView: QualityProfileView,
|
||||
template: QualityProfileApp.Constants.Templates.QualityProfileCollection,
|
||||
|
||||
//appendHtml: function (collectionView, itemView) {
|
||||
// collectionView.$('#collection').append(itemView.el);
|
||||
//},
|
||||
|
||||
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;
|
||||
_.bindAll(this, 'render');
|
||||
this.collection = new QualityProfileCollection();
|
||||
this.collection.fetch();
|
||||
this.collection.bind('reset', this.render);
|
||||
}
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue