diff options
author | Phil Hughes <me@iamphill.com> | 2016-08-01 10:21:57 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-08-01 10:21:57 +0100 |
commit | d6e724d90fd8a5fd93ef1f4963e22ccaf29b06de (patch) | |
tree | e29d50c12afb5036a356f2a541a028cf7b90df49 /app/assets | |
parent | f65d8eb3261f717340a8e8fd8a3fe65bd9fd2c20 (diff) | |
download | gitlab-ce-d6e724d90fd8a5fd93ef1f4963e22ccaf29b06de.tar.gz |
Moved method to compile components from window into diffnotesapp
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6 | 19 | ||||
-rw-r--r-- | app/assets/javascripts/merge_request_tabs.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/notes.js | 8 | ||||
-rw-r--r-- | app/assets/javascripts/single_file_diff.js | 12 |
4 files changed, 25 insertions, 18 deletions
diff --git a/app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6 b/app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6 index b0cce29fa04..22d9cf6c857 100644 --- a/app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6 +++ b/app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6 @@ -13,6 +13,16 @@ $(() => { 'resolve-btn': ResolveBtn, 'resolve-discussion-btn': ResolveDiscussionBtn, 'comment-and-resolve-btn': CommentAndResolveBtn + }, + methods: { + compileComponents: function () { + const $components = $('resolve-btn, resolve-discussion-btn, jump-to-discussion'); + if ($components.length) { + $components.each(function () { + DiffNotesApp.$compile($(this).get(0)); + }); + } + } } }); @@ -22,13 +32,4 @@ $(() => { 'resolve-count': ResolveCount } }); - - window.compileVueComponentsForDiffNotes = function () { - const $components = $('resolve-btn, resolve-discussion-btn, jump-to-discussion'); - if ($components.length) { - $components.each(function () { - DiffNotesApp.$compile($(this).get(0)); - }); - } - } }); diff --git a/app/assets/javascripts/merge_request_tabs.js b/app/assets/javascripts/merge_request_tabs.js index 8574a4e3370..ff1416af31b 100644 --- a/app/assets/javascripts/merge_request_tabs.js +++ b/app/assets/javascripts/merge_request_tabs.js @@ -120,8 +120,8 @@ return function(data) { $('#diffs').html(data.html); - if (compileVueComponentsForDiffNotes) { - compileVueComponentsForDiffNotes(); + if (DiffNotesApp) { + DiffNotesApp.compileComponents(); } gl.utils.localTimeAgo($('.js-timeago', 'div#diffs')); diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 3c93d86994d..ab169d04804 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -300,8 +300,8 @@ discussionContainer.append(note_html); } - if (compileVueComponentsForDiffNotes) { - compileVueComponentsForDiffNotes(); + if (DiffNotesApp) { + DiffNotesApp.compileComponents(); } gl.utils.localTimeAgo($('.js-timeago', note_html), false); @@ -429,8 +429,8 @@ $note_li.replaceWith($html); - if (compileVueComponentsForDiffNotes) { - compileVueComponentsForDiffNotes(); + if (DiffNotesApp) { + DiffNotesApp.compileComponents(); } }; diff --git a/app/assets/javascripts/single_file_diff.js b/app/assets/javascripts/single_file_diff.js index 70e80b57f91..9d181586b1d 100644 --- a/app/assets/javascripts/single_file_diff.js +++ b/app/assets/javascripts/single_file_diff.js @@ -36,11 +36,15 @@ if (!this.isOpen && !this.hasError) { this.content.hide(); this.collapsedContent.show(); - compileVueComponentsForDiffNotes(); + if (DiffNotesApp) { + DiffNotesApp.compileComponents(); + } } else if (this.content) { this.collapsedContent.hide(); this.content.show(); - compileVueComponentsForDiffNotes(); + if (DiffNotesApp) { + DiffNotesApp.compileComponents(); + } } else { return this.getContentHTML(); } @@ -55,7 +59,9 @@ if (data.html) { _this.content = $(data.html); _this.content.syntaxHighlight(); - compileVueComponentsForDiffNotes(); + if (DiffNotesApp) { + DiffNotesApp.compileComponents(); + } } else { _this.hasError = true; _this.content = $(ERROR_HTML); |