2016-10-26 04:02:58 -04:00
|
|
|
/* eslint-disable */
|
2016-07-26 06:56:36 -04:00
|
|
|
//= require vue
|
|
|
|
//= require vue-resource
|
2016-07-29 06:19:56 -04:00
|
|
|
//= require_directory ./models
|
2016-07-26 06:56:36 -04:00
|
|
|
//= require_directory ./stores
|
|
|
|
//= require_directory ./services
|
2016-07-26 08:44:51 -04:00
|
|
|
//= require_directory ./mixins
|
2016-07-26 06:56:36 -04:00
|
|
|
//= require_directory ./components
|
|
|
|
|
|
|
|
$(() => {
|
2016-11-09 03:54:48 -05:00
|
|
|
const COMPONENT_SELECTOR = 'resolve-btn, resolve-discussion-btn, jump-to-discussion, comment-and-resolve-btn';
|
|
|
|
|
2016-11-08 11:54:18 -05:00
|
|
|
window.gl = window.gl || {};
|
|
|
|
window.gl.diffNoteApps = {};
|
2016-11-07 05:05:58 -05:00
|
|
|
|
2016-11-08 11:54:18 -05:00
|
|
|
gl.diffNotesCompileComponents = () => {
|
2016-11-09 03:54:48 -05:00
|
|
|
const $components = $(COMPONENT_SELECTOR).filter(function () {
|
|
|
|
return $(this).closest('resolve-count').length !== 1;
|
|
|
|
});
|
2016-11-08 11:54:18 -05:00
|
|
|
|
|
|
|
if ($components) {
|
|
|
|
$components.each(function () {
|
|
|
|
const $this = $(this);
|
|
|
|
const noteId = $this.attr(':note-id');
|
|
|
|
const tmp = Vue.extend({
|
|
|
|
template: $this.get(0).outerHTML
|
|
|
|
});
|
|
|
|
const tmpApp = new tmp().$mount();
|
|
|
|
|
|
|
|
if (noteId) {
|
|
|
|
gl.diffNoteApps[`note_${noteId}`] = tmpApp;
|
2016-08-01 05:21:57 -04:00
|
|
|
}
|
2016-11-08 11:54:18 -05:00
|
|
|
|
|
|
|
$this.replaceWith(tmpApp.$el);
|
|
|
|
});
|
2016-07-26 06:56:36 -04:00
|
|
|
}
|
2016-11-08 11:54:18 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
gl.diffNotesCompileComponents();
|
2016-07-26 06:56:36 -04:00
|
|
|
|
|
|
|
new Vue({
|
|
|
|
el: '#resolve-count-app',
|
|
|
|
components: {
|
|
|
|
'resolve-count': ResolveCount
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|