summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pages/users/show/index.js
blob: cc0301009448e153c094b18e43d40f58e255f986 (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
import UserCallout from '~/user_callout';
import Cookies from 'js-cookie';
import UserTabs from '../../../users/user_tabs';

const initUserProfile = (action) => {
  // place profile avatars to top
  $('.profile-groups-avatars').tooltip({
    placement: 'top',
  });

  // eslint-disable-next-line no-new
  new UserTabs({ parentEl: '.user-profile', action });

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

export default () => {
  const page = $('body').attr('data-page');
  const action = page.split(':')[1];
  initUserProfile(action);
  new UserCallout(); // eslint-disable-line no-new
};