Compare commits
14 Commits
17e1415136
...
d309ea2b46
Author | SHA1 | Date | |
---|---|---|---|
d309ea2b46 | |||
b1372a5fbb | |||
4bc098bc09 | |||
34c2d24891 | |||
74d1ba96b3 | |||
47040057b1 | |||
2984ae4e6d | |||
db273b641d | |||
8f6a28a33e | |||
4fbc47ad8c | |||
f405c325f7 | |||
da52a1dfdf | |||
a13a818485 | |||
d5a467aa55 |
@@ -8,4 +8,6 @@ module.exports = {
|
|||||||
locales: ['en', 'de'],
|
locales: ['en', 'de'],
|
||||||
output: 'public/i18n/$LOCALE.json',
|
output: 'public/i18n/$LOCALE.json',
|
||||||
input: [ 'src/*.js', 'public/*.html', ],
|
input: [ 'src/*.js', 'public/*.html', ],
|
||||||
|
keepRemoved: [/dynamic.*/], //prefixing a key with dynamic. will make it not disappear upon calling i18next
|
||||||
|
|
||||||
}
|
}
|
@@ -22,6 +22,9 @@
|
|||||||
"source-code": "Quellcode",
|
"source-code": "Quellcode",
|
||||||
"give-feedback": "Feedback geben",
|
"give-feedback": "Feedback geben",
|
||||||
"feedback": "Feedback",
|
"feedback": "Feedback",
|
||||||
|
"sus-title": "Bewerte den Rechner",
|
||||||
|
"explanation-feedback": "Vielen Dank, dass du uns Feedback gibst! Dein Feedback hilft uns den Rechner zu verbessern. Wir sammeln dabei keinerlei persönliche Daten. Du tust uns einfach nur einen großen Gefallen!",
|
||||||
|
"submit": "Absenden",
|
||||||
"failed-base-area": "Die Mindestgrundfläche des Käfigs muss {{ MINIMUM_BASE_AREA }}m² (also z.B. 100x50cm) betragen.",
|
"failed-base-area": "Die Mindestgrundfläche des Käfigs muss {{ MINIMUM_BASE_AREA }}m² (also z.B. 100x50cm) betragen.",
|
||||||
"failed-overall-area": "Die Gesamtfläche im Käfig ist zu klein.",
|
"failed-overall-area": "Die Gesamtfläche im Käfig ist zu klein.",
|
||||||
"failed-fall-height": "Die mögliche Fallhöhe darf nicht mehr als {{ maximum_fall_height }}cm betragen.",
|
"failed-fall-height": "Die mögliche Fallhöhe darf nicht mehr als {{ maximum_fall_height }}cm betragen.",
|
||||||
@@ -36,5 +39,23 @@
|
|||||||
"minimum-length-short-side": "Die kurze Seite des Käfig muss mindestens {{ minimum_length_short_side }}cm lang sein.",
|
"minimum-length-short-side": "Die kurze Seite des Käfig muss mindestens {{ minimum_length_short_side }}cm lang sein.",
|
||||||
"cage-complies-with-all-criteria": "Der Käfig erfüllt alle Kriterien!",
|
"cage-complies-with-all-criteria": "Der Käfig erfüllt alle Kriterien!",
|
||||||
"cage-for-x-rats": "Käfig für {{ num_rats }} Ratten",
|
"cage-for-x-rats": "Käfig für {{ num_rats }} Ratten",
|
||||||
"overall-area": "Die Gesamtfläche für {{ numRats }} Ratten muss mindestens {{ minimumOverallArea }}m² betragen."
|
"overall-area": "Die Gesamtfläche für {{ numRats }} Ratten muss mindestens {{ minimumOverallArea }}m² betragen.",
|
||||||
|
"strongly-disagree": "Stimme gar nicht zu",
|
||||||
|
"strongly-agree": "Stimme voll zu",
|
||||||
|
"submit-success": "Erfolgreich abgesendet!",
|
||||||
|
"submit-error": "Fehler beim Absenden!",
|
||||||
|
"network-error": "Fehler bei der Datenübertragung!",
|
||||||
|
"dynamic.sus-question-easy-to-use": "Ich finde der Käfigrechner ist einfach zu nutzen.",
|
||||||
|
"dynamic.sus-question-unnecessarily-complex": "Ich finde den Käfigrechner unnötig komplex.",
|
||||||
|
"dynamic.sus-question-need-support-of-technical-person": "Ich glaube ich brauche die Hilfe eine Technik-Person umd den Rechner zu nutzen.",
|
||||||
|
"dynamic.sus-question-well-integrated": "Ich finde, dass die verschiedenen Funktionen des Rechners gut integriert sind.",
|
||||||
|
"dynamic.sus-question-inconsistency": "Ich finde, dass es im Rechner zu viele Inkonsistenzen gibt.",
|
||||||
|
"dynamic.sus-question-learn-quickly": "Ich vermute, dass die meisten Leute schnell lernen den Rechner zu benutzen",
|
||||||
|
"dynamic.sus-question-cumbersome": "Ich finde den Rechner umständlich zu nutzen.",
|
||||||
|
"dynamic.sus-question-confident": "Ich habe mich bei der Nutzung des Rechners sehr sicher gefühlt.",
|
||||||
|
"dynamic.sus-question-trust": "Ich vertraue den Ergebnissen des Rechners.",
|
||||||
|
"dynamic.question-whats-missing": "Welche Funktion fehlt dir?",
|
||||||
|
"dynamic.question-pain-points": "Was muss aus deiner Sicht am Rechner geändert werden?",
|
||||||
|
"dynamic.question-other-feedback": "Was willst du uns sonst mitteilen?",
|
||||||
|
"dynamic.submit-success": "Erfolgreich abgesendet!"
|
||||||
}
|
}
|
||||||
|
@@ -22,6 +22,9 @@
|
|||||||
"source-code": "Source Code",
|
"source-code": "Source Code",
|
||||||
"give-feedback": "Give Feedback",
|
"give-feedback": "Give Feedback",
|
||||||
"feedback": "Feedback",
|
"feedback": "Feedback",
|
||||||
|
"sus-title": "Rate the calculator",
|
||||||
|
"explanation-feedback": "Thank you for giving us feedback! We will use your feedback to improve the calculator.",
|
||||||
|
"submit": "Submit",
|
||||||
"failed-base-area": "The base area of the cage must not be below {{ MINIMUM_BASE_AREA }}m².",
|
"failed-base-area": "The base area of the cage must not be below {{ MINIMUM_BASE_AREA }}m².",
|
||||||
"failed-overall-area": "The overall area in the cage is to small.",
|
"failed-overall-area": "The overall area in the cage is to small.",
|
||||||
"failed-fall-height": "The possible fall height between floors must not be above {{ maximum_fall_height }}cm.",
|
"failed-fall-height": "The possible fall height between floors must not be above {{ maximum_fall_height }}cm.",
|
||||||
@@ -36,5 +39,22 @@
|
|||||||
"minimum-length-short-side": "The short side of the cage must be at least {{ minimum_length_short_side }}cm.",
|
"minimum-length-short-side": "The short side of the cage must be at least {{ minimum_length_short_side }}cm.",
|
||||||
"cage-complies-with-all-criteria": "This cage complies with all criteria!",
|
"cage-complies-with-all-criteria": "This cage complies with all criteria!",
|
||||||
"cage-for-x-rats": "Cage for {{ num_rats }} rats",
|
"cage-for-x-rats": "Cage for {{ num_rats }} rats",
|
||||||
"overall-area": "The overall area in the cage must be above {{ minimumOverallArea }}m² for {{ numRats }} rats."
|
"overall-area": "The overall area in the cage must be above {{ minimumOverallArea }}m² for {{ numRats }} rats.",
|
||||||
|
"strongly-disagree": "Strongly Disagree",
|
||||||
|
"strongly-agree": "Strongly Agree",
|
||||||
|
"submit-success": "Successfully submitted!",
|
||||||
|
"submit-error": "Error when submitting the form!",
|
||||||
|
"network-error": "Network error when submitting the form!",
|
||||||
|
"dynamic.sus-question-easy-to-use": "I thought the calculator is easy to use.",
|
||||||
|
"dynamic.sus-question-unnecessarily-complex": "I find the calculator unnecessarily complex.",
|
||||||
|
"dynamic.sus-question-need-support-of-technical-person": "I think that I need the support of a technical person to be able to use the calculator.",
|
||||||
|
"dynamic.sus-question-well-integrated": "I found various functions in the calculator were well integrated",
|
||||||
|
"dynamic.sus-question-inconsistency": "I thought there was too much inconsistency in the calculator",
|
||||||
|
"dynamic.sus-question-learn-quickly": "I would imagine that most people would learn to use the calculator very quickly",
|
||||||
|
"dynamic.sus-question-cumbersome": "I found the calculator very cumbersome to use",
|
||||||
|
"dynamic.sus-question-confident": "I felt very confident using the calculator",
|
||||||
|
"dynamic.sus-question-trust": "I trust the results of the calculator.",
|
||||||
|
"dynamic.question-whats-missing": "What functionality do you feel is missing?",
|
||||||
|
"dynamic.question-pain-points": "What do you thing needs to be changed?",
|
||||||
|
"dynamic.question-other-feedback": "What else do you want to tell us?"
|
||||||
}
|
}
|
||||||
|
@@ -261,7 +261,8 @@
|
|||||||
<li class="footer-link"><a href="https://codeberg.org/moanos/rettenrechner" data-i18n="source-code">Quellcode</a>
|
<li class="footer-link"><a href="https://codeberg.org/moanos/rettenrechner" data-i18n="source-code">Quellcode</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="footer-link">
|
<li class="footer-link">
|
||||||
<a class="js-modal-trigger is-text is-link" data-target="modal-feedback" data-i18n="give-feedback">
|
<a class="js-modal-trigger is-text is-link" data-target="modal-feedback"
|
||||||
|
data-i18n="give-feedback">
|
||||||
Feedback geben
|
Feedback geben
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -280,14 +281,26 @@
|
|||||||
<button class="delete" aria-label="close"></button>
|
<button class="delete" aria-label="close"></button>
|
||||||
</header>
|
</header>
|
||||||
<div class="modal-card-body">
|
<div class="modal-card-body">
|
||||||
|
<h1 class="title" data-i18n="sus-title">Bewerte den Rechner</h1>
|
||||||
|
<p class="is-spaced mb-4" data-i18n="explanation-feedback"></p>
|
||||||
|
<form id="sus-form">
|
||||||
|
<!--- Questions here --->
|
||||||
|
<div class="control" id="sus-control">
|
||||||
|
<button class="button is-primary is-fullwidth" type="submit" data-i18n="submit">Absenden</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<div id="response-message" class="notification is-hidden mt-3"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="modal-card-foot">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Wir freuen uns sehr, wenn du uns Feedback zu unserem Rattenrechner gibst!
|
Der Code dieser Website ist <a href="https://codeberg.org/moanos/rettenrechner">öffentlich
|
||||||
Der einfachste Weg das zu tun ist per E-Mail an <a
|
einsehbar.</a>
|
||||||
href="mailto:webmaster@vdrd.de">webmaster@vdrd.de</a>.
|
Gerne kannst du auch direkt dort <a href="https://codeberg.org/moanos/rettenrechner/issues">einen
|
||||||
</p>
|
Issue</a> eröffnen!
|
||||||
<p>
|
|
||||||
Der Code dieser Website ist <a href="https://codeberg.org/moanos/rettenrechner">öffentlich einsehbar.</a>
|
|
||||||
Gerne kannst du auch direkt dort <a href="https://codeberg.org/moanos/rettenrechner/issues">einen Issue</a> eröffnen!
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -30,7 +30,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Add a click event on various child elements to close the parent modal
|
// Add a click event on various child elements to close the parent modal
|
||||||
(document.querySelectorAll('.modal-background, .modal-close, .delete, .button') || []).forEach(($close) => {
|
(document.querySelectorAll('.modal-background, .modal-close, .delete') || []).forEach(($close) => {
|
||||||
const $target = $close.closest('.modal');
|
const $target = $close.closest('.modal');
|
||||||
|
|
||||||
$close.addEventListener('click', () => {
|
$close.addEventListener('click', () => {
|
||||||
|
@@ -8,6 +8,7 @@ import '@fortawesome/fontawesome-free/js/brands';
|
|||||||
import './feedback.js';
|
import './feedback.js';
|
||||||
import './main.scss';
|
import './main.scss';
|
||||||
import {send} from './telemetry';
|
import {send} from './telemetry';
|
||||||
|
import './sus.js';
|
||||||
|
|
||||||
/////////////////
|
/////////////////
|
||||||
// TRANSLATION //
|
// TRANSLATION //
|
||||||
@@ -20,7 +21,7 @@ async function initI18next() {
|
|||||||
.init({
|
.init({
|
||||||
supportedLngs: ["en", "de"],
|
supportedLngs: ["en", "de"],
|
||||||
nonExplicitSupportedLngs: true,
|
nonExplicitSupportedLngs: true,
|
||||||
fallbackLng: "en",
|
fallbackLng: "de",
|
||||||
debug: true,
|
debug: true,
|
||||||
backend: {
|
backend: {
|
||||||
loadPath: "/i18n/{{lng}}.json",
|
loadPath: "/i18n/{{lng}}.json",
|
||||||
|
@@ -148,3 +148,17 @@ Reused from Notfellchen
|
|||||||
.tooltip:not(.top) .tooltiptext::before {
|
.tooltip:not(.top) .tooltiptext::before {
|
||||||
top: auto;
|
top: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// SUS Slider
|
||||||
|
|
||||||
|
.sus-slider {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider-labels {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
}
|
107
src/sus.js
Normal file
107
src/sus.js
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
|
const scaleQuestions = [
|
||||||
|
"sus-question-easy-to-use", // I thought CageCalc is easy to use
|
||||||
|
"sus-question-unnecessarily-complex", // I find CageCalc unnecessarily complex
|
||||||
|
"sus-question-need-support-of-technical-person", // I think that I need the support of a technical person to be able to use CageCalc
|
||||||
|
"sus-question-well-integrated", // I found various functions in CageCalc were well integrated
|
||||||
|
"sus-question-inconsistency", // I thought there was too much inconsistency in CageCalc
|
||||||
|
"sus-question-learn-quickly", // I would imagine that most people would learn to use CageCalc very quickly
|
||||||
|
"sus-question-cumbersome", // I found CageCalc very cumbersome to use
|
||||||
|
"sus-question-confident", // I felt very confident using CageCalc
|
||||||
|
"sus-question-trust", // I felt very confident using CageCalc
|
||||||
|
];
|
||||||
|
|
||||||
|
const freetextQuestions = [
|
||||||
|
"question-whats-missing", // Welche Funktion fehlt dir?
|
||||||
|
"question-pain-points", // Was muss aus deiner Sicht an XX geändert werden?
|
||||||
|
"question-other-feedback" // Was willst du uns mitgeben?
|
||||||
|
]
|
||||||
|
|
||||||
|
function prepareQuestionnaire() {
|
||||||
|
const form = document.getElementById("sus-form");
|
||||||
|
|
||||||
|
scaleQuestions.forEach((key, index) => {
|
||||||
|
const field = document.createElement("div");
|
||||||
|
field.className = "field";
|
||||||
|
field.id = key;
|
||||||
|
field.innerHTML = `
|
||||||
|
<label class="label" data-i18n="dynamic.${key}"></label>
|
||||||
|
<p class="control">
|
||||||
|
<input class="sus-slider" type="range" min="1" max="5" step="1" name=${key} required>
|
||||||
|
<div class="slider-labels">
|
||||||
|
<span data-i18n="strongly-disagree">${i18next.t('strongly-disagree')}</span>
|
||||||
|
<span data-i18n="strongly-agree">${i18next.t('strongly-agree')}</span>
|
||||||
|
</div>
|
||||||
|
</p>
|
||||||
|
`;
|
||||||
|
form.insertBefore(field, form.querySelector('#sus-control'));
|
||||||
|
});
|
||||||
|
|
||||||
|
freetextQuestions.forEach((key, index) => {
|
||||||
|
const field = document.createElement("div");
|
||||||
|
field.classList.add("field");
|
||||||
|
field.id = key;
|
||||||
|
field.innerHTML = `
|
||||||
|
<label class="label" data-i18n="dynamic.${key}"></label>
|
||||||
|
<p class="control">
|
||||||
|
<input class="input" type="text" name=${key}/>
|
||||||
|
</p>
|
||||||
|
`
|
||||||
|
form.insertBefore(field, form.querySelector('#sus-control'));
|
||||||
|
})
|
||||||
|
return form;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener('DOMContentLoaded', () => {
|
||||||
|
let form = prepareQuestionnaire();
|
||||||
|
form.addEventListener("submit", async (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
const formData = new FormData(form);
|
||||||
|
const jsonData = {};
|
||||||
|
|
||||||
|
for (let [key, value] of formData.entries()) {
|
||||||
|
if (key.startsWith("sws-question")) {
|
||||||
|
jsonData[key] = parseInt(value, 10);
|
||||||
|
} else {
|
||||||
|
jsonData[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch("https://storandom.hyteck.de/submit", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
},
|
||||||
|
body: JSON.stringify(jsonData)
|
||||||
|
});
|
||||||
|
|
||||||
|
const messageDiv = document.getElementById("response-message");
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
messageDiv.classList.add("is-success");
|
||||||
|
messageDiv.innerHTML = i18next.t("submit-success");
|
||||||
|
} else {
|
||||||
|
messageDiv.classList.add("is-danger");
|
||||||
|
messageDiv.innerHTML = i18next.t("submit-error");
|
||||||
|
}
|
||||||
|
|
||||||
|
messageDiv.classList.remove("is-hidden");
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
const messageDiv = document.getElementById("response-message");
|
||||||
|
messageDiv.classList.add("is-danger");
|
||||||
|
messageDiv.removeAttribute("data-i18n");
|
||||||
|
messageDiv.setAttribute("data-i18n", "");
|
||||||
|
messageDiv.innerHTML = i18next.t("network-error");
|
||||||
|
let errorP = document.createElement("p");
|
||||||
|
errorP.className = "error";
|
||||||
|
errorP.innerText = error;
|
||||||
|
messageDiv.appendChild(errorP);
|
||||||
|
messageDiv.classList.remove("is-hidden");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
Reference in New Issue
Block a user