diff options
author | Fatih Acet <acetfatih@gmail.com> | 2018-02-28 00:10:43 +0000 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2018-02-28 00:10:43 +0000 |
commit | 059ab73b8eae3a546d0a19fe99ef0c52df5fac01 (patch) | |
tree | b24d4162072c0099147fcdb4f19f95511689ff6e /app/assets/javascripts/mr_notes | |
parent | 0be4a77d0012613f960c4177f53101c46de2899c (diff) | |
download | gitlab-ce-059ab73b8eae3a546d0a19fe99ef0c52df5fac01.tar.gz |
Render MR Notes with Vue with behind a cookie
Diffstat (limited to 'app/assets/javascripts/mr_notes')
-rw-r--r-- | app/assets/javascripts/mr_notes/index.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/app/assets/javascripts/mr_notes/index.js b/app/assets/javascripts/mr_notes/index.js new file mode 100644 index 00000000000..f4cba998fa7 --- /dev/null +++ b/app/assets/javascripts/mr_notes/index.js @@ -0,0 +1,41 @@ +import Vue from 'vue'; +import notesApp from '../notes/components/notes_app.vue'; +import discussionCounter from '../notes/components/discussion_counter.vue'; +import store from '../notes/stores'; + +document.addEventListener('DOMContentLoaded', () => { + new Vue({ // eslint-disable-line + el: '#js-vue-mr-discussions', + components: { + notesApp, + }, + data() { + const notesDataset = document.getElementById('js-vue-mr-discussions').dataset; + return { + noteableData: JSON.parse(notesDataset.noteableData), + currentUserData: JSON.parse(notesDataset.currentUserData), + notesData: JSON.parse(notesDataset.notesData), + }; + }, + render(createElement) { + return createElement('notes-app', { + props: { + noteableData: this.noteableData, + notesData: this.notesData, + userData: this.currentUserData, + }, + }); + }, + }); + + new Vue({ // eslint-disable-line + el: '#js-vue-discussion-counter', + components: { + discussionCounter, + }, + store, + render(createElement) { + return createElement('discussion-counter'); + }, + }); +}); |