diff options
| author | Gislene Pereira <gislene01@gmail.com> | 2015-12-01 12:29:33 -0200 | 
|---|---|---|
| committer | Pixelated <pixelated@pix-poa-1> | 2015-12-03 21:16:58 -0200 | 
| commit | 10d378faf09ec71147994ba0c47033f1745272b3 (patch) | |
| tree | b3bc0e7a1b9b339a4e88951b7586faffaa949669 /web-ui/app/js/page | |
| parent | 1e0032ceaeb50e0c557f57dd7e1cfb34397b28e3 (diff) | |
Issue #411 - Display user email in user settings popup [w/ @jeffhsta]
Diffstat (limited to 'web-ui/app/js/page')
| -rw-r--r-- | web-ui/app/js/page/user_settings_box.js | 27 | 
1 files changed, 24 insertions, 3 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);      });    });  }); | 
