Notification Schema in UI

pull/23/head
Mark McDowall 11 years ago
parent 42994ae39d
commit 3b09cc1240

@ -0,0 +1,12 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Add Notification</h3>
</div>
<div class="modal-body">
<div class="form-horizontal">
<div id="notifications-to-add" class="btn-group"></div>
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal">close</button>
</div>

@ -0,0 +1,30 @@
"use strict";
define([
'app',
'Settings/Notifications/Model'
], function () {
NzbDrone.Settings.Notifications.AddItemView = Backbone.Marionette.ItemView.extend({
template : 'Settings/Notifications/AddItemTemplate',
tagName : 'button',
className: 'btn',
events: {
'click': 'add'
},
add: function () {
this.model.set('id', undefined);
var view = new NzbDrone.Settings.Notifications.EditView({ model: this.model});
NzbDrone.modalRegion.show(view);
}
});
NzbDrone.Settings.Notifications.AddView = Backbone.Marionette.CompositeView.extend({
itemView : NzbDrone.Settings.Notifications.AddItemView,
itemViewContainer : '#notifications-to-add',
template : 'Settings/Notifications/AddTemplate'
});
});

@ -9,4 +9,6 @@
</tr>
</thead>
<tbody></tbody>
</table>
</table>
<button class="btn btn-success x-add">Add</button>

@ -1,8 +1,19 @@
'use strict';
define(['app', 'Settings/Notifications/ItemView'], function () {
define(['app', 'Settings/Notifications/ItemView', 'Settings/Notifications/AddView'], function () {
NzbDrone.Settings.Notifications.CollectionView = Backbone.Marionette.CompositeView.extend({
itemView : NzbDrone.Settings.Notifications.ItemView,
itemViewContainer : 'tbody',
template : 'Settings/Notifications/CollectionTemplate'
template : 'Settings/Notifications/CollectionTemplate',
events: {
'click .x-add': function () {
var schema = new NzbDrone.Settings.Notifications.Collection();
schema.url = '/api/notification/schema';
schema.fetch();
var view = new NzbDrone.Settings.Notifications.AddView({ collection: schema});
NzbDrone.modalRegion.show(view);
}
}
});
});

Loading…
Cancel
Save