diff options
author | Jacob Schatz <jschatz@gitlab.com> | 2018-01-11 08:23:25 -0500 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2018-01-11 08:23:25 -0500 |
commit | d08610c3a654177b3e5b90a2e5f9b2f74bc8d002 (patch) | |
tree | c60ebc6e8adbe5eba751c4ddc6c88cce014e8d88 /app | |
parent | 0a51eae58642d2c1df27166092efa2d75ec1cbe0 (diff) | |
download | gitlab-ce-d08610c3a654177b3e5b90a2e5f9b2f74bc8d002.tar.gz |
Refactor projects:l*
Diffstat (limited to 'app')
4 files changed, 41 insertions, 2 deletions
diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js index e35f53081ec..0794edd5f69 100644 --- a/app/assets/javascripts/dispatcher.js +++ b/app/assets/javascripts/dispatcher.js @@ -483,11 +483,21 @@ import Activities from './activities'; case 'groups:labels:new': case 'groups:labels:edit': case 'projects:labels:new': + import('./pages/projects/labels/new') + .then(callDefault) + .catch(fail); + break; case 'projects:labels:edit': - new Labels(); + import('./pages/projects/labels/new') + .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/pages/projects/labels/edit/index.js b/app/assets/javascripts/pages/projects/labels/edit/index.js new file mode 100644 index 00000000000..75dc1ef1859 --- /dev/null +++ b/app/assets/javascripts/pages/projects/labels/edit/index.js @@ -0,0 +1,5 @@ +import Labels from '~/labels'; + +export default function () { + new Labels(); // 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 new file mode 100644 index 00000000000..c258be4f908 --- /dev/null +++ b/app/assets/javascripts/pages/projects/labels/index/index.js @@ -0,0 +1,19 @@ +/* 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(); + } + $('.label-subscription').each((i, el) => { + const $el = $(el); + + if ($el.find('.dropdown-group-label').length) { + new GroupLabelSubscription($el); + } else { + new ProjectLabelSubscription($el); + } + }); +}; 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..75dc1ef1859 --- /dev/null +++ b/app/assets/javascripts/pages/projects/labels/new/index.js @@ -0,0 +1,5 @@ +import Labels from '~/labels'; + +export default function () { + new Labels(); // eslint-disable-line no-new +} |