2017-06-08 18:50:11 -04:00
|
|
|
import Vue from 'vue';
|
2017-07-27 16:24:05 -04:00
|
|
|
import issueNotesApp from './components/issue_notes_app.vue';
|
2017-06-08 18:50:11 -04:00
|
|
|
|
2017-08-10 07:49:08 -04:00
|
|
|
document.addEventListener('DOMContentLoaded', () => new Vue({
|
|
|
|
el: '#js-vue-notes',
|
|
|
|
components: {
|
|
|
|
issueNotesApp,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
const notesDataset = document.getElementById('js-vue-notes').dataset;
|
2017-12-04 21:18:45 -05:00
|
|
|
const parsedUserData = JSON.parse(notesDataset.currentUserData);
|
|
|
|
const currentUserData = parsedUserData ? {
|
|
|
|
id: parsedUserData.id,
|
|
|
|
name: parsedUserData.name,
|
|
|
|
username: parsedUserData.username,
|
|
|
|
avatar_url: parsedUserData.avatar_path || parsedUserData.avatar_url,
|
|
|
|
path: parsedUserData.path,
|
|
|
|
} : {};
|
2017-07-27 16:24:05 -04:00
|
|
|
|
2017-08-10 07:49:08 -04:00
|
|
|
return {
|
2017-11-30 17:44:41 -05:00
|
|
|
noteableData: JSON.parse(notesDataset.noteableData),
|
2017-12-04 21:18:45 -05:00
|
|
|
currentUserData,
|
2017-08-10 07:49:08 -04:00
|
|
|
notesData: {
|
|
|
|
lastFetchedAt: notesDataset.lastFetchedAt,
|
|
|
|
discussionsPath: notesDataset.discussionsPath,
|
|
|
|
newSessionPath: notesDataset.newSessionPath,
|
|
|
|
registerPath: notesDataset.registerPath,
|
|
|
|
notesPath: notesDataset.notesPath,
|
2017-08-17 13:25:56 -04:00
|
|
|
markdownDocsPath: notesDataset.markdownDocsPath,
|
|
|
|
quickActionsDocsPath: notesDataset.quickActionsDocsPath,
|
2017-08-10 07:49:08 -04:00
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement('issue-notes-app', {
|
|
|
|
props: {
|
2017-11-30 17:44:41 -05:00
|
|
|
noteableData: this.noteableData,
|
2017-08-10 07:49:08 -04:00
|
|
|
notesData: this.notesData,
|
|
|
|
userData: this.currentUserData,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
}));
|