summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/repository/components/blob_header_edit.vue
blob: 3d97ebe89e433c9084718e838d134a13d076d3e3 (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
<script>
import { GlButton } from '@gitlab/ui';
import { __ } from '~/locale';
import WebIdeLink from '~/vue_shared/components/web_ide_link.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';

export default {
  i18n: {
    edit: __('Edit'),
    webIde: __('Web IDE'),
  },
  components: {
    GlButton,
    WebIdeLink,
  },
  mixins: [glFeatureFlagsMixin()],
  props: {
    editPath: {
      type: String,
      required: true,
    },
    webIdePath: {
      type: String,
      required: true,
    },
  },
};
</script>

<template>
  <web-ide-link
    v-if="glFeatures.consolidatedEditButton"
    class="gl-mr-3"
    :edit-url="editPath"
    :web-ide-url="webIdePath"
    :is-blob="true"
  />
  <div v-else>
    <gl-button class="gl-mr-2" category="primary" variant="confirm" :href="editPath">
      {{ $options.i18n.edit }}
    </gl-button>

    <gl-button class="gl-mr-3" category="primary" variant="confirm" :href="webIdePath">
      {{ $options.i18n.webIde }}
    </gl-button>
  </div>
</template>