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

Adds prev dir back in

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