Add missing view file
// FREEBIE
This commit is contained in:
parent
8545ab93f4
commit
74aeddcbda
1 changed files with 37 additions and 0 deletions
37
js/views/settings_view.js
Normal file
37
js/views/settings_view.js
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* vim: ts=4:sw=4:expandtab
|
||||||
|
*/
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
window.Whisper = window.Whisper || {};
|
||||||
|
|
||||||
|
Whisper.SettingsView = Whisper.View.extend({
|
||||||
|
className: 'settings modal',
|
||||||
|
templateName: 'settings',
|
||||||
|
events: {
|
||||||
|
'change': 'change',
|
||||||
|
'click .close': 'remove'
|
||||||
|
},
|
||||||
|
change: function(e) {
|
||||||
|
var value = this.$(e.target).val();
|
||||||
|
storage.put('notification-setting', value);
|
||||||
|
console.log('notification setting changed to', value);
|
||||||
|
},
|
||||||
|
update: function() {
|
||||||
|
var setting = storage.get('notification-setting');
|
||||||
|
if (!setting) {
|
||||||
|
setting = 'message';
|
||||||
|
}
|
||||||
|
this.$('#notification-setting-' + setting).attr('checked','checked');
|
||||||
|
},
|
||||||
|
render_attributes: function() {
|
||||||
|
return {
|
||||||
|
settings: i18n('settings'),
|
||||||
|
off: i18n('off'),
|
||||||
|
nameAndMessage: i18n('nameAndMessage'),
|
||||||
|
noNameOrMessage: i18n('noNameOrMessage'),
|
||||||
|
nameOnly: i18n('nameOnly'),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
Loading…
Reference in a new issue