2013-03-04 03:09:43 +03:00
|
|
|
'use strict';
|
2013-04-25 07:27:49 +03:00
|
|
|
define(['app', 'Settings/Naming/NamingModel'], function () {
|
2013-03-04 03:09:43 +03:00
|
|
|
|
|
|
|
NzbDrone.Settings.Naming.NamingView = Backbone.Marionette.ItemView.extend({
|
2013-03-30 02:28:58 +03:00
|
|
|
template : 'Settings/Naming/NamingTemplate',
|
2013-03-04 05:02:57 +03:00
|
|
|
className: 'form-horizontal',
|
2013-03-04 03:09:43 +03:00
|
|
|
|
2013-03-05 09:50:42 +03:00
|
|
|
ui: {
|
2013-03-06 21:41:13 +03:00
|
|
|
tooltip: '[class^="help-inline"] i'
|
2013-03-04 03:09:43 +03:00
|
|
|
},
|
|
|
|
|
2013-03-30 02:28:58 +03:00
|
|
|
initialize: function () {
|
2013-04-25 07:27:49 +03:00
|
|
|
this.model = new NzbDrone.Settings.Naming.NamingModel();
|
|
|
|
this.model.fetch();
|
|
|
|
|
|
|
|
NzbDrone.vent.on(NzbDrone.Commands.SaveSettings, this.saveSettings, this);
|
2013-03-07 11:01:18 +03:00
|
|
|
},
|
|
|
|
|
2013-03-04 03:09:43 +03:00
|
|
|
onRender: function () {
|
2013-04-26 18:31:56 +03:00
|
|
|
//TODO: Move this to a mixin
|
2013-03-05 09:50:42 +03:00
|
|
|
this.ui.tooltip.tooltip({ placement: 'right' });
|
2013-04-25 07:27:49 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
};
|
2013-03-04 03:09:43 +03:00
|
|
|
}
|
|
|
|
});
|
2013-04-25 07:27:49 +03:00
|
|
|
})
|
|
|
|
;
|