summaryrefslogtreecommitdiffstats
path: root/assets
diff options
context:
space:
mode:
authorsijanec <sijanecantonluka@gmail.com>2020-05-20 19:21:31 +0200
committersijanec <sijanecantonluka@gmail.com>2020-05-20 19:21:31 +0200
commit448708182490d551721767bffc34ef35375f5082 (patch)
treef039502e4b2bb7aee1ad162aca38f89a2fb7cc5f /assets
parentMerge branch 'dev' of https://github.com/beziapp/beziapp.github.io into dev (diff)
downloadbeziapp-448708182490d551721767bffc34ef35375f5082.tar
beziapp-448708182490d551721767bffc34ef35375f5082.tar.gz
beziapp-448708182490d551721767bffc34ef35375f5082.tar.bz2
beziapp-448708182490d551721767bffc34ef35375f5082.tar.lz
beziapp-448708182490d551721767bffc34ef35375f5082.tar.xz
beziapp-448708182490d551721767bffc34ef35375f5082.tar.zst
beziapp-448708182490d551721767bffc34ef35375f5082.zip
Diffstat (limited to 'assets')
-rw-r--r--assets/js/app.js.bvr20
-rw-r--r--assets/js/lang/bundle.js19
-rw-r--r--assets/js/settings.js19
-rw-r--r--assets/js/setup-storage.js1
-rw-r--r--assets/pages-src/settings.bvr20
5 files changed, 67 insertions, 12 deletions
diff --git a/assets/js/app.js.bvr b/assets/js/app.js.bvr
index 413c4a6..a75505e 100644
--- a/assets/js/app.js.bvr
+++ b/assets/js/app.js.bvr
@@ -54,11 +54,21 @@ function gsecErrorHandlerUI(err) {
var error_report_function = async function (msg, url, lineNo, columnNo, error) {
- var data = {};
- data.error = {"msg": msg, "url": url, "line": lineNo, "column": columnNo, "obj": error};
- data.client = {"ua": navigator.userAgent, "app_version": app_version, "previous_commit": previous_commit};
- data.type = "error";
- $.post("https://beziapp-report.gimb.tk/", data);
+ localforage.getItem("errorReporting").then((value) => {
+ let selectedE = value;
+ if(value == null || value.length < 1) {
+ selectedE = "on";
+ }
+ if(selectedE == "on") {
+ var data = {};
+ data.error = {"msg": msg, "url": url, "line": lineNo, "column": columnNo, "obj": error};
+ data.client = {"ua": navigator.userAgent, "app_version": app_version, "previous_commit": previous_commit};
+ data.type = "error";
+ $.post("https://beziapp-report.gimb.tk/", data);
+ } else {
+ console.log("error not reported as reporting is disabled!");
+ }
+ }).catch(() => {});
return false;
}
diff --git a/assets/js/lang/bundle.js b/assets/js/lang/bundle.js
index 999e540..7e269b0 100644
--- a/assets/js/lang/bundle.js
+++ b/assets/js/lang/bundle.js
@@ -288,10 +288,14 @@ var langstrings = {
selectLanguage: "select desired language",
languageSet: "language set, open another page for the changes to take effect",
theme: "theme",
- themeLight: "Light theme (default)",
- themeDark: "Dark theme",
- selectTheme: "Select a theme",
+ themeLight: "light theme (default)",
+ themeDark: "dark theme",
+ selectTheme: "select a theme",
themeSet: "theme set, open another page for the changes to take effect",
+ errorReportingSet: "error reporting preference set",
+ errorReporting: "error reporting",
+ on: "on",
+ off: "off",
// gsec
gsecErrNet: "GimSIS connection error",
gsecErrLogin: "GimSIS login error (bad password?), try logging out",
@@ -417,7 +421,7 @@ var langstrings = {
recipientNotInDirectory: "izbrane osebe ni v imeniku",
chatExternalInfo: "dobili ste kratko sporočilo v standardu, ki ga GimSIS ne podpira. Pri odgovarjanju spremenite zadevo. Vsebina sporočila: ",
// meals
- loginError: "napaka pri prijavi",
+ loginError: "napaka pri prijavi",
loginToLopolis: "prijava v Lopolis",
loginToLopolisNote: "izgleda, da niste prijavljeni v eRestavracijo, zato se vam je prikazal prijavni obrazec. Za uporavljanje s prehrano se uporablja druga kombinacija uporabniškega imena in gesla, zato se prijavite s svojimi Lopolis prijavnimi podatki za nadaljevanje.",
logInToLopolis: "prijava v Lopolis",
@@ -474,7 +478,8 @@ var langstrings = {
privacyRefuse: "you are free to refuse our request for your personal information, with the understanding that we may be unable to provide you with some of your desired services.",
privacyAcceptWithUse: "your continued use of our website will be regarded as acceptance of our practices around privacy and personal information. If you have any questions about how we handle user data and personal information, feel free to contact us.",
privacyEffectiveAsOf: "this policy is effective as of",
- language: "jezik",
+ // settings
+ language: "jezik",
selectLanguage: "izberite željen jezik",
languageSet: "jezik nastavljen, odprite neko drugo stran da se pokažejo spremembe",
theme: "izgled",
@@ -482,6 +487,10 @@ var langstrings = {
themeDark: "temen izgled",
themeSet: "izgled nastavljen, odprite neko drugo stran da se spremembe uveljavijo",
selectTheme: "izberite željen izgled",
+ errorReportingSet: "nastavitev pošiljanja napak izbrana",
+ errorReporting: "pošiljanje napak",
+ on: "vklopljeno",
+ off: "izklopljeno",
// gsec
gsecErrNet: "napaka povezave na GimSIS",
gsecErrLogin: "prijava v GimSIS ni uspela (napačno geslo?), poskusite se odjaviti",
diff --git a/assets/js/settings.js b/assets/js/settings.js
index b53d2ce..7ea0b47 100644
--- a/assets/js/settings.js
+++ b/assets/js/settings.js
@@ -14,6 +14,13 @@ async function setTheme(targetTheme) {
});
}
+async function setErrorReporting(targetE) {
+ localforage.setItem("errorReporting", targetE).then((value) => {
+ console.log("ErrorReporing set: " + value);
+ UIAlert(D("errorReportingSet"), "setErrorReporting(): errorReportingSet");
+ });
+}
+
document.addEventListener("DOMContentLoaded", async () => {
$("#select-language").on("change", function() {
@@ -24,6 +31,10 @@ document.addEventListener("DOMContentLoaded", async () => {
setTheme($(this).find(":selected").val());
});
+ $("#select-errorreporting").on("change", function() {
+ setErrorReporting($(this).find(":selected").val());
+ });
+
localforage.getItem("chosenLang").then((value) => {
let selectedLanguage = value;
if(value == null || value.length < 1) {
@@ -40,6 +51,14 @@ document.addEventListener("DOMContentLoaded", async () => {
$(`#option-${selectedTheme}`).attr("selected", true);
}).catch(() => {});
+ localforage.getItem("errorReporting").then((value) => {
+ let selectedE = value;
+ if(value == null || value.length < 1) {
+ selectedE = "on";
+ }
+ $(`#option-${selectedE}`).attr("selected", true);
+ }).catch(() => {});
+
// Setup side menu
const menus = document.querySelectorAll(".side-menu");
M.Sidenav.init(menus, { edge: "right", draggable: true });
diff --git a/assets/js/setup-storage.js b/assets/js/setup-storage.js
index f9fa656..ce66bba 100644
--- a/assets/js/setup-storage.js
+++ b/assets/js/setup-storage.js
@@ -20,6 +20,7 @@ async function setupStorage(force = false) {
localforage.setItem("meals", {}),
localforage.setItem("chosenLang", "en"),
localforage.setItem("theme", "light")
+ localforage.setItem("errorReporting", "on")
];
if (logged_in && force == false) { // torej, če je že bila prijava narejena, ne posodobi backwards-compatible vrednosti (username, password,...)
diff --git a/assets/pages-src/settings.bvr b/assets/pages-src/settings.bvr
index 4eed647..4c55da6 100644
--- a/assets/pages-src/settings.bvr
+++ b/assets/pages-src/settings.bvr
@@ -75,12 +75,28 @@
<div class="input-field col s12">
<i class="material-icons prefix">palette</i>
<select class="theme-select input-select" id="select-theme">
- <option value="light" id="option-light" data-theme="light" selected>Light</option>
- <option value="dark" id="option-dark" data-theme="dark">Dark</option>
+ <option value="light" id="option-light" data-theme="light" selected><x-su>themeLight</x-su></option>
+ <option value="dark" id="option-dark" data-theme="dark"><x-su>themeDark</x-su></option>
</select>
<label><x-su>selectTheme</x-su></label>
</div>
</div>
+
+
+ <div class="row">
+ <div class="col s12">
+ <h5 class="general-text"><x-su>errorReporting</x-su></h5>
+ </div>
+ <div class="input-field col s12">
+ <i class="material-icons prefix">report_problem</i>
+ <select class="errorreporting-select input-select" id="select-errorreporting">
+ <option value="on" id="option-on" data-errorreporting="on" selected><x-su>on</x-su></option>
+ <option value="off" id="option-off" data-errorreporting="off"><x-su>off</x-su></option>
+ </select>
+ <label><x-su>selectErrorReporting</x-su></label>
+ </div>
+ </div>
+
</div>
</body>