debian-mirror-gitlab/app/assets/javascripts/repository/components/blob_edit.vue

66 lines
1.3 KiB
Vue
Raw Normal View History

2021-06-08 01:23:25 +05:30
<script>
import { GlButton } from '@gitlab/ui';
import { __ } from '~/locale';
2021-09-04 01:27:46 +05:30
import WebIdeLink from '~/vue_shared/components/web_ide_link.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
2021-06-08 01:23:25 +05:30
export default {
i18n: {
edit: __('Edit'),
2021-09-04 01:27:46 +05:30
webIde: __('Web IDE'),
2021-06-08 01:23:25 +05:30
},
components: {
GlButton,
2021-09-04 01:27:46 +05:30
WebIdeLink,
2021-06-08 01:23:25 +05:30
},
2021-09-04 01:27:46 +05:30
mixins: [glFeatureFlagsMixin()],
2021-06-08 01:23:25 +05:30
props: {
2021-10-27 15:23:28 +05:30
showEditButton: {
type: Boolean,
required: true,
},
2021-06-08 01:23:25 +05:30
editPath: {
type: String,
required: true,
},
2021-09-04 01:27:46 +05:30
webIdePath: {
type: String,
required: true,
},
2021-06-08 01:23:25 +05:30
},
};
</script>
<template>
2021-09-04 01:27:46 +05:30
<web-ide-link
v-if="glFeatures.consolidatedEditButton"
2021-10-27 15:23:28 +05:30
:show-edit-button="showEditButton"
2021-09-04 01:27:46 +05:30
class="gl-mr-3"
:edit-url="editPath"
:web-ide-url="webIdePath"
:is-blob="true"
/>
<div v-else>
2021-10-27 15:23:28 +05:30
<gl-button
v-if="showEditButton"
class="gl-mr-2"
category="primary"
variant="confirm"
:href="editPath"
data-testid="edit"
>
2021-09-04 01:27:46 +05:30
{{ $options.i18n.edit }}
</gl-button>
2021-10-27 15:23:28 +05:30
<gl-button
class="gl-mr-3"
category="primary"
variant="confirm"
:href="webIdePath"
data-testid="web-ide"
>
2021-09-04 01:27:46 +05:30
{{ $options.i18n.webIde }}
</gl-button>
</div>
2021-06-08 01:23:25 +05:30
</template>