Commit d30e66c9 authored by Mike Greiling's avatar Mike Greiling

refactor UserTabs class to ES module syntax

parent 24c2739b
...@@ -156,7 +156,6 @@ import './todos'; ...@@ -156,7 +156,6 @@ import './todos';
import './tree'; import './tree';
import './usage_ping'; import './usage_ping';
import './user'; import './user';
import './user_tabs';
// eslint-disable-next-line global-require, import/no-commonjs // eslint-disable-next-line global-require, import/no-commonjs
if (process.env.NODE_ENV !== 'production') require('./test_utils/'); if (process.env.NODE_ENV !== 'production') require('./test_utils/');
......
/* eslint-disable class-methods-use-this, comma-dangle, arrow-parens, no-param-reassign */ /* eslint-disable class-methods-use-this, comma-dangle, arrow-parens, no-param-reassign */
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import UserTabs from './user_tabs';
class User { class User {
constructor({ action }) { constructor({ action }) {
...@@ -17,7 +18,7 @@ class User { ...@@ -17,7 +18,7 @@ class User {
} }
initTabs() { initTabs() {
return new window.gl.UserTabs({ return new UserTabs({
parentEl: '.user-profile', parentEl: '.user-profile',
action: this.action action: this.action
}); });
......
...@@ -60,7 +60,7 @@ content on the Users#show page. ...@@ -60,7 +60,7 @@ content on the Users#show page.
</div> </div>
*/ */
class UserTabs { export default class UserTabs {
constructor ({ defaultAction, action, parentEl }) { constructor ({ defaultAction, action, parentEl }) {
this.loaded = {}; this.loaded = {};
this.defaultAction = defaultAction || 'activity'; this.defaultAction = defaultAction || 'activity';
...@@ -171,6 +171,3 @@ class UserTabs { ...@@ -171,6 +171,3 @@ class UserTabs {
return this.$parentEl.find('.nav-links .active a').data('action'); return this.$parentEl.find('.nav-links .active a').data('action');
} }
} }
window.gl = window.gl || {};
window.gl.UserTabs = UserTabs;
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