gitlab-org--gitlab-foss/app/assets/javascripts/sidebar/sidebar_bundle.js

49 lines
1.6 KiB
JavaScript
Raw Normal View History

import Vue from 'vue';
import sidebarTimeTracking from './components/time_tracking/sidebar_time_tracking';
import sidebarAssignees from './components/assignees/sidebar_assignees';
2017-08-07 19:56:16 -04:00
import confidential from './components/confidential/confidential_issue_sidebar.vue';
import SidebarMoveIssue from './lib/sidebar_move_issue';
import Mediator from './sidebar_mediator';
2017-05-05 14:23:31 -04:00
function domContentLoaded() {
const sidebarOptions = JSON.parse(document.querySelector('.js-sidebar-options').innerHTML);
const mediator = new Mediator(sidebarOptions);
mediator.fetch();
const sidebarAssigneesEl = document.querySelector('#js-vue-sidebar-assignees');
2017-08-07 19:56:16 -04:00
const confidentialEl = document.querySelector('#js-confidential-entry-point');
// Only create the sidebarAssignees vue app if it is found in the DOM
// We currently do not use sidebarAssignees for the MR page
if (sidebarAssigneesEl) {
new Vue(sidebarAssignees).$mount(sidebarAssigneesEl);
}
2017-08-07 19:56:16 -04:00
if (confidentialEl) {
const dataNode = document.getElementById('js-confidential-issue-data');
const initialData = JSON.parse(dataNode.innerHTML);
const ConfidentialComp = Vue.extend(confidential);
new ConfidentialComp({
propsData: {
isConfidential: initialData.is_confidential,
isEditable: initialData.is_editable,
service: mediator.service,
},
}).$mount(confidentialEl);
new SidebarMoveIssue(
mediator,
$('.js-move-issue'),
$('.js-move-issue-confirmation-button'),
).init();
2017-08-07 19:56:16 -04:00
}
new Vue(sidebarTimeTracking).$mount('#issuable-time-tracker');
2017-05-05 14:23:31 -04:00
}
2017-05-05 14:23:31 -04:00
document.addEventListener('DOMContentLoaded', domContentLoaded);
export default domContentLoaded;