refactor UserTabs class to ES module syntax

This commit is contained in:
Mike Greiling 2017-06-30 17:48:54 -05:00
parent 24c2739be9
commit d30e66c9a8
3 changed files with 3 additions and 6 deletions

View File

@ -156,7 +156,6 @@ import './todos';
import './tree';
import './usage_ping';
import './user';
import './user_tabs';
// eslint-disable-next-line global-require, import/no-commonjs
if (process.env.NODE_ENV !== 'production') require('./test_utils/');

View File

@ -1,6 +1,7 @@
/* eslint-disable class-methods-use-this, comma-dangle, arrow-parens, no-param-reassign */
import Cookies from 'js-cookie';
import UserTabs from './user_tabs';
class User {
constructor({ action }) {
@ -17,7 +18,7 @@ class User {
}
initTabs() {
return new window.gl.UserTabs({
return new UserTabs({
parentEl: '.user-profile',
action: this.action
});

View File

@ -60,7 +60,7 @@ content on the Users#show page.
</div>
*/
class UserTabs {
export default class UserTabs {
constructor ({ defaultAction, action, parentEl }) {
this.loaded = {};
this.defaultAction = defaultAction || 'activity';
@ -171,6 +171,3 @@ class UserTabs {
return this.$parentEl.find('.nav-links .active a').data('action');
}
}
window.gl = window.gl || {};
window.gl.UserTabs = UserTabs;