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

79 lines
1.5 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-11-18 22:05:49 +05:30
needsToFork: {
type: Boolean,
required: false,
default: false,
},
},
methods: {
onEdit(target) {
this.$emit('edit', target);
},
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"
2021-11-18 22:05:49 +05:30
:needs-to-fork="needsToFork"
2021-09-04 01:27:46 +05:30
:is-blob="true"
2022-03-02 08:16:31 +05:30
disable-fork-modal
2021-11-18 22:05:49 +05:30
@edit="onEdit"
2021-09-04 01:27:46 +05:30
/>
<div v-else>
2021-10-27 15:23:28 +05:30
<gl-button
v-if="showEditButton"
class="gl-mr-2"
category="primary"
variant="confirm"
data-testid="edit"
2021-11-18 22:05:49 +05:30
@click="onEdit('simple')"
2021-10-27 15:23:28 +05:30
>
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"
data-testid="web-ide"
2021-11-18 22:05:49 +05:30
@click="onEdit('ide')"
2021-10-27 15:23:28 +05:30
>
2021-09-04 01:27:46 +05:30
{{ $options.i18n.webIde }}
</gl-button>
</div>
2021-06-08 01:23:25 +05:30
</template>