summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/projects/new/components/new_project_push_tip_popover.vue
blob: e42d91548660659461cae630c2e365dfa118b51b (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
66
<script>
import { GlPopover, GlFormInputGroup } from '@gitlab/ui';
import { __ } from '~/locale';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';

export default {
  components: {
    GlPopover,
    GlFormInputGroup,
    ClipboardButton,
  },
  inject: ['pushToCreateProjectCommand', 'workingWithProjectsHelpPath'],
  props: {
    target: {
      type: [Function, HTMLElement],
      required: true,
    },
  },
  i18n: {
    clipboardButtonTitle: __('Copy command'),
    commandInputAriaLabel: __('Push project from command line'),
    helpLinkText: __('What does this command do?'),
    labelText: __('Private projects can be created in your personal namespace with:'),
    popoverTitle: __('Push to create a project'),
  },
};
</script>
<template>
  <gl-popover
    :target="target"
    :title="$options.i18n.popoverTitle"
    triggers="click blur"
    placement="top"
  >
    <p>
      <label for="push-to-create-tip" class="gl-font-weight-normal">
        {{ $options.i18n.labelText }}
      </label>
    </p>
    <p>
      <gl-form-input-group
        id="push-to-create-tip"
        :value="pushToCreateProjectCommand"
        readonly
        select-on-click
        :aria-label="$options.i18n.commandInputAriaLabel"
      >
        <template #append>
          <clipboard-button
            :text="pushToCreateProjectCommand"
            :title="$options.i18n.clipboardButtonTitle"
            tooltip-placement="right"
          />
        </template>
      </gl-form-input-group>
    </p>
    <p>
      <a
        :href="`${workingWithProjectsHelpPath}#push-to-create-a-new-project`"
        class="gl-font-sm"
        target="_blank"
        >{{ $options.i18n.helpLinkText }}</a
      >
    </p>
  </gl-popover>
</template>