debian-mirror-gitlab/app/assets/javascripts/projects/upload_file.js

34 lines
789 B
JavaScript
Raw Normal View History

2021-04-17 20:07:23 +05:30
import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import createRouter from '~/repository/router';
import UploadButton from './details/upload_button.vue';
export const initUploadFileTrigger = () => {
2021-12-11 22:18:48 +05:30
const uploadFileTriggerEl = document.querySelector('.js-upload-file-trigger');
2021-04-17 20:07:23 +05:30
if (!uploadFileTriggerEl) return false;
const {
targetBranch,
originalBranch,
canPushCode,
path,
projectPath,
} = uploadFileTriggerEl.dataset;
return new Vue({
el: uploadFileTriggerEl,
router: createRouter(projectPath, originalBranch),
provide: {
targetBranch,
originalBranch,
canPushCode: parseBoolean(canPushCode),
path,
projectPath,
},
render(h) {
return h(UploadButton);
},
});
};