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