Commit 66539563 authored by Phil Hughes's avatar Phil Hughes

Added eventHub events to change the showForm value

[ci skip]
parent 5d19bda4
import Vue from 'vue';
import eventHub from './event_hub';
import issuableApp from './components/app.vue';
import '../vue_shared/vue_resource_interceptor';
document.addEventListener('DOMContentLoaded', () => new Vue({
document.addEventListener('DOMContentLoaded', () => {
$('.issuable-edit').on('click', (e) => {
e.preventDefault();
eventHub.$emit('open.form');
});
return new Vue({
el: document.getElementById('js-issuable-app'),
components: {
issuableApp,
......@@ -25,8 +33,21 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
initialTitle: issuableTitleElement.innerHTML,
initialDescriptionHtml: issuableDescriptionElement ? issuableDescriptionElement.innerHTML : '',
initialDescriptionText: issuableDescriptionTextarea ? issuableDescriptionTextarea.textContent : '',
showForm: false,
};
},
methods: {
openForm() {
this.showForm = true;
console.log(this.showForm);
},
},
created() {
eventHub.$on('open.form', this.openForm);
},
beforeDestroy() {
eventHub.$off('open.form', this.openForm);
},
render(createElement) {
return createElement('issuable-app', {
props: {
......@@ -39,4 +60,5 @@ document.addEventListener('DOMContentLoaded', () => new Vue({
},
});
},
}));
});
});
......@@ -35,7 +35,7 @@
%li
= link_to 'Close issue', issue_path(@issue, issue: { state_event: :close }, format: 'json'), data: {no_turbolink: true}, class: "btn-close #{issue_button_visibility(@issue, true)}", title: 'Close issue'
%li
= link_to 'Edit', edit_namespace_project_issue_path(@project.namespace, @project, @issue)
= link_to 'Edit', edit_namespace_project_issue_path(@project.namespace, @project, @issue), class: 'issuable-edit'
- if @issue.submittable_as_spam_by?(current_user)
%li
= link_to 'Submit as spam', mark_as_spam_namespace_project_issue_path(@project.namespace, @project, @issue), method: :post, class: 'btn-spam', title: 'Submit as spam'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment