Commit 77f6f0b8 authored by Fatih Acet's avatar Fatih Acet

IssueNotesRefactor: Listen main issue action and update note form buttons.

parent 4e86445b
...@@ -66,12 +66,11 @@ class Issue { ...@@ -66,12 +66,11 @@ class Issue {
const projectIssuesCounter = $('.issue_counter'); const projectIssuesCounter = $('.issue_counter');
if ('id' in data) { if ('id' in data) {
$(document).trigger('issuable:change');
const isClosed = $button.hasClass('btn-close'); const isClosed = $button.hasClass('btn-close');
isClosedBadge.toggleClass('hidden', !isClosed); isClosedBadge.toggleClass('hidden', !isClosed);
isOpenBadge.toggleClass('hidden', isClosed); isOpenBadge.toggleClass('hidden', isClosed);
$(document).trigger('issuable:change', isClosed);
this.toggleCloseReopenButton(isClosed); this.toggleCloseReopenButton(isClosed);
let numProjectIssues = Number(projectIssuesCounter.text().replace(/[^\d]/, '')); let numProjectIssues = Number(projectIssuesCounter.text().replace(/[^\d]/, ''));
......
...@@ -122,6 +122,10 @@ export default { ...@@ -122,6 +122,10 @@ export default {
this.markdownDocsUrl = markdownDocs; this.markdownDocsUrl = markdownDocs;
this.markdownPreviewUrl = markdownPreviewUrl; this.markdownPreviewUrl = markdownPreviewUrl;
eventHub.$on('IssueStateChanged', (isClosed) => {
this.issueState = isClosed ? 'closed' : 'reopened';
});
}, },
}; };
</script> </script>
......
...@@ -88,6 +88,10 @@ export default { ...@@ -88,6 +88,10 @@ export default {
new Flash('Something went wrong on our end.'); // eslint-disable-line new Flash('Something went wrong on our end.'); // eslint-disable-line
}); });
}); });
$(document).on('issuable:change', (e, isClosed) => {
eventHub.$emit('IssueStateChanged', isClosed);
});
}, },
checkLocationHash() { checkLocationHash() {
const hash = gl.utils.getLocationHash(); const hash = gl.utils.getLocationHash();
......
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