Commit ebec90a0 authored by Jacob Schatz's avatar Jacob Schatz

Adds back button.

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