summaryrefslogtreecommitdiff
path: root/web-ui
diff options
context:
space:
mode:
authorGislene Pereira <gislene01@gmail.com>2015-12-01 12:29:33 -0200
committerPixelated <pixelated@pix-poa-1>2015-12-03 21:16:58 -0200
commit10d378faf09ec71147994ba0c47033f1745272b3 (patch)
treeb3bc0e7a1b9b339a4e88951b7586faffaa949669 /web-ui
parent1e0032ceaeb50e0c557f57dd7e1cfb34397b28e3 (diff)
Issue #411 - Display user email in user settings popup [w/ @jeffhsta]
Diffstat (limited to 'web-ui')
-rw-r--r--web-ui/app/js/page/user_settings_box.js27
-rw-r--r--web-ui/app/templates/page/user_settings_box.hbs2
2 files changed, 25 insertions, 4 deletions
diff --git a/web-ui/app/js/page/user_settings_box.js b/web-ui/app/js/page/user_settings_box.js
index 32a06ed3..299f6237 100644
--- a/web-ui/app/js/page/user_settings_box.js
+++ b/web-ui/app/js/page/user_settings_box.js
@@ -14,7 +14,15 @@
* You should have received a copy of the GNU Affero General Public License
* along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
*/
-define(['flight/lib/component', 'features', 'views/templates', 'page/events'], function (defineComponent, features, templates, events) {
+define(
+ [
+ 'flight/lib/component',
+ 'features',
+ 'views/templates',
+ 'page/events',
+ 'helpers/monitored_ajax'
+ ], function (defineComponent, features, templates, events, monitoredAjax) {
+
'use strict';
return defineComponent(function () {
@@ -23,10 +31,24 @@ define(['flight/lib/component', 'features', 'views/templates', 'page/events'], f
});
this.render = function () {
- this.$node.html(templates.page.userSettingsBox());
if (features.isLogoutEnabled()) {
this.$node.addClass('extra-bottom-space');
}
+
+ var success = function (userSettings) {
+ this.$node.html(templates.page.userSettingsBox(userSettings));
+ this.on(this.attr.close, 'click', this.toggleHidden);
+ };
+
+ var failure = function (resp) {
+ var msg = i18n('Could not get mail address');
+ this.trigger(document, events.ui.userAlerts.displayMessage, { message: msg });
+ };
+
+ monitoredAjax(this, '/user-settings', {
+ type: 'GET',
+ contentType: 'application/json; charset=utf-8'
+ }).done(success.bind(this)).fail(failure.bind(this));
};
this.toggleHidden = function() {
@@ -40,7 +62,6 @@ define(['flight/lib/component', 'features', 'views/templates', 'page/events'], f
this.after('initialize', function () {
this.render();
this.on(document, events.ui.userSettingsBox.toggle, this.toggleHidden);
- this.on(this.attr.close, 'click', this.toggleHidden);
});
});
});
diff --git a/web-ui/app/templates/page/user_settings_box.hbs b/web-ui/app/templates/page/user_settings_box.hbs
index 187d603b..eb227dcf 100644
--- a/web-ui/app/templates/page/user_settings_box.hbs
+++ b/web-ui/app/templates/page/user_settings_box.hbs
@@ -4,4 +4,4 @@
<h1>User Settings</h1>
<i class="shortcut-label"></i>
</header>
-<p>$account_email</p>
+<p>{{ account_email }}</p>