Commit b82b1667 authored by Sam Bigelow's avatar Sam Bigelow

Dont show file template options for new directory

parent a1215556
...@@ -51,8 +51,11 @@ export default { ...@@ -51,8 +51,11 @@ export default {
return __('Create file'); return __('Create file');
}, },
isCreatingNew() { isCreatingNewFile() {
return this.entryModal.type !== modalTypes.rename; return this.entryModal.type === 'blob';
},
placeholder() {
return this.isCreatingNewFile ? 'dir/file_name' : 'dir/';
}, },
}, },
methods: { methods: {
...@@ -107,9 +110,12 @@ export default { ...@@ -107,9 +110,12 @@ export default {
v-model="entryName" v-model="entryName"
type="text" type="text"
class="form-control qa-full-file-path" 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"> <li v-for="(template, index) in templateTypes" :key="index" class="list-inline-item">
<button <button
type="button" type="button"
......
---
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', () => { ...@@ -41,6 +41,15 @@ describe('new file modal component', () => {
expect(vm.$el.querySelector('.label-bold').textContent.trim()).toBe('Name'); 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', () => { describe('createEntryInStore', () => {
it('$emits create', () => { it('$emits create', () => {
spyOn(vm, 'createTempEntry'); spyOn(vm, 'createTempEntry');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment