2013-05-20 07:19:54 +03:00
|
|
|
'use strict';
|
2013-06-19 04:02:23 +03:00
|
|
|
define([
|
|
|
|
'app',
|
|
|
|
'marionette',
|
|
|
|
'Settings/Notifications/ItemView',
|
2013-06-28 04:55:45 +03:00
|
|
|
'Settings/Notifications/SchemaModal'
|
|
|
|
], function (App, Marionette, NotificationItemView, SchemaModal) {
|
2013-06-19 04:02:23 +03:00
|
|
|
return Marionette.CompositeView.extend({
|
|
|
|
itemView : NotificationItemView,
|
2013-06-26 03:34:33 +03:00
|
|
|
itemViewContainer: '.notifications',
|
2013-06-19 04:02:23 +03:00
|
|
|
template : 'Settings/Notifications/CollectionTemplate',
|
2013-05-25 09:38:43 +03:00
|
|
|
|
|
|
|
events: {
|
2013-07-26 09:53:37 +03:00
|
|
|
'click .x-add-card': '_openSchemaModal'
|
|
|
|
},
|
|
|
|
|
2013-07-26 10:46:24 +03:00
|
|
|
onRender: function () {
|
|
|
|
this.listenTo(this.collection, 'add', this.render);
|
2013-07-26 09:53:37 +03:00
|
|
|
|
|
|
|
this.templateFunction = Marionette.TemplateCache.get('Settings/Notifications/AddCardTemplate');
|
|
|
|
var html = this.templateFunction();
|
|
|
|
|
|
|
|
this.$itemViewContainer.append(html);
|
2013-07-26 10:04:25 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
_openSchemaModal: function () {
|
|
|
|
SchemaModal.open(this.collection);
|
2013-05-25 09:38:43 +03:00
|
|
|
}
|
2013-05-20 07:19:54 +03:00
|
|
|
});
|
|
|
|
});
|