diff options
Diffstat (limited to 'client/components/users/userHeader.js')
-rw-r--r-- | client/components/users/userHeader.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/client/components/users/userHeader.js b/client/components/users/userHeader.js new file mode 100644 index 00000000..3bb9e623 --- /dev/null +++ b/client/components/users/userHeader.js @@ -0,0 +1,39 @@ +Template.headerUserBar.events({ + 'click .js-open-header-member-menu': Popup.open('memberMenu') +}); + +Template.setLanguagePopup.helpers({ + languages: function() { + return _.map(TAPi18n.getLanguages(), function(lang, tag) { + return { + tag: tag, + name: lang.name + }; + }); + }, + isCurrentLanguage: function() { + return this.tag === TAPi18n.getLanguage(); + } +}); + +Template.memberMenuPopup.events({ + 'click .js-language': Popup.open('setLanguage'), + 'click .js-logout': function(evt) { + evt.preventDefault(); + + Meteor.logout(function() { + Router.go('Home'); + }); + } +}); + +Template.setLanguagePopup.events({ + 'click .js-set-language': function(evt) { + Users.update(Meteor.userId(), { + $set: { + 'profile.language': this.tag + } + }); + evt.preventDefault(); + } +}); |