1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-27 10:19:41 +00:00
Radarr/UI/Settings/Quality/Profile/QualityProfileCollectionView.js
2013-06-25 00:25:33 -07:00

35 lines
1.2 KiB
JavaScript

'use strict';
define(['app',
'marionette',
'Settings/Quality/Profile/QualityProfileView',
'Settings/Quality/Profile/EditQualityProfileView',
'Settings/Quality/Profile/QualityProfileSchemaCollection'],
function (App, Marionette, QualityProfileView, EditProfileView, ProfileCollection) {
return Marionette.CompositeView.extend({
itemView : QualityProfileView,
itemViewContainer: '.quality-profiles',
template : 'Settings/Quality/Profile/QualityProfileCollectionTemplate',
events: {
'click .x-add': '_addProfile'
},
_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);
}
});
}
});
});