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
This commit is contained in:
parent
bceafa4e8e
commit
7ed0acd422
3 changed files with 36 additions and 30 deletions
|
@ -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);
|
35
app/assets/javascripts/user.js.es6
Normal file
35
app/assets/javascripts/user.js.es6
Normal file
|
@ -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 = {}));
|
|
@ -123,6 +123,6 @@
|
|||
:javascript
|
||||
var userProfile;
|
||||
|
||||
userProfile = new User({
|
||||
userProfile = new gl.User({
|
||||
action: "#{controller.action_name}"
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue