BigW Consortium Gitlab

Commit ebec90a0 by Jacob Schatz

Adds back button.

parent 6190c39e
......@@ -46,6 +46,7 @@ let RepoHelper = {
// it's a blob
const parentURL = this.blobURLtoParent(Service.url);
Store.blobRaw = data.plain;
Store.prevURL = this.blobURLtoParent(parentURL);
Service.getContent(parentURL)
.then((response) => {
Store.files = this.dataToListOfFiles(response.data);
......@@ -56,6 +57,7 @@ let RepoHelper = {
} else {
// it's a tree
Store.files = this.dataToListOfFiles(data);
Store.prevURL = this.blobURLtoParent(Service.url);
}
})
.catch((response)=> {
......
......@@ -2,17 +2,17 @@ let RepoPreviousDirectory = {
template: `
<tr>
<td colspan='3'>
<a href='#' @click.prevent='linkClicked("prev")'>..</a>
<a :href='prevurl' @click.prevent='linkClicked(prevurl)'>..</a>
</td>
</tr>
`,
props: {
name: 'repo-previous-directory',
prevurl: String
},
methods: {
linkClicked(file) {
console.log(this.isTree)
this.$emit('linkclicked', file);
}
}
......
......@@ -37,14 +37,16 @@ export default class RepoSidebar {
},
linkClicked(file) {
if(file === 'prev'){
let url = '';
if(typeof file === 'string'){
// go back
url = file;
} else {
Service.url = file.url;
Helper.getContent();
Helper.toURL(file.url);
url = file.url;
}
Service.url = url;
Helper.getContent();
Helper.toURL(url);
}
},
});
......
......@@ -3,6 +3,7 @@ let RepoStore = {
editor: '',
sidebar: '',
isTree: false,
prevURL: '',
trees: [],
blobs: [],
submodules: [],
......
.tree-content-holder
%header
Project
#sidebar.isworking{ ":class" => "{'sidebar-mini' : !isTree}" }<
#sidebar{ ":class" => "{'sidebar-mini' : !isTree}" }<
%table.table
%thead{"v-if" => "isTree"}
%th
%th{"v-if" => "isTree"}
Name
%th{"v-else"}
Project
%th{"v-if" => "isTree"}
Last Commit
%th{"v-if" => "isTree"}
Last Update
%tr{ is: "repo-previous-directory" }
%tr{ is: "repo-previous-directory", ":prevurl" => "prevURL", "@linkclicked" => "linkClicked" }
%tr{ is: "repo-file", "v-for" => "file in files", ":key" => "file.id", ":file" => "file","@linkclicked" => "linkClicked(file)", ":is-tree" => "isTree" }
#ide{ data: { url: repo_url }, style: "height:400px;" }>
......
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