Dont show file template options for new directory
This commit is contained in:
parent
a1215556ec
commit
b82b1667c4
|
@ -51,8 +51,11 @@ export default {
|
|||
|
||||
return __('Create file');
|
||||
},
|
||||
isCreatingNew() {
|
||||
return this.entryModal.type !== modalTypes.rename;
|
||||
isCreatingNewFile() {
|
||||
return this.entryModal.type === 'blob';
|
||||
},
|
||||
placeholder() {
|
||||
return this.isCreatingNewFile ? 'dir/file_name' : 'dir/';
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
@ -107,9 +110,12 @@ export default {
|
|||
v-model="entryName"
|
||||
type="text"
|
||||
class="form-control qa-full-file-path"
|
||||
placeholder="/dir/file_name"
|
||||
:placeholder="placeholder"
|
||||
/>
|
||||
<ul v-if="isCreatingNew" class="prepend-top-default list-inline qa-template-list">
|
||||
<ul
|
||||
v-if="isCreatingNewFile"
|
||||
class="file-templates prepend-top-default list-inline qa-template-list"
|
||||
>
|
||||
<li v-for="(template, index) in templateTypes" :key="index" class="list-inline-item">
|
||||
<button
|
||||
type="button"
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Do not show file templates when creating a new directory in WebIDE
|
||||
merge_request: !25119
|
||||
author:
|
||||
type: fixed
|
|
@ -41,6 +41,15 @@ describe('new file modal component', () => {
|
|||
expect(vm.$el.querySelector('.label-bold').textContent.trim()).toBe('Name');
|
||||
});
|
||||
|
||||
it(`${type === 'tree' ? 'does not show' : 'shows'} file templates`, () => {
|
||||
const templateFilesEl = vm.$el.querySelector('.file-templates');
|
||||
if (type === 'tree') {
|
||||
expect(templateFilesEl).toBeNull();
|
||||
} else {
|
||||
expect(templateFilesEl instanceof Element).toBeTruthy();
|
||||
}
|
||||
});
|
||||
|
||||
describe('createEntryInStore', () => {
|
||||
it('$emits create', () => {
|
||||
spyOn(vm, 'createTempEntry');
|
||||
|
|
Loading…
Reference in New Issue