2013-03-04 03:09:43 +03:00
|
|
|
'use strict';
|
2013-06-14 02:19:24 +03:00
|
|
|
define(['app',
|
2013-06-19 04:02:23 +03:00
|
|
|
'marionette',
|
|
|
|
'Settings/Naming/NamingModel',
|
|
|
|
'Settings/SyncNotification',
|
|
|
|
'Mixins/AsModelBoundView'], function (App, Marionette, NamingModel, SyncNotification, AsModelBoundView) {
|
2013-03-04 03:09:43 +03:00
|
|
|
|
2013-06-19 04:02:23 +03:00
|
|
|
var view = Marionette.ItemView.extend({
|
|
|
|
template: 'Settings/Naming/NamingTemplate',
|
2013-03-04 03:09:43 +03:00
|
|
|
|
2013-03-30 02:28:58 +03:00
|
|
|
initialize: function () {
|
2013-06-19 04:02:23 +03:00
|
|
|
this.model = new NamingModel();
|
2013-04-25 07:27:49 +03:00
|
|
|
this.model.fetch();
|
|
|
|
|
2013-06-19 04:02:23 +03:00
|
|
|
this.listenTo(App.vent, App.Commands.SaveSettings, this.saveSettings);
|
|
|
|
|
2013-03-07 11:01:18 +03:00
|
|
|
},
|
|
|
|
|
2013-04-25 07:27:49 +03:00
|
|
|
saveSettings: function () {
|
2013-06-19 04:02:23 +03:00
|
|
|
this.model.saveIfChanged(undefined, SyncNotification.callback({
|
2013-06-01 03:22:47 +03:00
|
|
|
successMessage: 'Naming Settings saved',
|
2013-06-19 04:02:23 +03:00
|
|
|
errorMessage : "Failed to save Naming Settings"
|
2013-06-01 03:22:47 +03:00
|
|
|
}));
|
2013-03-04 03:09:43 +03:00
|
|
|
}
|
|
|
|
});
|
2013-06-19 04:02:23 +03:00
|
|
|
|
|
|
|
return AsModelBoundView.call(view);
|
|
|
|
});
|