summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/components/commit_sidebar/actions.vue
blob: 2cbd982af191f3c430f4130d06ef33e5e94aaadc (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
60
61
62
63
64
65
<script>
  import { mapState } from 'vuex';
  import { sprintf, __ } from '~/locale';
  import * as consts from '../../stores/modules/commit/constants';
  import RadioGroup from './radio_group.vue';

  export default {
    components: {
      RadioGroup,
    },
    computed: {
      ...mapState([
        'currentBranchId',
      ]),
      newMergeRequestHelpText() {
        return sprintf(
          __('Creates a new branch from %{branchName} and re-directs to create a new merge request'),
          { branchName: this.currentBranchId },
        );
      },
      commitToCurrentBranchText() {
        return sprintf(
          __('Commit to %{branchName} branch'),
          { branchName: `<strong>${this.currentBranchId}</strong>` },
          false,
        );
      },
      commitToNewBranchText() {
        return sprintf(
          __('Creates a new branch from %{branchName}'),
          { branchName: this.currentBranchId },
        );
      },
    },
    commitToCurrentBranch: consts.COMMIT_TO_CURRENT_BRANCH,
    commitToNewBranch: consts.COMMIT_TO_NEW_BRANCH,
    commitToNewBranchMR: consts.COMMIT_TO_NEW_BRANCH_MR,
  };
</script>

<template>
  <div class="append-bottom-15 ide-commit-radios">
    <radio-group
      :value="$options.commitToCurrentBranch"
      :checked="true"
    >
      <span
        v-html="commitToCurrentBranchText"
      >
      </span>
    </radio-group>
    <radio-group
      :value="$options.commitToNewBranch"
      :label="__('Create a new branch')"
      :show-input="true"
      :help-text="commitToNewBranchText"
    />
    <radio-group
      :value="$options.commitToNewBranchMR"
      :label="__('Create a new branch and merge request')"
      :show-input="true"
      :help-text="newMergeRequestHelpText"
    />
  </div>
</template>