diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-09-03 23:12:46 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-09-03 23:12:46 +0200 |
commit | b3851817ecd59b039f2c2228d08a1c6fd8e60d60 (patch) | |
tree | 82a50f69788d5c20632f3ec9c7d3e136502b93b4 /client/components/users/userHeader.js | |
parent | 039cfe7edf8faf901069a94b3ca9b66f7973b26a (diff) | |
download | wekan-b3851817ecd59b039f2c2228d08a1c6fd8e60d60.tar.gz wekan-b3851817ecd59b039f2c2228d08a1c6fd8e60d60.tar.bz2 wekan-b3851817ecd59b039f2c2228d08a1c6fd8e60d60.zip |
Enforce a consistent ES6 coding style
Replace the old (and broken) jshint + jscsrc by eslint and configure
it to support some of the ES6 features.
The command `eslint` currently has one error which is a bug that was
discovered by its static analysis and should be fixed (usage of a
dead object).
Diffstat (limited to 'client/components/users/userHeader.js')
-rw-r--r-- | client/components/users/userHeader.js | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/client/components/users/userHeader.js b/client/components/users/userHeader.js index 2110faa6..d8b1ee48 100644 --- a/client/components/users/userHeader.js +++ b/client/components/users/userHeader.js @@ -1,6 +1,6 @@ Template.headerUserBar.events({ 'click .js-open-header-member-menu': Popup.open('memberMenu'), - 'click .js-change-avatar': Popup.open('changeAvatar') + 'click .js-change-avatar': Popup.open('changeAvatar'), }); Template.memberMenuPopup.events({ @@ -8,58 +8,57 @@ Template.memberMenuPopup.events({ 'click .js-change-avatar': Popup.open('changeAvatar'), 'click .js-change-password': Popup.open('changePassword'), 'click .js-change-language': Popup.open('changeLanguage'), - 'click .js-logout': function(evt) { + 'click .js-logout'(evt) { evt.preventDefault(); AccountsTemplates.logout(); - } + }, }); Template.editProfilePopup.events({ - submit: function(evt, tpl) { + submit(evt, tpl) { evt.preventDefault(); - var fullname = $.trim(tpl.find('.js-profile-fullname').value); - var username = $.trim(tpl.find('.js-profile-username').value); - var initials = $.trim(tpl.find('.js-profile-initials').value); + const fullname = $.trim(tpl.find('.js-profile-fullname').value); + const username = $.trim(tpl.find('.js-profile-username').value); + const initials = $.trim(tpl.find('.js-profile-initials').value); Users.update(Meteor.userId(), {$set: { 'profile.fullname': fullname, - 'profile.initials': initials + 'profile.initials': initials, }}); // XXX We should report the error to the user. if (username !== Meteor.user().username) { Meteor.call('setUsername', username); } Popup.back(); - } + }, }); // XXX For some reason the useraccounts autofocus isnt working in this case. // See https://github.com/meteor-useraccounts/core/issues/384 -Template.changePasswordPopup.onRendered(function() { +Template.changePasswordPopup.onRendered(() => { this.find('#at-field-current_password').focus(); }); Template.changeLanguagePopup.helpers({ - languages: function() { - return _.map(TAPi18n.getLanguages(), function(lang, tag) { - return { - tag: tag, - name: lang.name - }; + languages() { + return _.map(TAPi18n.getLanguages(), (lang, tag) => { + const name = lang.name; + return { tag, name }; }); }, - isCurrentLanguage: function() { + + isCurrentLanguage() { return this.tag === TAPi18n.getLanguage(); - } + }, }); Template.changeLanguagePopup.events({ - 'click .js-set-language': function(evt) { + 'click .js-set-language'(evt) { Users.update(Meteor.userId(), { $set: { - 'profile.language': this.tag - } + 'profile.language': this.tag, + }, }); evt.preventDefault(); - } + }, }); |