2013-03-04 00:09:43 +00:00
|
|
|
|
'use strict';
|
2013-04-25 04:27:49 +00:00
|
|
|
|
define(['app', 'Settings/Naming/NamingModel'], function () {
|
2013-03-04 00:09:43 +00:00
|
|
|
|
|
|
|
|
|
NzbDrone.Settings.Naming.NamingView = Backbone.Marionette.ItemView.extend({
|
2013-03-29 23:28:58 +00:00
|
|
|
|
template : 'Settings/Naming/NamingTemplate',
|
2013-03-04 00:09:43 +00:00
|
|
|
|
|
2013-03-05 06:50:42 +00:00
|
|
|
|
ui: {
|
2013-03-06 18:41:13 +00:00
|
|
|
|
tooltip: '[class^="help-inline"] i'
|
2013-03-04 00:09:43 +00:00
|
|
|
|
},
|
|
|
|
|
|
2013-03-29 23:28:58 +00:00
|
|
|
|
initialize: function () {
|
2013-04-25 04:27:49 +00:00
|
|
|
|
this.model = new NzbDrone.Settings.Naming.NamingModel();
|
|
|
|
|
this.model.fetch();
|
|
|
|
|
|
|
|
|
|
NzbDrone.vent.on(NzbDrone.Commands.SaveSettings, this.saveSettings, this);
|
2013-03-07 08:01:18 +00:00
|
|
|
|
},
|
|
|
|
|
|
2013-03-04 00:09:43 +00:00
|
|
|
|
onRender: function () {
|
2013-04-26 15:31:56 +00:00
|
|
|
|
//TODO: Move this to a mixin
|
2013-03-05 06:50:42 +00:00
|
|
|
|
this.ui.tooltip.tooltip({ placement: 'right' });
|
2013-04-25 04:27:49 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
saveSettings: function () {
|
2013-06-01 00:22:47 +00:00
|
|
|
|
this.model.save(undefined, NzbDrone.Settings.SyncNotificaiton.callback({
|
|
|
|
|
successMessage: 'Naming Settings saved',
|
|
|
|
|
errorMessage: "Failed to save Naming Settings"
|
|
|
|
|
}));
|
2013-03-04 00:09:43 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
2013-04-25 04:27:49 +00:00
|
|
|
|
})
|
|
|
|
|
;
|