Commit e5cd65a4 authored by Phil Hughes's avatar Phil Hughes

fixed new file/directory modal using methods that no longer exist

[ci skip]
parent caee9d58
...@@ -24,13 +24,13 @@ ...@@ -24,13 +24,13 @@
</script> </script>
<template> <template>
<div class="breadcrumb repo-breadcrumb"> <div>
<div class="dropdown"> <ul class="breadcrumb repo-breadcrumb">
<li class="dropdown">
<button <button
type="button" type="button"
class="btn btn-default dropdown-toggle add-to-tree" class="btn btn-default dropdown-toggle add-to-tree"
data-toggle="dropdown" data-toggle="dropdown"
data-target=".add-to-tree-dropdown"
> >
<i <i
class="fa fa-plus" class="fa fa-plus"
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
> >
</i> </i>
</button> </button>
</div>
<div class="add-to-tree-dropdown">
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<a <a
...@@ -60,7 +58,8 @@ ...@@ -60,7 +58,8 @@
</a> </a>
</li> </li>
</ul> </ul>
</div> </li>
</ul>
<new-modal <new-modal
v-if="openModal" v-if="openModal"
:type="modalType" :type="modalType"
......
...@@ -24,12 +24,13 @@ ...@@ -24,12 +24,13 @@
if (this.entryName === '') return; if (this.entryName === '') return;
const fileName = this.type === 'tree' ? '.gitkeep' : this.entryName; const fileName = this.type === 'tree' ? '.gitkeep' : this.entryName;
let tree = null; let tree = RepoStore;
if (this.type === 'tree') { if (this.type === 'tree') {
tree = RepoHelper.serializeTree({ tree = RepoHelper.serializeRepoEntity('tree', {
name: this.entryName, name: this.entryName,
path: this.entryName, path: this.entryName,
icon: 'folder',
tempFile: true, tempFile: true,
}); });
RepoStore.files.push(tree); RepoStore.files.push(tree);
...@@ -37,17 +38,14 @@ ...@@ -37,17 +38,14 @@
RepoHelper.setDirectoryOpen(tree, tree.name); RepoHelper.setDirectoryOpen(tree, tree.name);
} }
const file = RepoHelper.serializeBlob({ const file = RepoHelper.serializeRepoEntity('blob', {
name: fileName, name: fileName,
path: tree ? `${tree}/${fileName}` : fileName, path: tree.path ? `${tree.path}/${fileName}` : fileName,
icon: 'file-text-o',
tempFile: true, tempFile: true,
}); }, (this.type === 'tree' ? tree.level + 1 : 0));
if (tree) { tree.files.push(file);
RepoStore.addFilesToDirectory(tree, RepoStore.files, [file]);
} else {
RepoStore.addFilesToDirectory(tree, RepoStore.files, [...RepoStore.files, file]);
}
RepoHelper.setFile(file, file); RepoHelper.setFile(file, file);
RepoStore.editMode = true; RepoStore.editMode = true;
...@@ -82,6 +80,9 @@ ...@@ -82,6 +80,9 @@
return __('File name'); return __('File name');
}, },
}, },
mounted() {
this.$refs.fieldName.focus();
},
}; };
</script> </script>
...@@ -107,6 +108,7 @@ ...@@ -107,6 +108,7 @@
type="text" type="text"
class="form-control" class="form-control"
v-model="entryName" v-model="entryName"
ref="fieldName"
/> />
</div> </div>
</fieldset> </fieldset>
......
...@@ -30,7 +30,7 @@ const RepoTab = { ...@@ -30,7 +30,7 @@ const RepoTab = {
Store.setActiveFiles(file); Store.setActiveFiles(file);
}, },
closeTab(file) { closeTab(file) {
if (file.changed) return; if (file.changed || file.tempFile) return;
Store.removeFromOpenedFiles(file); Store.removeFromOpenedFiles(file);
}, },
......
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