2020-04-08 14:13:33 +05:30
|
|
|
<script>
|
2020-10-24 23:57:45 +05:30
|
|
|
import { GlFormInput, GlButton } from '@gitlab/ui';
|
2020-04-08 14:13:33 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
GlFormInput,
|
2020-10-24 23:57:45 +05:30
|
|
|
GlButton,
|
2020-04-08 14:13:33 +05:30
|
|
|
},
|
2020-05-24 23:13:21 +05:30
|
|
|
inheritAttrs: false,
|
2020-04-08 14:13:33 +05:30
|
|
|
props: {
|
|
|
|
value: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
2020-10-24 23:57:45 +05:30
|
|
|
canDelete: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
showDelete: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
2020-04-08 14:13:33 +05:30
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
name: this.value,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<div class="js-file-title file-title-flex-parent">
|
2020-10-24 23:57:45 +05:30
|
|
|
<div class="gl-display-flex gl-align-items-center gl-w-full">
|
|
|
|
<gl-form-input
|
|
|
|
v-model="name"
|
|
|
|
:placeholder="
|
|
|
|
s__('Snippets|Give your file a name to add code highlighting, e.g. example.rb for Ruby')
|
|
|
|
"
|
|
|
|
name="snippet_file_name"
|
|
|
|
class="form-control js-snippet-file-name"
|
|
|
|
type="text"
|
|
|
|
v-bind="$attrs"
|
|
|
|
@change="$emit('input', name)"
|
|
|
|
/>
|
|
|
|
<gl-button
|
|
|
|
v-if="showDelete"
|
|
|
|
class="gl-ml-4"
|
|
|
|
variant="danger"
|
|
|
|
category="secondary"
|
|
|
|
:disabled="!canDelete"
|
|
|
|
@click="$emit('delete')"
|
|
|
|
>{{ s__('Snippets|Delete file') }}</gl-button
|
|
|
|
>
|
|
|
|
</div>
|
2020-04-08 14:13:33 +05:30
|
|
|
</div>
|
|
|
|
</template>
|