sonarr-repo-only/UI/Settings/Notifications/AddView.js

45 lines
1.4 KiB
JavaScript
Raw Normal View History

2013-05-25 06:38:43 +00:00
"use strict";
define([
'app',
'Settings/Notifications/Model'
], function () {
NzbDrone.Settings.Notifications.AddItemView = Backbone.Marionette.ItemView.extend({
template : 'Settings/Notifications/AddItemTemplate',
2013-05-27 05:27:33 +00:00
tagName : 'li',
2013-05-25 06:38:43 +00:00
events: {
2013-05-26 00:36:12 +00:00
'click': 'addNotification'
2013-05-25 06:38:43 +00:00
},
2013-05-29 02:49:17 +00:00
initialize: function (options) {
this.notificationCollection = options.notificationCollection;
},
2013-05-26 00:36:12 +00:00
addNotification: function () {
2013-05-25 06:38:43 +00:00
this.model.set('id', undefined);
2013-05-27 05:27:33 +00:00
this.model.set('name', '');
2013-05-29 02:49:17 +00:00
var view = new NzbDrone.Settings.Notifications.EditView({ model: this.model, notificationCollection: this.notificationCollection });
2013-05-25 06:38:43 +00:00
NzbDrone.modalRegion.show(view);
}
});
NzbDrone.Settings.Notifications.AddView = Backbone.Marionette.CompositeView.extend({
itemView : NzbDrone.Settings.Notifications.AddItemView,
2013-05-27 05:27:33 +00:00
itemViewContainer : '.notifications .items',
2013-05-29 02:49:17 +00:00
template : 'Settings/Notifications/AddTemplate',
itemViewOptions: function () {
return {
notificationCollection: this.notificationCollection
};
},
initialize: function (options) {
this.notificationCollection = options.notificationCollection;
}
2013-05-25 06:38:43 +00:00
});
});