gitlab-org--gitlab-foss/app/assets/javascripts/boards/components/board_sidebar.js.es6

58 lines
1.4 KiB
JavaScript
Raw Normal View History

2016-10-04 14:27:02 +00:00
(() => {
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.BoardSidebar = Vue.extend({
props: {
currentUser: Object
},
2016-10-04 14:27:02 +00:00
data() {
return {
2016-10-05 07:49:40 +00:00
detail: Store.detail,
issue: {}
2016-10-04 14:27:02 +00:00
};
},
2016-10-05 07:49:40 +00:00
computed: {
showSidebar () {
return Object.keys(this.issue).length;
}
2016-10-04 14:27:02 +00:00
},
watch: {
2016-10-05 07:49:40 +00:00
detail: {
2016-10-04 14:27:02 +00:00
handler () {
2016-10-05 07:49:40 +00:00
this.issue = this.detail.issue;
2016-10-04 14:27:02 +00:00
},
deep: true
2016-10-05 07:49:40 +00:00
},
issue () {
if (this.showSidebar) {
this.$nextTick(() => {
this.issuableContext = new IssuableContext(this.currentUser);
this.milestoneSelect = new MilestoneSelect();
this.dueDateSelect = new gl.DueDateSelectors();
this.labelsSelect = new LabelsSelect();
this.sidebar = new Sidebar();
this.subscription = new Subscription('.subscription');
2016-10-05 07:49:40 +00:00
});
} else {
$('.right-sidebar').getNiceScroll().remove();
delete this.issuableContext;
delete this.milestoneSelect;
delete this.dueDateSelect;
delete this.labelsSelect;
delete this.sidebar;
delete this.subscription;
2016-10-05 07:49:40 +00:00
}
}
},
methods: {
closeSidebar () {
this.detail.issue = {};
2016-10-04 14:27:02 +00:00
}
}
});
})();