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:
Regis 2016-08-04 12:18:00 -06:00
parent bceafa4e8e
commit 7ed0acd422
3 changed files with 36 additions and 30 deletions

View File

@ -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);

View 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 = {}));

View File

@ -123,6 +123,6 @@
:javascript
var userProfile;
userProfile = new User({
userProfile = new gl.User({
action: "#{controller.action_name}"
});