1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-23 02:05:27 +02:00
Sonarr/UI/Settings/Quality/Profile/QualityProfileCollectionView.js

44 lines
1.4 KiB
JavaScript
Raw Normal View History

'use strict';
define(['app',
'marionette',
'Settings/Quality/Profile/QualityProfileView',
'Settings/Quality/Profile/EditQualityProfileView',
'Settings/Quality/Profile/QualityProfileSchemaCollection'
], function (App, Marionette, QualityProfileView, EditProfileView, ProfileCollection) {
2013-06-19 04:02:23 +03:00
return Marionette.CompositeView.extend({
itemView : QualityProfileView,
2013-06-25 03:41:32 +03:00
itemViewContainer: '.quality-profiles',
template : 'Settings/Quality/Profile/QualityProfileCollectionTemplate',
ui: {
'addCard': '.x-add-card'
},
events: {
2013-07-26 10:04:25 +03:00
'click .x-add-card': '_addProfile'
},
appendHtml: function(collectionView, itemView, index){
collectionView.ui.addCard.parent('li').before(itemView.el);
},
_addProfile: function () {
var self = this;
var schemaCollection = new ProfileCollection();
schemaCollection.fetch({
success: function (collection) {
var model = _.first(collection.models);
model.set('id', undefined);
model.set('name', '');
model.collection = self.collection;
var view = new EditProfileView({ model: model, profileCollection: self.collection});
App.modalRegion.show(view);
}
});
}
});
2013-05-02 01:42:30 +03:00
});