summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/projects/commit/init_commit_comments_button.js
blob: d70f7cb65f303383a430a4a36a5de2ec02dd295b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import Vue from 'vue';
import CommitCommentsButton from './components/commit_comments_button.vue';

export default function initCommitCommentsButton() {
  const el = document.querySelector('#js-commit-comments-button');

  if (!el) {
    return false;
  }

  const { commentsCount } = el.dataset;

  return new Vue({
    el,
    render: (createElement) =>
      createElement(CommitCommentsButton, { props: { commentsCount: Number(commentsCount) } }),
  });
}