Files
gitlab-ce/app/assets/javascripts/blob/filepath_form/index.js
2024-02-20 15:11:24 +00:00

31 lines
741 B
JavaScript

import Vue from 'vue';
import FilepathForm from './components/filepath_form.vue';
const getInputOptions = (el) => {
const { testid, qa_selector: qaSelector, ...options } = JSON.parse(el.dataset.inputOptions);
return {
...options,
'data-testid': testid,
};
};
export default ({ onTemplateSelected }) => {
const el = document.getElementById('js-template-selectors-menu');
return new Vue({
el,
render(h) {
return h(FilepathForm, {
props: {
inputOptions: getInputOptions(el),
templates: JSON.parse(el.dataset.templates),
initialTemplate: el.dataset.selected,
},
on: {
'template-selected': onTemplateSelected,
},
});
},
});
};