diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-08-01 20:23:42 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-08-01 20:23:59 +0300 |
commit | 7a98970bd84b8f42bc117040cc284a73cbf03a8a (patch) | |
tree | 3cdd930d6f8c246a97534ab2702a535a8cc58ab6 /app | |
parent | 335d4a535f737f19ef4959ec4027681d97d1002b (diff) |
[ci skip] Removes Vue from awards handler code
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/awards_handler.js | 9 | ||||
-rw-r--r-- | app/assets/javascripts/dispatcher.js | 1 | ||||
-rw-r--r-- | app/assets/javascripts/notes/components/issue_notes_app.vue | 4 | ||||
-rw-r--r-- | app/views/projects/issues/_discussion.html.haml | 2 |
4 files changed, 10 insertions, 6 deletions
diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js index 394e2fae567..ae0a742340d 100644 --- a/app/assets/javascripts/awards_handler.js +++ b/app/assets/javascripts/awards_handler.js @@ -2,7 +2,6 @@ /* global Flash */ import Cookies from 'js-cookie'; -import issueNotesEventHub from './notes/event_hub'; const animationEndEventString = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd'; const transitionEndEventString = 'transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'; @@ -242,8 +241,14 @@ class AwardsHandler { $('.emoji-menu').removeClass('is-visible'); $('.js-add-award.is-active').removeClass('is-active'); + const toggleAwardEvent = new CustomEvent('toggleAward', { + detail: { + awardName: emoji, + noteId: id, + }, + }); - return issueNotesEventHub.$emit('toggleAward', { awardName: emoji, noteId: id }); + document.querySelector('.js-vue-notes-event').dispatchEvent(toggleAwardEvent); } const normalizedEmoji = this.emoji.normalizeEmojiName(emoji); diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js index a2664c0301e..3a328a62558 100644 --- a/app/assets/javascripts/dispatcher.js +++ b/app/assets/javascripts/dispatcher.js @@ -170,7 +170,6 @@ import GpgBadges from './gpg_badges'; shortcut_handler = new ShortcutsIssuable(); new ZenMode(); initIssuableSidebar(); - initNotes(); break; case 'dashboard:milestones:index': new ProjectSelect(); diff --git a/app/assets/javascripts/notes/components/issue_notes_app.vue b/app/assets/javascripts/notes/components/issue_notes_app.vue index 22653e561c3..d84976ad173 100644 --- a/app/assets/javascripts/notes/components/issue_notes_app.vue +++ b/app/assets/javascripts/notes/components/issue_notes_app.vue @@ -110,8 +110,8 @@ }, 15000); }, bindEventHubListeners() { - eventHub.$on('toggleAward', (data) => { - const { awardName, noteId } = data; + this.$el.parentElement.addEventListener('toggleAward', (event) => { + const { awardName, noteId } = event.detail; const endpoint = this.notesById[noteId].toggle_award_path; this.actionToggleAward({ endpoint, awardName, noteId }) diff --git a/app/views/projects/issues/_discussion.html.haml b/app/views/projects/issues/_discussion.html.haml index d31ec19b97d..12ac93addd7 100644 --- a/app/views/projects/issues/_discussion.html.haml +++ b/app/views/projects/issues/_discussion.html.haml @@ -3,7 +3,7 @@ = link_to 'Reopen issue', issue_path(@issue, issue: {state_event: :reopen}, format: 'json'), data: {original_text: "Reopen issue", alternative_text: "Comment & reopen issue"}, class: "btn btn-nr btn-reopen btn-comment js-note-target-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen issue' = link_to 'Close issue', issue_path(@issue, issue: {state_event: :close}, format: 'json'), data: {original_text: "Close issue", alternative_text: "Comment & close issue"}, class: "btn btn-nr btn-close btn-comment js-note-target-close #{issue_button_visibility(@issue, true)}", title: 'Close issue' -%section +%section.js-vue-notes-event #js-vue-notes{ data: { discussions_path: discussions_namespace_project_issue_path(@project.namespace, @project, @issue, format: :json), register_path: "#{new_session_path(:user, redirect_to_referer: 'yes')}#register-pane", new_session_path: new_session_path(:user, redirect_to_referer: 'yes'), |