|
|
@ -36,7 +36,7 @@ class Controller {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (localStorage.getItem("pushError") == "true") {
|
|
|
|
if (localStorage.getItem("pushError") == "true") {
|
|
|
|
this.view.openPublish();
|
|
|
|
this.openPublish();
|
|
|
|
this.view.errorPublish("Máte nepublikované změny: publikujte je.");
|
|
|
|
this.view.errorPublish("Máte nepublikované změny: publikujte je.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -107,7 +107,7 @@ class Controller {
|
|
|
|
saveFile() {
|
|
|
|
saveFile() {
|
|
|
|
var textArea = this.view.simplemde;
|
|
|
|
var textArea = this.view.simplemde;
|
|
|
|
this.model.saveFile(this.openedFile, textArea.value()).then(
|
|
|
|
this.model.saveFile(this.openedFile, textArea.value()).then(
|
|
|
|
function() {
|
|
|
|
function () {
|
|
|
|
this.openedFileValue = textArea.value();
|
|
|
|
this.openedFileValue = textArea.value();
|
|
|
|
this.view.closeEditor();
|
|
|
|
this.view.closeEditor();
|
|
|
|
this.saveButton();
|
|
|
|
this.saveButton();
|
|
|
@ -115,7 +115,6 @@ class Controller {
|
|
|
|
this.updateFileStats();
|
|
|
|
this.updateFileStats();
|
|
|
|
}.bind(this)
|
|
|
|
}.bind(this)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ================== Controls ================== */
|
|
|
|
/* ================== Controls ================== */
|
|
|
@ -123,9 +122,11 @@ class Controller {
|
|
|
|
wipeFS() {
|
|
|
|
wipeFS() {
|
|
|
|
this.view.closeEditor();
|
|
|
|
this.view.closeEditor();
|
|
|
|
|
|
|
|
|
|
|
|
this.model.wipeFS().then(function () {
|
|
|
|
this.model.wipeFS().then(
|
|
|
|
this.redrawDirTree();
|
|
|
|
function () {
|
|
|
|
}.bind(this));
|
|
|
|
this.redrawDirTree();
|
|
|
|
|
|
|
|
}.bind(this)
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cloneRep() {
|
|
|
|
cloneRep() {
|
|
|
@ -174,10 +175,12 @@ 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("Změny nebyly publikovány: Chyba přihlášení.");
|
|
|
|
this.view.errorPublish("Změny nebyly publikovány: Chyba přihlášení.");
|
|
|
|
|
|
|
|
this.openPublish();
|
|
|
|
} else if (error == "HttpError: HTTP Error: 403 Forbidden") {
|
|
|
|
} else if (error == "HttpError: HTTP Error: 403 Forbidden") {
|
|
|
|
this.view.errorPublish(
|
|
|
|
this.view.errorPublish(
|
|
|
|
"Změny nebyly publikovány: Nemáte práva publikovat do tohoto repozitáře."
|
|
|
|
"Změny nebyly publikovány: Nemáte práva publikovat do tohoto repozitáře."
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
this.openPublish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
localStorage.setItem("pushError", "true");
|
|
|
|
localStorage.setItem("pushError", "true");
|
|
|
|
loading.style.removeProperty("display");
|
|
|
|
loading.style.removeProperty("display");
|
|
|
@ -197,7 +200,7 @@ class Controller {
|
|
|
|
let oldRepoURL = localStorage.getItem("repo");
|
|
|
|
let oldRepoURL = localStorage.getItem("repo");
|
|
|
|
this.model.setRepo(repo.value);
|
|
|
|
this.model.setRepo(repo.value);
|
|
|
|
this.model.setBaseDir(baseDir.value).then(
|
|
|
|
this.model.setBaseDir(baseDir.value).then(
|
|
|
|
function() {
|
|
|
|
function () {
|
|
|
|
this.redrawDirTree();
|
|
|
|
this.redrawDirTree();
|
|
|
|
}.bind(this)
|
|
|
|
}.bind(this)
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -225,14 +228,14 @@ class Controller {
|
|
|
|
let loading = document.getElementsByClassName("publishLoading")[0];
|
|
|
|
let loading = document.getElementsByClassName("publishLoading")[0];
|
|
|
|
|
|
|
|
|
|
|
|
if (localStorage.getItem("pushError") == "true") {
|
|
|
|
if (localStorage.getItem("pushError") == "true") {
|
|
|
|
if (gitUser.value == "" || gitPass.gitPass == "") {
|
|
|
|
if (gitUser.value == "" || gitPass.value == "") {
|
|
|
|
this.view.errorPublish("Vyplňte potřebné údaje.");
|
|
|
|
this.view.errorPublish("Vyplňte potřebné údaje.");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
loading.style.display = "block";
|
|
|
|
loading.style.display = "block";
|
|
|
|
this.gitPush(gitUser.value, gitPass.value);
|
|
|
|
this.gitPush(gitUser.value, gitPass.value);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (msg.value == "" || gitUser.value == "" || gitPass.gitPass == "") {
|
|
|
|
if (msg.value == "" || gitUser.value == "" || gitPass.value == "") {
|
|
|
|
this.view.errorPublish("Vyplňte potřebné údaje.");
|
|
|
|
this.view.errorPublish("Vyplňte potřebné údaje.");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -258,6 +261,12 @@ class Controller {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
openPublish() {
|
|
|
|
openPublish() {
|
|
|
|
this.view.openPublish();
|
|
|
|
this.model
|
|
|
|
|
|
|
|
.getChangedFiles(this.model.dirTree, this.model.gitDirTreeStat)
|
|
|
|
|
|
|
|
.then(
|
|
|
|
|
|
|
|
function (v) {
|
|
|
|
|
|
|
|
this.view.openPublish(v);
|
|
|
|
|
|
|
|
}.bind(this)
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|