diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2018-01-12 20:21:32 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-01-12 20:21:32 +0000 |
commit | 1b5f179557d03683f92ed3af3d357df056cc8ece (patch) | |
tree | 1327ed937389be8a2085dd9ee9671d16ebf29db8 | |
parent | e4aa2bd30f32f6df167b7c728a2f92897fe28736 (diff) | |
parent | d85f72b10bfbaf202ae3329509b45b82362f2ec6 (diff) | |
download | gitlab-ce-1b5f179557d03683f92ed3af3d357df056cc8ece.tar.gz |
Merge branch 'projects-l' into 'master'
Refactor projects:l*
See merge request gitlab-org/gitlab-ce!16393
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(); |