summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/groups/new_group_child.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/groups/new_group_child.js')
-rw-r--r--app/assets/javascripts/groups/new_group_child.js65
1 files changed, 0 insertions, 65 deletions
diff --git a/app/assets/javascripts/groups/new_group_child.js b/app/assets/javascripts/groups/new_group_child.js
deleted file mode 100644
index bb2aea3ea76..00000000000
--- a/app/assets/javascripts/groups/new_group_child.js
+++ /dev/null
@@ -1,65 +0,0 @@
-import { visitUrl } from '../lib/utils/url_utility';
-import DropLab from '../droplab/drop_lab';
-import ISetter from '../droplab/plugins/input_setter';
-
-const InputSetter = { ...ISetter };
-
-const NEW_PROJECT = 'new-project';
-const NEW_SUBGROUP = 'new-subgroup';
-
-export default class NewGroupChild {
- constructor(buttonWrapper) {
- this.buttonWrapper = buttonWrapper;
- this.newGroupChildButton = this.buttonWrapper.querySelector('.js-new-group-child');
- this.dropdownToggle = this.buttonWrapper.querySelector('.js-dropdown-toggle');
- this.dropdownList = this.buttonWrapper.querySelector('.dropdown-menu');
-
- this.newGroupPath = this.buttonWrapper.dataset.projectPath;
- this.subgroupPath = this.buttonWrapper.dataset.subgroupPath;
-
- this.init();
- }
-
- init() {
- this.initDroplab();
- this.bindEvents();
- }
-
- initDroplab() {
- this.droplab = new DropLab();
- this.droplab.init(
- this.dropdownToggle,
- this.dropdownList,
- [InputSetter],
- this.getDroplabConfig(),
- );
- }
-
- getDroplabConfig() {
- return {
- InputSetter: [
- {
- input: this.newGroupChildButton,
- valueAttribute: 'data-value',
- inputAttribute: 'data-action',
- },
- {
- input: this.newGroupChildButton,
- valueAttribute: 'data-text',
- },
- ],
- };
- }
-
- bindEvents() {
- this.newGroupChildButton.addEventListener('click', this.onClickNewGroupChildButton.bind(this));
- }
-
- onClickNewGroupChildButton(e) {
- if (e.target.dataset.action === NEW_PROJECT) {
- visitUrl(this.newGroupPath);
- } else if (e.target.dataset.action === NEW_SUBGROUP) {
- visitUrl(this.subgroupPath);
- }
- }
-}