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 @@ $(() => {
'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));
});
}
}
});
......@@ -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'));
......
......@@ -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();
}
};
......
......@@ -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);
......
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