summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Ho <ClemMakesApps@gmail.com>2018-01-12 12:48:28 -0600
committerClement Ho <ClemMakesApps@gmail.com>2018-01-12 12:48:28 -0600
commitd85f72b10bfbaf202ae3329509b45b82362f2ec6 (patch)
treed03e08a6bf2731fd8dd651a1d6890d66189f1081
parent8a49e97bebb57eb763533b32e968547f37fa659e (diff)
downloadgitlab-ce-d85f72b10bfbaf202ae3329509b45b82362f2ec6.tar.gz
Refactor into init_labelsprojects-l
-rw-r--r--app/assets/javascripts/init_labels.js18
-rw-r--r--app/assets/javascripts/pages/projects/labels/index/index.js19
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;