debian-mirror-gitlab/app/assets/javascripts/groups/create_edit_form.js
2022-07-29 14:03:07 +02:00

29 lines
755 B
JavaScript

import Vue from 'vue';
import { parseRailsFormFields } from '~/lib/utils/forms';
import { parseBoolean } from '~/lib/utils/common_utils';
import GroupNameAndPath from './components/group_name_and_path.vue';
export const initGroupNameAndPath = () => {
const elements = document.querySelectorAll('.js-group-name-and-path');
if (!elements.length) {
return;
}
elements.forEach((element) => {
const fields = parseRailsFormFields(element);
const { basePath, mattermostEnabled } = element.dataset;
return new Vue({
el: element,
provide: {
fields,
basePath,
mattermostEnabled: parseBoolean(mattermostEnabled),
},
render(h) {
return h(GroupNameAndPath);
},
});
});
};