summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/users/user.js
blob: 0b0a3e1afb4276199c4409eac1c75473006f91a3 (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
/* eslint-disable class-methods-use-this */

import Cookies from 'js-cookie';
import UserTabs from './user_tabs';

export default class User {
  constructor({ action }) {
    this.action = action;
    this.placeProfileAvatarsToTop();
    this.initTabs();
    this.hideProjectLimitMessage();
  }

  placeProfileAvatarsToTop() {
    $('.profile-groups-avatars').tooltip({
      placement: 'top',
    });
  }

  initTabs() {
    return new UserTabs({
      parentEl: '.user-profile',
      action: this.action,
    });
  }

  hideProjectLimitMessage() {
    $('.hide-project-limit-message').on('click', (e) => {
      e.preventDefault();
      Cookies.set('hide_project_limit_message', 'false');
      $(this).parents('.project-limit-message').remove();
    });
  }
}