summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/notes/index.js
blob: 0bf52b551f42488aefeb1a2c8baa8e7087c269b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import Vue from 'vue';
import issueNotesApp from './components/issue_notes_app.vue';

document.addEventListener('DOMContentLoaded', () => new Vue({
  el: '#js-vue-notes',
  components: {
    issueNotesApp,
  },
  data() {
    const notesDataset = document.getElementById('js-vue-notes').dataset;

    return {
      issueData: JSON.parse(notesDataset.issueData),
      currentUserData: JSON.parse(notesDataset.currentUserData),
      notesData: {
        lastFetchedAt: notesDataset.lastFetchedAt,
        discussionsPath: notesDataset.discussionsPath,
      },
    };
  },
  render(createElement) {
    return createElement('issue-notes-app', {
      attrs: {
        ref: 'notes',
      },
      props: {
        issueData: this.issueData,
        notesData: this.notesData,
      },
    });
  },
}));

  // // TODO: FILIPA: FIX THIS
  // window.issueNotes = {
  //   refresh() {
  //     vm.$refs.notes.$store.dispatch('poll');
  //   },
  // };