diff options
author | Clement Ho <ClemMakesApps@gmail.com> | 2018-01-12 12:48:28 -0600 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2018-01-12 12:48:28 -0600 |
commit | d85f72b10bfbaf202ae3329509b45b82362f2ec6 (patch) | |
tree | d03e08a6bf2731fd8dd651a1d6890d66189f1081 | |
parent | 8a49e97bebb57eb763533b32e968547f37fa659e (diff) | |
download | gitlab-ce-d85f72b10bfbaf202ae3329509b45b82362f2ec6.tar.gz |
Refactor into init_labelsprojects-l
-rw-r--r-- | app/assets/javascripts/init_labels.js | 18 | ||||
-rw-r--r-- | app/assets/javascripts/pages/projects/labels/index/index.js | 19 |
2 files changed, 20 insertions, 17 deletions
diff --git a/app/assets/javascripts/init_labels.js b/app/assets/javascripts/init_labels.js new file mode 100644 index 00000000000..5f20055510f --- /dev/null +++ b/app/assets/javascripts/init_labels.js @@ -0,0 +1,18 @@ +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(); // eslint-disable-line no-new + } + $('.label-subscription').each((i, el) => { + const $el = $(el); + + if ($el.find('.dropdown-group-label').length) { + new GroupLabelSubscription($el); // eslint-disable-line no-new + } else { + new ProjectLabelSubscription($el); // eslint-disable-line no-new + } + }); +}; diff --git a/app/assets/javascripts/pages/projects/labels/index/index.js b/app/assets/javascripts/pages/projects/labels/index/index.js index 82a5b4d0760..018345fa112 100644 --- a/app/assets/javascripts/pages/projects/labels/index/index.js +++ b/app/assets/javascripts/pages/projects/labels/index/index.js @@ -1,18 +1,3 @@ -import LabelManager from '~/label_manager'; -import GroupLabelSubscription from '~/group_label_subscription'; -import ProjectLabelSubscription from '~/project_label_subscription'; +import initLabels from '~/init_labels'; -export default () => { - if ($('.prioritized-labels').length) { - 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); // eslint-disable-line no-new - } else { - new ProjectLabelSubscription($el); // eslint-disable-line no-new - } - }); -}; +export default initLabels; |