summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/branches/init_delete_branch_button.js
blob: 43df5d993a4c3abbd9688318c66811b38ca7347a (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
import Vue from 'vue';
import DeleteBranchButton from '~/branches/components/delete_branch_button.vue';
import { parseBoolean } from '~/lib/utils/common_utils';

export default function initDeleteBranchButton(el) {
  if (!el) {
    return false;
  }

  const {
    branchName,
    defaultBranchName,
    deletePath,
    tooltip,
    disabled,
    isProtectedBranch,
    merged,
  } = el.dataset;

  return new Vue({
    el,
    render: (createElement) =>
      createElement(DeleteBranchButton, {
        props: {
          branchName,
          defaultBranchName,
          deletePath,
          tooltip,
          disabled: parseBoolean(disabled),
          isProtectedBranch: parseBoolean(isProtectedBranch),
          merged: parseBoolean(merged),
        },
      }),
  });
}