diff options
author | Regis <boudinot.regis@yahoo.com> | 2016-08-04 12:18:00 -0600 |
---|---|---|
committer | Regis <boudinot.regis@yahoo.com> | 2016-08-25 17:27:20 -0600 |
commit | 7ed0acd422a95c4cbb1406f67929a5da669f2681 (patch) | |
tree | 7a08568809dc705c7b190873091cdac0484366f9 /app | |
parent | bceafa4e8eb7141771bb759fc9b4d625794f784a (diff) | |
download | gitlab-ce-7ed0acd422a95c4cbb1406f67929a5da669f2681.tar.gz |
turned ES5 users.js to ES6 users.js.es6 for babel
added semicolons
remove users.js
rename users to user in filename
removed uneeded semi-colons and returning null in constructor
class is wrapped - a lot of builds will fail
formatting
replaced 'new User' with 'new gl.User' in app/users/show.html.haml
window.gl || window.gl = {} - seeing if rspec9/spinach6/spinach9 will pass
putting window logic before IIFE
Fixed typo in users show view - extracted jquery calls in constructor to prototype methods
fixed window declaration in IIFE argument
adding new line
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/user.js | 29 | ||||
-rw-r--r-- | app/assets/javascripts/user.js.es6 | 35 | ||||
-rw-r--r-- | app/views/users/show.html.haml | 2 |
3 files changed, 36 insertions, 30 deletions
diff --git a/app/assets/javascripts/user.js b/app/assets/javascripts/user.js deleted file mode 100644 index 6c4d88cf407..00000000000 --- a/app/assets/javascripts/user.js +++ /dev/null @@ -1,29 +0,0 @@ -(function() { - this.User = (function() { - function User(opts) { - this.opts = opts; - $('.profile-groups-avatars').tooltip({ - "placement": "top" - }); - this.initTabs(); - $('.hide-project-limit-message').on('click', function(e) { - $.cookie('hide_project_limit_message', 'false', { - path: gon.relative_url_root || '/' - }); - $(this).parents('.project-limit-message').remove(); - return e.preventDefault(); - }); - } - - User.prototype.initTabs = function() { - return new UserTabs({ - parentEl: '.user-profile', - action: this.opts.action - }); - }; - - return User; - - })(); - -}).call(this); diff --git a/app/assets/javascripts/user.js.es6 b/app/assets/javascripts/user.js.es6 new file mode 100644 index 00000000000..c934afa458a --- /dev/null +++ b/app/assets/javascripts/user.js.es6 @@ -0,0 +1,35 @@ +(global => { + global.User = class { + constructor(opts) { + this.opts = opts; + this.placeTop(); + this.initTabs(); + this.hideProjectLimitMessage(); + } + + placeTop() { + $('.profile-groups-avatars').tooltip({ + "placement": "top" + }); + } + + initTabs() { + return new UserTabs({ + parentEl: '.user-profile', + action: this.opts.action + }); + } + + hideProjectLimitMessage() { + $('.hide-project-limit-message').on('click', e => { + const path = '/'; + $.cookie('hide_project_limit_message', 'false', { + path: path + }); + $(this).parents('.project-limit-message').remove(); + e.preventDefault(); + return; + }); + } + } +})(window.gl || (window.gl = {})); diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index c7f39868e71..9a052abe40a 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -123,6 +123,6 @@ :javascript var userProfile; - userProfile = new User({ + userProfile = new gl.User({ action: "#{controller.action_name}" }); |