1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-07-09 01:05:40 +02:00
Files
Sonarr/UI/Settings/Notifications/CollectionView.js

44 lines
1.2 KiB
JavaScript
Raw Normal View History

2013-05-19 21:19:54 -07:00
'use strict';
2013-06-18 18:02:23 -07:00
define([
'app',
'marionette',
'Settings/Notifications/ItemView',
2013-06-27 18:55:45 -07:00
'Settings/Notifications/SchemaModal'
], function (App, Marionette, NotificationItemView, SchemaModal) {
2013-06-18 18:02:23 -07:00
return Marionette.CompositeView.extend({
itemView : NotificationItemView,
2013-06-25 17:34:33 -07:00
itemViewContainer: '.notifications',
2013-06-18 18:02:23 -07:00
template : 'Settings/Notifications/CollectionTemplate',
2013-05-24 23:38:43 -07:00
2013-07-25 23:53:37 -07:00
ui: {
'addCard': '.x-add-card'
},
2013-05-24 23:38:43 -07:00
events: {
2013-07-25 23:53:37 -07:00
'click .x-add': '_openSchemaModal',
'click .x-add-card': '_openSchemaModal'
},
onBeforeItemAdded: function () {
this.ui.addCard.remove();
},
onAfterItemAdded: function () {
this._appendAddCard();
2013-05-25 17:36:12 -07:00
},
2013-05-24 23:38:43 -07:00
2013-06-25 17:34:33 -07:00
_openSchemaModal: function () {
2013-06-27 18:55:45 -07:00
SchemaModal.open(this.collection);
2013-07-25 23:53:37 -07:00
},
_appendAddCard: function () {
this.$itemViewContainer.find('.x-add-card').remove();
this.templateFunction = Marionette.TemplateCache.get('Settings/Notifications/AddCardTemplate');
var html = this.templateFunction();
this.$itemViewContainer.append(html);
2013-05-24 23:38:43 -07:00
}
2013-05-19 21:19:54 -07:00
});
});