index.js 794 Bytes
Newer Older
1
import UserCallout from '~/user_callout';
2 3
import Cookies from 'js-cookie';
import UserTabs from './user_tabs';
Mike Greiling's avatar
Mike Greiling committed
4

5
function initUserProfile(action) {
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
  // 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();
  });
}
21 22 23 24 25

document.addEventListener('DOMContentLoaded', () => {
  const page = $('body').attr('data-page');
  const action = page.split(':')[1];
  initUserProfile(action);
26
  new UserCallout(); // eslint-disable-line no-new
27
});