diff options
author | winniehell <git@winniehell.de> | 2017-03-05 20:43:05 +0100 |
---|---|---|
committer | winniehell <git@winniehell.de> | 2017-03-05 21:22:40 +0100 |
commit | 572f9782d5e8d6307784b61db0dfce48f5118445 (patch) | |
tree | 11b25c46733462729e4303b26b4895d983f14df0 /app/assets/javascripts/diff_notes/diff_notes_bundle.js | |
parent | 4cd2ab52548e89cd7259cfb7ce320fdfa203fe84 (diff) | |
download | gitlab-ce-572f9782d5e8d6307784b61db0dfce48f5118445.tar.gz |
Remove .es6 from file extensions (!9241)
Diffstat (limited to 'app/assets/javascripts/diff_notes/diff_notes_bundle.js')
-rw-r--r-- | app/assets/javascripts/diff_notes/diff_notes_bundle.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/app/assets/javascripts/diff_notes/diff_notes_bundle.js b/app/assets/javascripts/diff_notes/diff_notes_bundle.js new file mode 100644 index 00000000000..cadf8b96b87 --- /dev/null +++ b/app/assets/javascripts/diff_notes/diff_notes_bundle.js @@ -0,0 +1,57 @@ +/* eslint-disable func-names, comma-dangle, new-cap, no-new, max-len */ +/* global Vue */ +/* global ResolveCount */ + +const Vue = require('vue'); +require('./models/discussion'); +require('./models/note'); +require('./stores/comments'); +require('./services/resolve'); +require('./mixins/discussion'); +require('./components/comment_resolve_btn'); +require('./components/jump_to_discussion'); +require('./components/resolve_btn'); +require('./components/resolve_count'); +require('./components/resolve_discussion_btn'); + +$(() => { + const projectPath = document.querySelector('.merge-request').dataset.projectPath; + const COMPONENT_SELECTOR = 'resolve-btn, resolve-discussion-btn, jump-to-discussion, comment-and-resolve-btn'; + + window.gl = window.gl || {}; + window.gl.diffNoteApps = {}; + + window.ResolveService = new gl.DiffNotesResolveServiceClass(projectPath); + + gl.diffNotesCompileComponents = () => { + const $components = $(COMPONENT_SELECTOR).filter(function () { + return $(this).closest('resolve-count').length !== 1; + }); + + 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; + } + + $this.replaceWith(tmpApp.$el); + }); + } + }; + + gl.diffNotesCompileComponents(); + + new Vue({ + el: '#resolve-count-app', + components: { + 'resolve-count': ResolveCount + } + }); +}); |