Commit 95a850ca authored by Jacob Schatz's avatar Jacob Schatz

Adds prev dir back in

parent 880320fd
......@@ -29,12 +29,15 @@ let RepoHelper = {
},
blobURLtoParent(url) {
let joined = '';
const split = url.split('/');
split.pop();
const blobIndex = split.indexOf('blob');
if(blobIndex > -1) {
split[blobIndex] = 'tree';
}
joined = split.join('/');
console.log(split)
return split.join('/');
},
......@@ -183,7 +186,7 @@ let RepoHelper = {
this.addToOpenedFiles(data);
this.setActiveFile(data);
}
// if the file tree is empty
if(Store.files.length === 0) {
const parentURL = this.blobURLtoParent(Service.url);
......@@ -199,6 +202,7 @@ let RepoHelper = {
}
})
.catch((response)=> {
console.log('response',response)
this.setLoading(false, loadingData);
new Flash('Unable to load the file at this time.')
});
......
......@@ -2,13 +2,13 @@ let RepoPreviousDirectory = {
template: `
<tr>
<td colspan='3'>
<a :href='prevurl' @click.prevent='linkClicked(prevurl)'>..</a>
<a :href='prevUrl' @click.prevent='linkClicked(prevurl)'>..</a>
</td>
</tr>
`,
props: {
name: 'repo-previous-directory',
prevurl: String
prevUrl: String
},
methods: {
......
......@@ -43,19 +43,20 @@ export default class RepoSidebar {
linkClicked(file) {
let url = '';
if(typeof file === 'string'){
// go back
url = file;
} else {
url = file.url;
}
Service.url = url;
if(typeof file === 'object') {
if(file.type === 'tree' && file.opened) {
Helper.removeChildFilesOfTree(file);
return;
} else {
url = file.url;
Service.url = url;
Helper.getContent(file);
}
Helper.getContent(file);
} else if(typeof file === 'string') {
// go back
url = file;
Service.url = url;
Helper.getContent();
}
}
},
......
......@@ -73,6 +73,11 @@ header {
overflow: auto;
margin-top: -5px;
margin-left: 10px;
.blob-viewer {
padding-top: 20px;
padding-left: 20px;
}
}
}
......@@ -98,7 +103,7 @@ header {
vertical-align: top;
width: 15%;
border-right: 1px solid $white-normal;
height: 75vh;
height: 80vh;
overflow: auto;
}
......
......@@ -12,7 +12,7 @@
Last Update
%tbody
%tr{ is: "repo-file-options", ":is-mini" => "isMini", "project-name" => @project.name }
%tr{ is: "repo-previous-directory", ":prevurl" => "prevURL", "@linkclicked" => "linkClicked" }
%tr{ is: "repo-previous-directory", ":prev-url" => "prevURL", "@linkclicked" => "linkClicked(prevURL)" }
%tr{ is: "repo-loading-file", "v-for" => "n in 5", ":loading" => "loading", ":has-files" => "!!files.length", ":is-mini" => "isMini"}
%tr{ is: "repo-file", "v-for" => "file in files", ":key" => "file.id", ":file" => "file",":is-mini" => "isMini", "@linkclicked" => "linkClicked(file)", ":is-tree" => "isTree", ":loading" => "loading", ":has-files" => "!!files.length", ":active-file" => "activeFile" }
.panel-right>
......
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