mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Notification settings added to the UI
This commit is contained in:
parent
a153599d50
commit
c5376319fe
21 changed files with 168 additions and 35 deletions
|
@ -12,8 +12,10 @@
|
|||
<div class="btn btn-primary slide-button"></div>
|
||||
</label>
|
||||
|
||||
{{#if helpText}}
|
||||
<span class="help-inline-checkbox">
|
||||
<i class="icon-question-sign" title="{{helpText}}"></i>
|
||||
</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
12
UI/Form/PasswordTemplate.html
Normal file
12
UI/Form/PasswordTemplate.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<div class="control-group">
|
||||
<label class="control-label">{{label}}</label>
|
||||
|
||||
<div class="controls">
|
||||
<input type="password" name="fields.{{order}}.value"/>
|
||||
{{#if helpText}}
|
||||
<span class="help-inline">
|
||||
<i class="icon-question-sign" title="{{helpText}}"></i>
|
||||
</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
|
@ -3,8 +3,10 @@
|
|||
|
||||
<div class="controls">
|
||||
<input type="text" name="fields.{{order}}.value"/>
|
||||
<span class="help-inline">
|
||||
<i class="icon-question-sign" title="{{helpText}}"></i>
|
||||
</span>
|
||||
{{#if helpText}}
|
||||
<span class="help-inline">
|
||||
<i class="icon-question-sign" title="{{helpText}}"></i>
|
||||
</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
|
@ -12,6 +12,14 @@ Handlebars.registerHelper('formField', function () {
|
|||
return Handlebars.helpers.partial.apply(this, ['Form/TextboxTemplate']);
|
||||
}
|
||||
|
||||
if (this.type === 'password') {
|
||||
return Handlebars.helpers.partial.apply(this, ['Form/PasswordTemplate']);
|
||||
}
|
||||
|
||||
if (this.type === 'checkbox') {
|
||||
return Handlebars.helpers.partial.apply(this, ['Form/CheckboxTemplate']);
|
||||
}
|
||||
|
||||
return Handlebars.helpers.partial.apply(this, ['Form/TextboxTemplate']);
|
||||
});
|
||||
|
||||
|
|
7
UI/Settings/Notifications/Collection.js
Normal file
7
UI/Settings/Notifications/Collection.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
define(['app', 'Settings/Notifications/Model'], function () {
|
||||
NzbDrone.Settings.Notifications.Collection = Backbone.Collection.extend({
|
||||
url : NzbDrone.Constants.ApiRoot + '/notification',
|
||||
model: NzbDrone.Settings.Notifications.Model
|
||||
});
|
||||
});
|
5
UI/Settings/Notifications/CollectionTemplate.html
Normal file
5
UI/Settings/Notifications/CollectionTemplate.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<div class="row">
|
||||
<div class="span12">
|
||||
<div id="x-notifications" class="form-horizontal"></div>
|
||||
</div>
|
||||
</div>
|
8
UI/Settings/Notifications/CollectionView.js
Normal file
8
UI/Settings/Notifications/CollectionView.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
'use strict';
|
||||
define(['app', 'Settings/Notifications/ItemView'], function () {
|
||||
NzbDrone.Settings.Notifications.CollectionView = Backbone.Marionette.CompositeView.extend({
|
||||
itemView : NzbDrone.Settings.Notifications.ItemView,
|
||||
itemViewContainer : '#x-notifications',
|
||||
template : 'Settings/Notifications/CollectionTemplate'
|
||||
});
|
||||
});
|
47
UI/Settings/Notifications/ItemTemplate.html
Normal file
47
UI/Settings/Notifications/ItemTemplate.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
<fieldset>
|
||||
<legend>{{name}}</legend>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">On Grab</label>
|
||||
|
||||
<div class="controls">
|
||||
<label class="checkbox toggle well">
|
||||
<input type="checkbox" name="onGrab"/>
|
||||
<p>
|
||||
<span>On</span>
|
||||
<span>Off</span>
|
||||
</p>
|
||||
|
||||
<div class="btn btn-primary slide-button"></div>
|
||||
</label>
|
||||
|
||||
<span class="help-inline-checkbox">
|
||||
<i class="icon-question-sign" title="Do you want to get notifications when episodes are grabbed?"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">On Download</label>
|
||||
|
||||
<div class="controls">
|
||||
<label class="checkbox toggle well">
|
||||
<input type="checkbox" name="onDownload"/>
|
||||
<p>
|
||||
<span>On</span>
|
||||
<span>Off</span>
|
||||
</p>
|
||||
|
||||
<div class="btn btn-primary slide-button"></div>
|
||||
</label>
|
||||
|
||||
<span class="help-inline-checkbox">
|
||||
<i class="icon-question-sign" title="Do you want to get notifications when episodes are downloaded?"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#each fields}}
|
||||
{{formField}}
|
||||
{{/each}}
|
||||
</fieldset>
|
33
UI/Settings/Notifications/ItemView.js
Normal file
33
UI/Settings/Notifications/ItemView.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
"use strict";
|
||||
|
||||
define([
|
||||
'app',
|
||||
'Settings/Notifications/Collection'
|
||||
|
||||
], function () {
|
||||
|
||||
NzbDrone.Settings.Notifications.ItemView = Backbone.Marionette.ItemView.extend({
|
||||
template : 'Settings/Notifications/ItemTemplate',
|
||||
initialize: function () {
|
||||
NzbDrone.vent.on(NzbDrone.Commands.SaveSettings, this.saveSettings, this);
|
||||
},
|
||||
|
||||
saveSettings: function () {
|
||||
|
||||
//this.model.save(undefined, this.syncNotification("Naming Settings Saved", "Couldn't Save Naming Settings"));
|
||||
},
|
||||
|
||||
|
||||
syncNotification: function (success, error) {
|
||||
return {
|
||||
success: function () {
|
||||
window.alert(success);
|
||||
},
|
||||
|
||||
error: function () {
|
||||
window.alert(error);
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
5
UI/Settings/Notifications/Model.js
Normal file
5
UI/Settings/Notifications/Model.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
define(['app'], function () {
|
||||
NzbDrone.Settings.Notifications.Model = Backbone.DeepModel.extend({
|
||||
});
|
||||
});
|
|
@ -1,3 +0,0 @@
|
|||
<div>
|
||||
Notification settings will go here
|
||||
</div>
|
|
@ -1,11 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
define([
|
||||
'app', 'Settings/SettingsModel'
|
||||
|
||||
], function () {
|
||||
|
||||
NzbDrone.Settings.Notifications.NotificationsView = Backbone.Marionette.ItemView.extend({
|
||||
template: 'Settings/Notifications/NotificationsTemplate'
|
||||
});
|
||||
});
|
|
@ -5,7 +5,7 @@ define([
|
|||
'Settings/Quality/QualityLayout',
|
||||
'Settings/Indexers/CollectionView',
|
||||
'Settings/DownloadClient/DownloadClientView',
|
||||
'Settings/Notifications/NotificationsView',
|
||||
'Settings/Notifications/CollectionView',
|
||||
'Settings/System/SystemView',
|
||||
'Settings/Misc/MiscView'
|
||||
],
|
||||
|
@ -117,6 +117,9 @@ define([
|
|||
this.indexerSettings = new NzbDrone.Settings.Indexers.Collection();
|
||||
this.indexerSettings.fetch();
|
||||
|
||||
this.notificationSettings = new NzbDrone.Settings.Notifications.Collection();
|
||||
this.notificationSettings.fetch();
|
||||
|
||||
if (options.action) {
|
||||
this.action = options.action.toLowerCase();
|
||||
}
|
||||
|
@ -127,7 +130,7 @@ define([
|
|||
this.quality.show(new NzbDrone.Settings.Quality.QualityLayout({settings: this.settings}));
|
||||
this.indexers.show(new NzbDrone.Settings.Indexers.CollectionView({collection: this.indexerSettings}));
|
||||
this.downloadClient.show(new NzbDrone.Settings.DownloadClient.DownloadClientView({model: this.settings}));
|
||||
this.notifications.show(new NzbDrone.Settings.Notifications.NotificationsView({model: this.settings}));
|
||||
this.notifications.show(new NzbDrone.Settings.Notifications.CollectionView({collection: this.notificationSettings}));
|
||||
this.system.show(new NzbDrone.Settings.System.SystemView({model: this.settings}));
|
||||
this.misc.show(new NzbDrone.Settings.Misc.MiscView({model: this.settings}));
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue