aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/account/app.js
blob: efe802f13832b19fcbcaff9eb94e8a6731d51fba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
define([
  './change-password-view'
], function (ChangePasswordView) {

  var $ = jQuery;
  var shouldShowAvatars = window.sonar.properties['sonar.lf.enableGravatar'];
  var favorites = $('.js-account-favorites tr');

  function showExtraFavorites () {
    favorites.removeClass('hidden');
  }

  return {
    start: function () {
      $('html').addClass('dashboard-page');

      if (shouldShowAvatars) {
        var avatarHtml = Handlebars.helpers.avatarHelper(window.SS.userEmail, 100).string;
        $('.js-avatar').html(avatarHtml);
      }

      $('.js-show-all-favorites').on('click', function (e) {
        e.preventDefault();
        $(e.currentTarget).hide();
        showExtraFavorites();
      });

      $('#account-change-password-trigger').on('click', function (e) {
        e.preventDefault();
        new ChangePasswordView().render();
      });
    }
  };

});