Commit d6e724d9 authored by Phil Hughes's avatar Phil Hughes

Moved method to compile components from window into diffnotesapp

parent f65d8eb3
...@@ -13,6 +13,16 @@ $(() => { ...@@ -13,6 +13,16 @@ $(() => {
'resolve-btn': ResolveBtn, 'resolve-btn': ResolveBtn,
'resolve-discussion-btn': ResolveDiscussionBtn, 'resolve-discussion-btn': ResolveDiscussionBtn,
'comment-and-resolve-btn': CommentAndResolveBtn '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 @@ $(() => { ...@@ -22,13 +32,4 @@ $(() => {
'resolve-count': ResolveCount '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));
});
}
}
}); });
...@@ -120,8 +120,8 @@ ...@@ -120,8 +120,8 @@
return function(data) { return function(data) {
$('#diffs').html(data.html); $('#diffs').html(data.html);
if (compileVueComponentsForDiffNotes) { if (DiffNotesApp) {
compileVueComponentsForDiffNotes(); DiffNotesApp.compileComponents();
} }
gl.utils.localTimeAgo($('.js-timeago', 'div#diffs')); gl.utils.localTimeAgo($('.js-timeago', 'div#diffs'));
......
...@@ -300,8 +300,8 @@ ...@@ -300,8 +300,8 @@
discussionContainer.append(note_html); discussionContainer.append(note_html);
} }
if (compileVueComponentsForDiffNotes) { if (DiffNotesApp) {
compileVueComponentsForDiffNotes(); DiffNotesApp.compileComponents();
} }
gl.utils.localTimeAgo($('.js-timeago', note_html), false); gl.utils.localTimeAgo($('.js-timeago', note_html), false);
...@@ -429,8 +429,8 @@ ...@@ -429,8 +429,8 @@
$note_li.replaceWith($html); $note_li.replaceWith($html);
if (compileVueComponentsForDiffNotes) { if (DiffNotesApp) {
compileVueComponentsForDiffNotes(); DiffNotesApp.compileComponents();
} }
}; };
......
...@@ -36,11 +36,15 @@ ...@@ -36,11 +36,15 @@
if (!this.isOpen && !this.hasError) { if (!this.isOpen && !this.hasError) {
this.content.hide(); this.content.hide();
this.collapsedContent.show(); this.collapsedContent.show();
compileVueComponentsForDiffNotes(); if (DiffNotesApp) {
DiffNotesApp.compileComponents();
}
} else if (this.content) { } else if (this.content) {
this.collapsedContent.hide(); this.collapsedContent.hide();
this.content.show(); this.content.show();
compileVueComponentsForDiffNotes(); if (DiffNotesApp) {
DiffNotesApp.compileComponents();
}
} else { } else {
return this.getContentHTML(); return this.getContentHTML();
} }
...@@ -55,7 +59,9 @@ ...@@ -55,7 +59,9 @@
if (data.html) { if (data.html) {
_this.content = $(data.html); _this.content = $(data.html);
_this.content.syntaxHighlight(); _this.content.syntaxHighlight();
compileVueComponentsForDiffNotes(); if (DiffNotesApp) {
DiffNotesApp.compileComponents();
}
} else { } else {
_this.hasError = true; _this.hasError = true;
_this.content = $(ERROR_HTML); _this.content = $(ERROR_HTML);
......
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