From f716049998ec41d8f26caedd65ebd1a247179926 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Thu, 11 Jan 2018 11:39:54 -0600 Subject: Code improvements --- app/assets/javascripts/dispatcher.js | 4 +++- app/assets/javascripts/pages/projects/labels/edit/index.js | 4 +--- app/assets/javascripts/pages/projects/labels/index/index.js | 7 +++---- app/assets/javascripts/pages/projects/labels/new/index.js | 4 +--- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js index 0794edd5f69..e8ec6daf687 100644 --- a/app/assets/javascripts/dispatcher.js +++ b/app/assets/javascripts/dispatcher.js @@ -482,13 +482,15 @@ import Activities from './activities'; break; case 'groups:labels:new': case 'groups:labels:edit': + new Labels(); + break; case 'projects:labels:new': import('./pages/projects/labels/new') .then(callDefault) .catch(fail); break; case 'projects:labels:edit': - import('./pages/projects/labels/new') + import('./pages/projects/labels/edit') .then(callDefault) .catch(fail); break; diff --git a/app/assets/javascripts/pages/projects/labels/edit/index.js b/app/assets/javascripts/pages/projects/labels/edit/index.js index 75dc1ef1859..72c5e4744ac 100644 --- a/app/assets/javascripts/pages/projects/labels/edit/index.js +++ b/app/assets/javascripts/pages/projects/labels/edit/index.js @@ -1,5 +1,3 @@ import Labels from '~/labels'; -export default function () { - new Labels(); // eslint-disable-line no-new -} +export default () => new Labels(); diff --git a/app/assets/javascripts/pages/projects/labels/index/index.js b/app/assets/javascripts/pages/projects/labels/index/index.js index c258be4f908..82a5b4d0760 100644 --- a/app/assets/javascripts/pages/projects/labels/index/index.js +++ b/app/assets/javascripts/pages/projects/labels/index/index.js @@ -1,19 +1,18 @@ -/* eslint-disable no-new */ import LabelManager from '~/label_manager'; import GroupLabelSubscription from '~/group_label_subscription'; import ProjectLabelSubscription from '~/project_label_subscription'; export default () => { if ($('.prioritized-labels').length) { - new LabelManager(); + new LabelManager(); // eslint-disable-line no-new } $('.label-subscription').each((i, el) => { const $el = $(el); if ($el.find('.dropdown-group-label').length) { - new GroupLabelSubscription($el); + new GroupLabelSubscription($el); // eslint-disable-line no-new } else { - new ProjectLabelSubscription($el); + new ProjectLabelSubscription($el); // eslint-disable-line no-new } }); }; diff --git a/app/assets/javascripts/pages/projects/labels/new/index.js b/app/assets/javascripts/pages/projects/labels/new/index.js index 75dc1ef1859..72c5e4744ac 100644 --- a/app/assets/javascripts/pages/projects/labels/new/index.js +++ b/app/assets/javascripts/pages/projects/labels/new/index.js @@ -1,5 +1,3 @@ import Labels from '~/labels'; -export default function () { - new Labels(); // eslint-disable-line no-new -} +export default () => new Labels(); -- cgit v1.2.1