2018-02-27 19:10:43 -05:00
|
|
|
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';
|
|
|
|
|
2018-03-02 16:16:11 -05:00
|
|
|
export default function initMrNotes() {
|
2018-03-16 16:16:21 -04:00
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
2018-02-27 19:10:43 -05:00
|
|
|
el: '#js-vue-mr-discussions',
|
|
|
|
components: {
|
|
|
|
notesApp,
|
|
|
|
},
|
|
|
|
data() {
|
2018-03-16 16:16:21 -04:00
|
|
|
const notesDataset = document.getElementById('js-vue-mr-discussions')
|
|
|
|
.dataset;
|
2018-04-05 04:25:34 -04:00
|
|
|
const noteableData = JSON.parse(notesDataset.noteableData);
|
|
|
|
noteableData.noteableType = notesDataset.noteableType;
|
|
|
|
|
2018-02-27 19:10:43 -05:00
|
|
|
return {
|
2018-04-05 04:25:34 -04:00
|
|
|
noteableData,
|
2018-02-27 19:10:43 -05:00
|
|
|
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,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
2018-02-27 19:10:43 -05:00
|
|
|
el: '#js-vue-discussion-counter',
|
|
|
|
components: {
|
|
|
|
discussionCounter,
|
|
|
|
},
|
|
|
|
store,
|
|
|
|
render(createElement) {
|
|
|
|
return createElement('discussion-counter');
|
|
|
|
},
|
|
|
|
});
|
2018-03-02 16:16:11 -05:00
|
|
|
}
|