diff options
author | Clement Ho <ClemMakesApps@gmail.com> | 2018-02-15 16:50:20 -0600 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2018-02-15 16:50:20 -0600 |
commit | 1c2d283d506f2ceb4777622837fffe381e34cb9d (patch) | |
tree | 2a41129f3f749113c4ba780e484227e23c01d148 /app/assets/javascripts | |
parent | efdde042a3299668957d16200a407b9daae52301 (diff) | |
download | gitlab-ce-1c2d283d506f2ceb4777622837fffe381e34cb9d.tar.gz |
Add dispatcher imports for bundles used in merge request show path
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/diff_notes/diff_notes_bundle.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/how_to_merge.js | 25 | ||||
-rw-r--r-- | app/assets/javascripts/pages/projects/merge_requests/show/index.js | 8 |
3 files changed, 21 insertions, 16 deletions
diff --git a/app/assets/javascripts/diff_notes/diff_notes_bundle.js b/app/assets/javascripts/diff_notes/diff_notes_bundle.js index e0422057090..38c42a11b4e 100644 --- a/app/assets/javascripts/diff_notes/diff_notes_bundle.js +++ b/app/assets/javascripts/diff_notes/diff_notes_bundle.js @@ -15,7 +15,7 @@ import './components/resolve_discussion_btn'; import './components/diff_note_avatars'; import './components/new_issue_for_discussion'; -$(() => { +export default () => { const projectPathHolder = document.querySelector('.merge-request') || document.querySelector('.commit-box'); const projectPath = projectPathHolder.dataset.projectPath; const COMPONENT_SELECTOR = 'resolve-btn, resolve-discussion-btn, jump-to-discussion, comment-and-resolve-btn, new-issue-for-discussion-btn'; @@ -75,4 +75,4 @@ $(() => { }); $(window).trigger('resize.nav'); -}); +}; diff --git a/app/assets/javascripts/how_to_merge.js b/app/assets/javascripts/how_to_merge.js index 19f4a946f73..12e6f24595a 100644 --- a/app/assets/javascripts/how_to_merge.js +++ b/app/assets/javascripts/how_to_merge.js @@ -1,12 +1,13 @@ -document.addEventListener('DOMContentLoaded', () => { - const modal = $('#modal_merge_info').modal({ - modal: true, - show: false, - }); - $('.how_to_merge_link').on('click', () => { - modal.show(); - }); - $('.modal-header .close').on('click', () => { - modal.hide(); - }); -}); +export default () => { + const modal = $('#modal_merge_info'); + + if (modal) { + modal.modal({ + modal: true, + show: false, + }); + + $('.how_to_merge_link').on('click', modal.show); + $('.modal-header .close').on('click', modal.hide); + } +}; diff --git a/app/assets/javascripts/pages/projects/merge_requests/show/index.js b/app/assets/javascripts/pages/projects/merge_requests/show/index.js index c3463c266e3..8552e49a9cf 100644 --- a/app/assets/javascripts/pages/projects/merge_requests/show/index.js +++ b/app/assets/javascripts/pages/projects/merge_requests/show/index.js @@ -2,16 +2,19 @@ import MergeRequest from '~/merge_request'; import ZenMode from '~/zen_mode'; import initNotes from '~/init_notes'; import initIssuableSidebar from '~/init_issuable_sidebar'; +import initDiffNotes from '~/diff_notes/diff_notes_bundle'; import ShortcutsIssuable from '~/shortcuts_issuable'; import Diff from '~/diff'; import { handleLocationHash } from '~/lib/utils/common_utils'; +import howToMerge from '~/how_to_merge'; export default () => { new Diff(); // eslint-disable-line no-new new ZenMode(); // eslint-disable-line no-new - initIssuableSidebar(); // eslint-disable-line no-new - initNotes(); // eslint-disable-line no-new + initIssuableSidebar(); + initNotes(); + initDiffNotes(); const mrShowNode = document.querySelector('.merge-request'); @@ -21,4 +24,5 @@ export default () => { new ShortcutsIssuable(true); // eslint-disable-line no-new handleLocationHash(); + howToMerge(); }; |