summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pages/projects/forks/new/index.js
blob: 372967c8a1e48b47e7e7f4f7d4004b20e52a455c (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import Vue from 'vue';
import App from './components/app.vue';
import ForkGroupsList from './components/fork_groups_list.vue';

const mountElement = document.getElementById('fork-groups-mount-element');

if (gon.features.forkProjectForm) {
  const {
    forkIllustration,
    endpoint,
    newGroupPath,
    projectFullPath,
    visibilityHelpPath,
    projectId,
    projectName,
    projectPath,
    projectDescription,
    projectVisibility,
  } = mountElement.dataset;

  // eslint-disable-next-line no-new
  new Vue({
    el: mountElement,
    provide: {
      newGroupPath,
      visibilityHelpPath,
    },
    render(h) {
      return h(App, {
        props: {
          forkIllustration,
          endpoint,
          newGroupPath,
          projectFullPath,
          visibilityHelpPath,
          projectId,
          projectName,
          projectPath,
          projectDescription,
          projectVisibility,
        },
      });
    },
  });
} else {
  const { endpoint } = mountElement.dataset;

  // eslint-disable-next-line no-new
  new Vue({
    el: mountElement,
    render(h) {
      return h(ForkGroupsList, {
        props: {
          endpoint,
        },
      });
    },
  });
}