Commit 33c8de60 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Further eslint fixes after conflict resolution

parent 9fe346af
...@@ -27,7 +27,7 @@ export default class RepoBinaryViewer { ...@@ -27,7 +27,7 @@ export default class RepoBinaryViewer {
watch: { watch: {
blobRaw() { blobRaw() {
if(this.isMarkdown()) { if (this.isMarkdown()) {
this.binaryTypes.markdown = true; this.binaryTypes.markdown = true;
this.activeFile.raw = false; this.activeFile.raw = false;
// counts as binaryish so we use the binary viewer in this case. // counts as binaryish so we use the binary viewer in this case.
......
import Tabs from './repo_tabs' import Tabs from './repo_tabs';
import Sidebar from './repo_sidebar' import Sidebar from './repo_sidebar';
import Editor from './repo_editor' import Editor from './repo_editor';
import FileButtons from './repo_file_buttons' import FileButtons from './repo_file_buttons';
import EditButton from './repo_edit_button' import EditButton from './repo_edit_button';
import BinaryViewer from './repo_binary_viewer' import BinaryViewer from './repo_binary_viewer';
import CommitSection from './repo_commit_section' import CommitSection from './repo_commit_section';
import Service from './repo_service' import Service from './repo_service';
import Store from './repo_store' import Store from './repo_store';
import Helper from './repo_helper' import Helper from './repo_helper';
export default class RepoBundle { export default class RepoBundle {
constructor() { constructor() {
......
import Helper from './repo_helper' import Vue from 'vue';
import Vue from 'vue' import Store from './repo_store';
import Store from './repo_store'
export default class RepoCommitSection { export default class RepoCommitSection {
constructor() { constructor() {
...@@ -16,13 +15,11 @@ export default class RepoCommitSection { ...@@ -16,13 +15,11 @@ export default class RepoCommitSection {
computed: { computed: {
changedFiles() { changedFiles() {
const changedFileList = this.openedFiles const changedFileList = this.openedFiles
.filter((file) => { .filter(file => file.changed);
return file.changed; console.log('changedFileList', changedFileList);
});
console.log('changedFileList',changedFileList);
return changedFileList; return changedFileList;
}, },
} },
}); });
} }
} }
import Service from './repo_service' import Vue from 'vue';
import Helper from './repo_helper' import Store from './repo_store';
import Vue from 'vue'
import Store from './repo_store'
export default class RepoEditButton { export default class RepoEditButton {
constructor() { constructor() {
...@@ -20,13 +18,13 @@ export default class RepoEditButton { ...@@ -20,13 +18,13 @@ export default class RepoEditButton {
buttonIcon() { buttonIcon() {
return this.editMode ? [] : ['fa', 'fa-pencil']; return this.editMode ? [] : ['fa', 'fa-pencil'];
} },
}, },
methods: { methods: {
editClicked() { editClicked() {
this.editMode = !this.editMode; this.editMode = !this.editMode;
} },
} },
}); });
} }
} }
...@@ -10,18 +10,11 @@ export default class RepoEditor { ...@@ -10,18 +10,11 @@ export default class RepoEditor {
} }
addMonacoEvents() { addMonacoEvents() {
this.monacoEditor.onMouseUp(this.onMonacoEditorMouseUp.bind(this)); this.monacoEditor.onMouseUp(RepoEditor.onMonacoEditorMouseUp);
this.monacoEditor.onKeyUp(this.onMonacoEditorKeysPressed.bind(this)); this.monacoEditor.onKeyUp(this.onMonacoEditorKeysPressed.bind(this));
} }
static onMonacoEditorMouseUp(e) { onMonacoEditorKeysPressed() {
if (e.target.element.className === 'line-numbers') {
location.hash = `L${e.target.position.lineNumber}`;
Store.activeLine = e.target.position.lineNumber;
}
}
onMonacoEditorKeysPressed(e) {
Helper.setActiveFileContents(this.monacoEditor.getValue()); Helper.setActiveFileContents(this.monacoEditor.getValue());
} }
...@@ -63,7 +56,7 @@ export default class RepoEditor { ...@@ -63,7 +56,7 @@ export default class RepoEditor {
methods: { methods: {
showHide() { showHide() {
if(!this.openedFiles.length || (this.binary && !this.activeFile.raw)) { if (!this.openedFiles.length || (this.binary && !this.activeFile.raw)) {
self.el.style.display = 'none'; self.el.style.display = 'none';
} else { } else {
self.el.style.display = 'inline-block'; self.el.style.display = 'inline-block';
...@@ -80,17 +73,16 @@ export default class RepoEditor { ...@@ -80,17 +73,16 @@ export default class RepoEditor {
}, },
editMode() { editMode() {
if(this.editMode) { if (this.editMode) {
document.querySelector('.panel-right').classList.add('edit-mode'); document.querySelector('.panel-right').classList.add('edit-mode');
self.monacoEditor.updateOptions({ self.monacoEditor.updateOptions({
readOnly: false readOnly: false,
}); });
} else { } else {
document.querySelector('.panel-right').classList.remove('edit-mode'); document.querySelector('.panel-right').classList.remove('edit-mode');
self.monacoEditor.updateOptions({ self.monacoEditor.updateOptions({
readOnly: true readOnly: true,
}); });
} }
}, },
...@@ -114,7 +106,7 @@ export default class RepoEditor { ...@@ -114,7 +106,7 @@ export default class RepoEditor {
blobRaw() { blobRaw() {
this.showHide(); this.showHide();
if(!this.isTree) { if (!this.isTree) {
// kill the current model; // kill the current model;
self.monacoEditor.setModel(null); self.monacoEditor.setModel(null);
// then create the new one // then create the new one
...@@ -130,4 +122,11 @@ export default class RepoEditor { ...@@ -130,4 +122,11 @@ export default class RepoEditor {
}, },
}); });
} }
static onMonacoEditorMouseUp(e) {
if (e.target.element.className === 'line-numbers') {
location.hash = `L${e.target.position.lineNumber}`;
Store.activeLine = e.target.position.lineNumber;
}
}
} }
import Vue from 'vue' import Vue from 'vue';
import Store from './repo_store' import Store from './repo_store';
import Helper from './repo_helper' import Helper from './repo_helper';
import RepoMiniMixin from './repo_mini_mixin' import RepoMiniMixin from './repo_mini_mixin';
export default class RepoSidebar { export default class RepoSidebar {
constructor(url) { constructor(url) {
...@@ -33,7 +33,7 @@ export default class RepoSidebar { ...@@ -33,7 +33,7 @@ export default class RepoSidebar {
computed: { computed: {
editableBorder() { editableBorder() {
return this.editMode ? '1px solid #1F78D1' :'1px solid #f0f0f0'; return this.editMode ? '1px solid #1F78D1' : '1px solid #f0f0f0';
}, },
canPreview() { canPreview() {
...@@ -56,7 +56,7 @@ export default class RepoSidebar { ...@@ -56,7 +56,7 @@ export default class RepoSidebar {
methods: { methods: {
rawPreviewToggle() { rawPreviewToggle() {
Helper.setCurrentFileRawOrPreview(); Helper.setCurrentFileRawOrPreview();
} },
}, },
}); });
} }
......
...@@ -70,12 +70,14 @@ const RepoHelper = { ...@@ -70,12 +70,14 @@ const RepoHelper = {
setActiveFile(file) { setActiveFile(file) {
// don't load the file that is already loaded // don't load the file that is already loaded
if(file.url === Store.activeFile.url) return; if (file.url === Store.activeFile.url) return;
Store.openedFiles = Store.openedFiles.map((openedFile, i) => { Store.openedFiles = Store.openedFiles.map((openedFile, i) => {
openedFile.active = file.url === openedFile.url; const activeFile = openedFile;
if(openedFile.active) {
Store.activeFile = openedFile; activeFile.active = file.url === activeFile.url;
if (activeFile.active) {
Store.activeFile = activeFile;
Store.activeFileIndex = i; Store.activeFileIndex = i;
} }
return activeFile; return activeFile;
...@@ -86,7 +88,7 @@ const RepoHelper = { ...@@ -86,7 +88,7 @@ const RepoHelper = {
// can't get vue to listen to raw for some reason so this for now. // can't get vue to listen to raw for some reason so this for now.
Store.activeFileLabel = 'Raw'; Store.activeFileLabel = 'Raw';
if(file.binary) { if (file.binary) {
Store.blobRaw = file.base64; Store.blobRaw = file.base64;
} else { } else {
Store.blobRaw = file.plain; Store.blobRaw = file.plain;
...@@ -103,12 +105,13 @@ const RepoHelper = { ...@@ -103,12 +105,13 @@ const RepoHelper = {
}, },
addToOpenedFiles(file) { addToOpenedFiles(file) {
const openedFilesAlreadyExists = Store.openedFiles.some((openedFile) => { const openFile = file;
return openedFile.url === file.url
}); const openedFilesAlreadyExists = Store.openedFiles
if(!openedFilesAlreadyExists) { .some(openedFile => openedFile.url === openFile.url);
file.changed = false; if (!openedFilesAlreadyExists) {
Store.openedFiles.push(file); openFile.changed = false;
Store.openedFiles.push(openFile);
} }
}, },
...@@ -143,7 +146,7 @@ const RepoHelper = { ...@@ -143,7 +146,7 @@ const RepoHelper = {
}, },
setActiveFileContents(contents) { setActiveFileContents(contents) {
if(!Store.editMode) return; if (!Store.editMode) return;
Store.activeFile.newContent = contents; Store.activeFile.newContent = contents;
Store.activeFile.changed = Store.activeFile.plain !== Store.activeFile.newContent; Store.activeFile.changed = Store.activeFile.plain !== Store.activeFile.newContent;
Store.openedFiles[Store.activeFileIndex].changed = Store.activeFile.changed; Store.openedFiles[Store.activeFileIndex].changed = Store.activeFile.changed;
...@@ -180,7 +183,8 @@ const RepoHelper = { ...@@ -180,7 +183,8 @@ const RepoHelper = {
}, },
// may be tree or file. // may be tree or file.
getContent(file) { getContent(treeOrFile) {
let file = treeOrFile;
// don't load the same active file. That's silly. // don't load the same active file. That's silly.
// if(file && file.url === this.activeFile.url) return; // if(file && file.url === this.activeFile.url) return;
const loadingData = this.setLoading(true); const loadingData = this.setLoading(true);
...@@ -206,7 +210,7 @@ const RepoHelper = { ...@@ -206,7 +210,7 @@ const RepoHelper = {
Store.blobRaw = data.plain; Store.blobRaw = data.plain;
data.binary = false; data.binary = false;
} }
if(!file.url) { if (!file.url) {
file.url = location.pathname; file.url = location.pathname;
} }
data.url = file.url; data.url = file.url;
......
...@@ -48,11 +48,11 @@ export default class RepoSidebar { ...@@ -48,11 +48,11 @@ export default class RepoSidebar {
if (file.type === 'tree' && file.opened) { if (file.type === 'tree' && file.opened) {
Helper.removeChildFilesOfTree(file); Helper.removeChildFilesOfTree(file);
return; return;
} else { }
url = file.url; url = file.url;
Service.url = url; Service.url = url;
Helper.getContent(file); Helper.getContent(file);
}
url = file.url; url = file.url;
Service.url = url; Service.url = url;
Helper.getContent(file); Helper.getContent(file);
......
...@@ -24,7 +24,7 @@ const RepoStore = { ...@@ -24,7 +24,7 @@ const RepoStore = {
url: '', url: '',
raw: false, raw: false,
newContent: '', newContent: '',
changed: false changed: false,
}, },
activeFileIndex: 0, activeFileIndex: 0,
activeLine: 0, activeLine: 0,
......
...@@ -20,10 +20,10 @@ const RepoTab = { ...@@ -20,10 +20,10 @@ const RepoTab = {
changedClass() { changedClass() {
const tabChangedObj = { const tabChangedObj = {
'fa-times': !this.tab.changed, 'fa-times': !this.tab.changed,
'fa-circle': this.tab.changed 'fa-circle': this.tab.changed,
}; };
return tabChangedObj return tabChangedObj;
} },
}, },
methods: { methods: {
...@@ -32,7 +32,7 @@ const RepoTab = { ...@@ -32,7 +32,7 @@ const RepoTab = {
}, },
xClicked(file) { xClicked(file) {
if(file.changed) return; if (file.changed) return;
RepoHelper.removeFromOpenedFiles(file); RepoHelper.removeFromOpenedFiles(file);
}, },
}, },
......
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