|
|
@ -38,7 +38,7 @@ class Controller {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (localStorage.getItem("pushError")) {
|
|
|
|
if (localStorage.getItem("pushError") != "false") {
|
|
|
|
this.view.openPublish();
|
|
|
|
this.view.openPublish();
|
|
|
|
this.view.errorPublish("Máte nepublikované změny: publikujte je.");
|
|
|
|
this.view.errorPublish("Máte nepublikované změny: publikujte je.");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -73,12 +73,65 @@ class Controller {
|
|
|
|
commitSubmit.addEventListener("click", this.publish.bind(this));
|
|
|
|
commitSubmit.addEventListener("click", this.publish.bind(this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ================== Dir Tree ================== */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
redrawDirTree(view) {
|
|
|
|
|
|
|
|
this.model.getDirTree().then(
|
|
|
|
|
|
|
|
function (value) {
|
|
|
|
|
|
|
|
view.removeDirTree();
|
|
|
|
|
|
|
|
view.drawDirTree(value, undefined, this);
|
|
|
|
|
|
|
|
view.dirTreeToggler();
|
|
|
|
|
|
|
|
this.updateFileStats();
|
|
|
|
|
|
|
|
}.bind(this),
|
|
|
|
|
|
|
|
function (error) {
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateFileStats() {
|
|
|
|
|
|
|
|
this.model.getGitStatusTree().then(
|
|
|
|
|
|
|
|
function (value) {
|
|
|
|
|
|
|
|
this.view.statDirTree(value, undefined);
|
|
|
|
|
|
|
|
}.bind(this),
|
|
|
|
|
|
|
|
function (error) {
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ================== Text Area ================== */
|
|
|
|
|
|
|
|
|
|
|
|
saveButton() {
|
|
|
|
saveButton() {
|
|
|
|
var textArea = this.view.simplemde;
|
|
|
|
var textArea = this.view.simplemde;
|
|
|
|
|
|
|
|
|
|
|
|
this.view.showSaveButton(textArea.value() == this.openedFileValue);
|
|
|
|
this.view.showSaveButton(textArea.value() == this.openedFileValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loadFile(file) {
|
|
|
|
|
|
|
|
this.openedFile = file;
|
|
|
|
|
|
|
|
this.model.readFile(file).then(
|
|
|
|
|
|
|
|
function (value) {
|
|
|
|
|
|
|
|
this.openedFileValue = value;
|
|
|
|
|
|
|
|
this.view.openFile(value);
|
|
|
|
|
|
|
|
}.bind(this),
|
|
|
|
|
|
|
|
function (error) {
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveFile() {
|
|
|
|
|
|
|
|
var textArea = this.view.simplemde;
|
|
|
|
|
|
|
|
this.model.saveFile(this.openedFile, textArea.value());
|
|
|
|
|
|
|
|
this.openedFileValue = textArea.value();
|
|
|
|
|
|
|
|
this.saveButton();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.updateFileStats();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ================== Controls ================== */
|
|
|
|
|
|
|
|
|
|
|
|
wipeFS() {
|
|
|
|
wipeFS() {
|
|
|
|
this.model.wipeFS();
|
|
|
|
this.model.wipeFS();
|
|
|
|
//window.location.reload();
|
|
|
|
//window.location.reload();
|
|
|
@ -115,30 +168,8 @@ class Controller {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
redrawDirTree(view) {
|
|
|
|
/* ================== Windows ================== */
|
|
|
|
this.model.getDirTree().then(
|
|
|
|
/* ------------------ Settings ------------------ */
|
|
|
|
function (value) {
|
|
|
|
|
|
|
|
view.removeDirTree();
|
|
|
|
|
|
|
|
view.drawDirTree(value, undefined, this);
|
|
|
|
|
|
|
|
view.dirTreeToggler();
|
|
|
|
|
|
|
|
this.updateFileStats();
|
|
|
|
|
|
|
|
}.bind(this),
|
|
|
|
|
|
|
|
function (error) {
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateFileStats() {
|
|
|
|
|
|
|
|
this.model.getGitStatusTree().then(
|
|
|
|
|
|
|
|
function (value) {
|
|
|
|
|
|
|
|
this.view.statDirTree(value, undefined);
|
|
|
|
|
|
|
|
}.bind(this),
|
|
|
|
|
|
|
|
function (error) {
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveSettings() {
|
|
|
|
saveSettings() {
|
|
|
|
let repo = document.getElementById("inputRepository");
|
|
|
|
let repo = document.getElementById("inputRepository");
|
|
|
@ -166,18 +197,7 @@ class Controller {
|
|
|
|
this.view.closeDialog();
|
|
|
|
this.view.closeDialog();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
loadFile(file) {
|
|
|
|
/* ------------------ Publish ------------------ */
|
|
|
|
this.openedFile = file;
|
|
|
|
|
|
|
|
this.model.readFile(file).then(
|
|
|
|
|
|
|
|
function (value) {
|
|
|
|
|
|
|
|
this.openedFileValue = value;
|
|
|
|
|
|
|
|
this.view.openFile(value);
|
|
|
|
|
|
|
|
}.bind(this),
|
|
|
|
|
|
|
|
function (error) {
|
|
|
|
|
|
|
|
console.log(error);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
publish() {
|
|
|
|
publish() {
|
|
|
|
let msg = document.getElementById("inputCommitMsg");
|
|
|
|
let msg = document.getElementById("inputCommitMsg");
|
|
|
@ -207,7 +227,11 @@ class Controller {
|
|
|
|
console.log(error);
|
|
|
|
console.log(error);
|
|
|
|
if (error == "HttpError: HTTP Error: 401 Unauthorized") {
|
|
|
|
if (error == "HttpError: HTTP Error: 401 Unauthorized") {
|
|
|
|
this.view.errorPublish(
|
|
|
|
this.view.errorPublish(
|
|
|
|
"Změny nebyly publikovány: Chyba přihlášení"
|
|
|
|
"Změny nebyly publikovány: Chyba přihlášení."
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
} else if (error == "HttpError: HTTP Error: 403 Forbidden") {
|
|
|
|
|
|
|
|
this.view.errorPublish(
|
|
|
|
|
|
|
|
"Změny nebyly publikovány: Nemáte práva publikovat do tohoto repozitáře."
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
loading.style.removeProperty("display");
|
|
|
|
loading.style.removeProperty("display");
|
|
|
@ -225,13 +249,4 @@ class Controller {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
saveFile() {
|
|
|
|
|
|
|
|
var textArea = this.view.simplemde;
|
|
|
|
|
|
|
|
this.model.saveFile(this.openedFile, textArea.value());
|
|
|
|
|
|
|
|
this.openedFileValue = textArea.value();
|
|
|
|
|
|
|
|
this.saveButton();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.updateFileStats();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|