Refactor projects:l*

This commit is contained in:
Jacob Schatz 2018-01-11 08:23:25 -05:00
parent 0a51eae586
commit d08610c3a6
4 changed files with 41 additions and 2 deletions

View File

@ -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 'projects:labels:index':
import('./pages/projects/labels/index')
.then(callDefault)
.catch(fail);
break;
case 'groups:labels:index':
case 'projects:labels:index':
if ($('.prioritized-labels').length) {
new LabelManager();
}

View File

@ -0,0 +1,5 @@
import Labels from '~/labels';
export default function () {
new Labels(); // eslint-disable-line no-new
}

View File

@ -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);
}
});
};

View File

@ -0,0 +1,5 @@
import Labels from '~/labels';
export default function () {
new Labels(); // eslint-disable-line no-new
}