Commit 0b4b3833 authored by Fatih Acet's avatar Fatih Acet

Merge branch 'users-es6' into 'master'

Front End - Rewrote ES5 `user.js` to ES6 `user.js.es6`

## What does this MR do?

This MR removes the `users.js` file in `app/assets/javascripts/users.js` and replaces it with ES6.

* It also adds the file extension `.es6` so that the sprockets babel gem can transpile it to ES5.
* The new file is: `users.js.es6` in `app/assets/javascripts/`
* Replaced `new User` with `new gl.User` in `app/views/users/show.html.haml`

## Are there points in the code the reviewer needs to double check?

I followed the AirBnb guide, but if there are any mistakes let me know!

## Why was this MR needed?

Because the entire coffee script codebase was transferred over to ES5 with a plan to move everything over to ES6 😄 

## What are the relevant issue numbers?

#20098 

## Screenshots (if relevant)

## Does this MR meet the acceptance criteria?

- Tests
  - [x] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5676
parents f90c6a24 f43a0470
(function() {
this.User = (function() {
function User(opts) {
(global => {
global.User = class {
constructor(opts) {
this.opts = opts;
$('.profile-groups-avatars').tooltip({
"placement": "top"
});
this.placeProfileAvatarsToTop();
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();
this.hideProjectLimitMessage();
}
placeProfileAvatarsToTop() {
$('.profile-groups-avatars').tooltip({
placement: 'top'
});
}
User.prototype.initTabs = function() {
initTabs() {
return new UserTabs({
parentEl: '.user-profile',
action: this.opts.action
});
};
return User;
})();
}
}).call(this);
hideProjectLimitMessage() {
$('.hide-project-limit-message').on('click', e => {
e.preventDefault();
const path = gon.relative_url_root || '/';
$.cookie('hide_project_limit_message', 'false', {
path: path
});
$(this).parents('.project-limit-message').remove();
});
}
}
})(window.gl || (window.gl = {}));
......@@ -123,6 +123,6 @@
:javascript
var userProfile;
userProfile = new User({
userProfile = new gl.User({
action: "#{controller.action_name}"
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment