summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pages/groups/new/index.js
blob: 322ad2c79e7f4d344bde5fe498e27cdc1dbd7879 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import $ from 'jquery';
import BindInOut from '~/behaviors/bind_in_out';
import initFilePickers from '~/file_pickers';
import Group from '~/group';
import LinkedTabs from '~/lib/utils/bootstrap_linked_tabs';
import GroupPathValidator from './group_path_validator';

const parentId = $('#group_parent_id');
if (!parentId.val()) {
  new GroupPathValidator(); // eslint-disable-line no-new
}
BindInOut.initAll();
initFilePickers();

new Group(); // eslint-disable-line no-new

const CONTAINER_SELECTOR = '.group-edit-container .nav-tabs';
const DEFAULT_ACTION = '#create-group-pane';
// eslint-disable-next-line no-new
new LinkedTabs({
  defaultAction: DEFAULT_ACTION,
  parentEl: CONTAINER_SELECTOR,
  hashedTabs: true,
});

if (window.location.hash) {
  $(CONTAINER_SELECTOR).find(`a[href="${window.location.hash}"]`).tab('show');
}