mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 18:42:42 +01:00
Notification Schema in UI
This commit is contained in:
parent
42994ae39d
commit
3b09cc1240
1
UI/Settings/Notifications/AddItemTemplate.html
Normal file
1
UI/Settings/Notifications/AddItemTemplate.html
Normal file
@ -0,0 +1 @@
|
||||
{{name}}
|
12
UI/Settings/Notifications/AddTemplate.html
Normal file
12
UI/Settings/Notifications/AddTemplate.html
Normal file
@ -0,0 +1,12 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</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>
|
30
UI/Settings/Notifications/AddView.js
Normal file
30
UI/Settings/Notifications/AddView.js
Normal 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'
|
||||
});
|
||||
});
|
@ -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…
Reference in New Issue
Block a user