Notification Schema in UI

This commit is contained in:
Mark McDowall 2013-05-24 23:38:43 -07:00
parent 42994ae39d
commit 3b09cc1240
5 changed files with 59 additions and 3 deletions

View File

@ -0,0 +1 @@
{{name}}

View File

@ -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>

View File

@ -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'
});
});

View File

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

View File

@ -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);
}
}
});
});