summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-01-12 20:21:32 +0000
committerFilipa Lacerda <filipa@gitlab.com>2018-01-12 20:21:32 +0000
commit1b5f179557d03683f92ed3af3d357df056cc8ece (patch)
tree1327ed937389be8a2085dd9ee9671d16ebf29db8
parente4aa2bd30f32f6df167b7c728a2f92897fe28736 (diff)
parentd85f72b10bfbaf202ae3329509b45b82362f2ec6 (diff)
downloadgitlab-ce-1b5f179557d03683f92ed3af3d357df056cc8ece.tar.gz
Merge branch 'projects-l' into 'master'
Refactor projects:l* See merge request gitlab-org/gitlab-ce!16393
-rw-r--r--app/assets/javascripts/dispatcher.js16
-rw-r--r--app/assets/javascripts/init_labels.js18
-rw-r--r--app/assets/javascripts/pages/projects/labels/edit/index.js3
-rw-r--r--app/assets/javascripts/pages/projects/labels/index/index.js3
-rw-r--r--app/assets/javascripts/pages/projects/labels/new/index.js3
5 files changed, 41 insertions, 2 deletions
diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js
index 6880784d7d0..64fb8aaeb7a 100644
--- a/app/assets/javascripts/dispatcher.js
+++ b/app/assets/javascripts/dispatcher.js
@@ -442,12 +442,24 @@ 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':
- new Labels();
+ import('./pages/projects/labels/edit')
+ .then(callDefault)
+ .catch(fail);
break;
- case 'groups:labels:index':
case 'projects:labels:index':
+ import('./pages/projects/labels/index')
+ .then(callDefault)
+ .catch(fail);
+ break;
+ case 'groups:labels:index':
if ($('.prioritized-labels').length) {
new LabelManager();
}
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/edit/index.js b/app/assets/javascripts/pages/projects/labels/edit/index.js
new file mode 100644
index 00000000000..72c5e4744ac
--- /dev/null
+++ b/app/assets/javascripts/pages/projects/labels/edit/index.js
@@ -0,0 +1,3 @@
+import Labels from '~/labels';
+
+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
new file mode 100644
index 00000000000..018345fa112
--- /dev/null
+++ b/app/assets/javascripts/pages/projects/labels/index/index.js
@@ -0,0 +1,3 @@
+import initLabels from '~/init_labels';
+
+export default initLabels;
diff --git a/app/assets/javascripts/pages/projects/labels/new/index.js b/app/assets/javascripts/pages/projects/labels/new/index.js
new file mode 100644
index 00000000000..72c5e4744ac
--- /dev/null
+++ b/app/assets/javascripts/pages/projects/labels/new/index.js
@@ -0,0 +1,3 @@
+import Labels from '~/labels';
+
+export default () => new Labels();