diff options
author | Phil Hughes <me@iamphill.com> | 2019-02-14 12:22:17 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-02-14 12:22:17 +0300 |
commit | 4b2ba1a70e72d3e53a696d7c8c0ca0cedf0f95a7 (patch) | |
tree | ff5f7b11955a89c1eef97f6deb6b90c88bdd1c1c | |
parent | c06ebe511700f25a61b4dfaa518fbed7667c6876 (diff) | |
parent | b82b1667c4de0ee05840c1053b2349ac351040e6 (diff) |
Merge branch '57544-web-ide-new-directory-dialog-shows-file-templates' into 'master'
Resolve "Web IDE new directory dialog shows file templates"
Closes #57544
See merge request gitlab-org/gitlab-ce!25119
3 files changed, 24 insertions, 4 deletions
diff --git a/app/assets/javascripts/ide/components/new_dropdown/modal.vue b/app/assets/javascripts/ide/components/new_dropdown/modal.vue index 04ecd4ba4e7..c9c4e9e86f8 100644 --- a/app/assets/javascripts/ide/components/new_dropdown/modal.vue +++ b/app/assets/javascripts/ide/components/new_dropdown/modal.vue @@ -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" diff --git a/changelogs/unreleased/57544-web-ide-new-directory-dialog-shows-file-templates.yml b/changelogs/unreleased/57544-web-ide-new-directory-dialog-shows-file-templates.yml new file mode 100644 index 00000000000..9d9158ca4af --- /dev/null +++ b/changelogs/unreleased/57544-web-ide-new-directory-dialog-shows-file-templates.yml @@ -0,0 +1,5 @@ +--- +title: Do not show file templates when creating a new directory in WebIDE +merge_request: !25119 +author: +type: fixed diff --git a/spec/javascripts/ide/components/new_dropdown/modal_spec.js b/spec/javascripts/ide/components/new_dropdown/modal_spec.js index 595a2f927e9..d94cc1a8faa 100644 --- a/spec/javascripts/ide/components/new_dropdown/modal_spec.js +++ b/spec/javascripts/ide/components/new_dropdown/modal_spec.js @@ -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'); |