From c734aa55a5d6186bfc87dd89ef7efafdbc20dacd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 20 Mar 2014 11:45:58 +0100 Subject: [PATCH] editor: showing current user name --- src/editor/modules/mainBar/mainBar.js | 9 ++++++++- src/editor/modules/mainBar/template.html | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/editor/modules/mainBar/mainBar.js b/src/editor/modules/mainBar/mainBar.js index e2e09c3..8658c27 100644 --- a/src/editor/modules/mainBar/mainBar.js +++ b/src/editor/modules/mainBar/mainBar.js @@ -7,7 +7,14 @@ define([ return function(sandbox) { - var view = $(_.template(template)()); + /* globals gettext*/ + + var config = sandbox.getConfig(), + userName = config.user && config.user.name, + view = $(_.template(template)({ + userName: userName || gettext('anonymous') + })); + view.find('[data-cmd]').click(function(e) { e.preventDefault(); sandbox.publish('cmd.' + $(e.target).attr('data-cmd')); diff --git a/src/editor/modules/mainBar/template.html b/src/editor/modules/mainBar/template.html index eeecd62..d4746d2 100644 --- a/src/editor/modules/mainBar/template.html +++ b/src/editor/modules/mainBar/template.html @@ -2,6 +2,7 @@ -- 2.20.1