Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2017-07-19 01:27:01 +0300
committerMike Greiling <mike@pixelcog.com>2017-07-19 01:27:01 +0300
commitf2c0ab398eb71ba9549ebd6d70b7fa7c8707b380 (patch)
treed4676cd83df55f28e521fd790c4ab3b1d1561bae /app/assets/javascripts/users
parent339baf8f5d7716baa1a6924c94f1896cf8f6805f (diff)
refactor users bundle, remove inline javascript, and transform into an async chunk
Diffstat (limited to 'app/assets/javascripts/users')
-rw-r--r--app/assets/javascripts/users/index.js22
-rw-r--r--app/assets/javascripts/users/user.js34
2 files changed, 18 insertions, 38 deletions
diff --git a/app/assets/javascripts/users/index.js b/app/assets/javascripts/users/index.js
index c9d5da5c5f9..33a83f8dae5 100644
--- a/app/assets/javascripts/users/index.js
+++ b/app/assets/javascripts/users/index.js
@@ -1,5 +1,19 @@
-import User from './user';
+import Cookies from 'js-cookie';
+import UserTabs from './user_tabs';
-// use legacy exports until embedded javascript is refactored
-window.gl = window.gl || {};
-window.gl.User = User;
+export default function 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();
+ });
+}
diff --git a/app/assets/javascripts/users/user.js b/app/assets/javascripts/users/user.js
deleted file mode 100644
index 0b0a3e1afb4..00000000000
--- a/app/assets/javascripts/users/user.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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();
- });
- }
-}