Adds green to circle when unsaved. Activates right tab when closing.

This commit is contained in:
Jacob Schatz 2017-07-26 22:02:58 -04:00
parent 0cdf970024
commit d52172fa13
5 changed files with 25 additions and 5 deletions

View file

@ -30,7 +30,7 @@ function initRepo() {
data: () => Store, data: () => Store,
template: ` template: `
<div class="tree-content-holder"> <div class="tree-content-holder">
<repo-sidebar/><div class="panel-right" :class="{'edit-mode': readOnly}"> <repo-sidebar/><div class="panel-right" :class="{'edit-mode': editMode}">
<repo-tabs/> <repo-tabs/>
<repo-file-buttons/> <repo-file-buttons/>
<repo-editor/> <repo-editor/>

View file

@ -13,12 +13,10 @@ const RepoBinaryViewer = {
methods: { methods: {
errored() { errored() {
console.log('errored');
Store.binaryLoaded = false; Store.binaryLoaded = false;
}, },
loaded() { loaded() {
console.log('loaded');
Store.binaryLoaded = true; Store.binaryLoaded = true;
}, },
@ -39,7 +37,6 @@ const RepoBinaryViewer = {
if (!this.binary) return; if (!this.binary) return;
switch (this.binaryMimeType) { switch (this.binaryMimeType) {
case 'image/png': case 'image/png':
console.log('png bitch')
this.binaryTypes.png = true; this.binaryTypes.png = true;
break; break;
default: default:

View file

@ -65,6 +65,7 @@ const RepoEditor = {
}, },
editMode() { editMode() {
console.log('edit mode changed')
const readOnly = !this.editMode; const readOnly = !this.editMode;
Store.readOnly = readOnly; Store.readOnly = readOnly;

View file

@ -151,8 +151,25 @@ const RepoStore = {
removeFromOpenedFiles(file) { removeFromOpenedFiles(file) {
if (file.type === 'tree') return; if (file.type === 'tree') return;
let foundIndex;
RepoStore.openedFiles = RepoStore.openedFiles.filter((openedFile, i) => {
if(openedFile.url === file.url) foundIndex = i;
return openedFile.url !== file.url;
});
RepoStore.openedFiles = RepoStore.openedFiles.filter(openedFile => openedFile.url !== file.url); // now activate the right tab based on what you closed.
if(RepoStore.openedFiles.length === 0) return;
if(RepoStore.openedFiles.length === 1 || foundIndex === 0) {
RepoStore.setActiveFiles(RepoStore.openedFiles[0]);
return;
}
if(foundIndex) {
if(foundIndex > 0) {
RepoStore.setActiveFiles(RepoStore.openedFiles[foundIndex - 1]);
}
}
}, },
addPlaceholderFile() { addPlaceholderFile() {

View file

@ -100,6 +100,7 @@
&.close { &.close {
width: auto; width: auto;
font-size: 15px; font-size: 15px;
opacity: 1;
} }
} }
@ -110,6 +111,10 @@
margin-left: 15px; margin-left: 15px;
color: $gray-darkest; color: $gray-darkest;
} }
i.fa.fa-circle {
color: $brand-success;
}
} }
} }