2017-05-04 08:11:15 -04:00
|
|
|
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';
|
2017-08-14 03:26:19 -04:00
|
|
|
import SidebarMoveIssue from './lib/sidebar_move_issue';
|
2017-05-04 08:11:15 -04:00
|
|
|
|
|
|
|
import Mediator from './sidebar_mediator';
|
|
|
|
|
2017-05-05 14:23:31 -04:00
|
|
|
function domContentLoaded() {
|
2017-07-25 11:46:15 -04:00
|
|
|
const sidebarOptions = JSON.parse(document.querySelector('.js-sidebar-options').innerHTML);
|
|
|
|
const mediator = new Mediator(sidebarOptions);
|
2017-05-04 08:11:15 -04:00
|
|
|
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');
|
2017-05-04 08:11:15 -04:00
|
|
|
// 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);
|
2017-08-14 03:26:19 -04:00
|
|
|
|
|
|
|
new SidebarMoveIssue(
|
|
|
|
mediator,
|
|
|
|
$('.js-move-issue'),
|
|
|
|
$('.js-move-issue-confirmation-button'),
|
|
|
|
).init();
|
2017-08-07 19:56:16 -04:00
|
|
|
}
|
|
|
|
|
2017-05-04 08:11:15 -04:00
|
|
|
new Vue(sidebarTimeTracking).$mount('#issuable-time-tracker');
|
2017-05-05 14:23:31 -04:00
|
|
|
}
|
2017-05-04 08:11:15 -04:00
|
|
|
|
2017-05-05 14:23:31 -04:00
|
|
|
document.addEventListener('DOMContentLoaded', domContentLoaded);
|
|
|
|
|
|
|
|
export default domContentLoaded;
|