Add a "Back" button the public subscription/message page.

On a successful form submission, error message etc., check if there's
browser history and render a button that takes the user back to
a meaningful origin from the dead-end message page.

Closes #527.
This commit is contained in:
Kailash Nadh 2021-10-23 11:39:39 +05:30
parent bc9252f410
commit b163b1305b
15 changed files with 34 additions and 0 deletions

View file

@ -111,6 +111,7 @@
"forms.title": "Formuláře",
"globals.buttons.add": "Přidat",
"globals.buttons.addNew": "Přidat nový",
"globals.buttons.back": "Back",
"globals.buttons.cancel": "Zrušit",
"globals.buttons.clone": "Klonovat",
"globals.buttons.close": "Zavřít",

View file

@ -111,6 +111,7 @@
"forms.title": "Formulare",
"globals.buttons.add": "Hinzufügen",
"globals.buttons.addNew": "Neu hinzufügen",
"globals.buttons.back": "Back",
"globals.buttons.cancel": "Abbrechen",
"globals.buttons.clone": "Duplizieren",
"globals.buttons.close": "Schließen",

View file

@ -111,6 +111,7 @@
"forms.title": "Forms",
"globals.buttons.add": "Add",
"globals.buttons.addNew": "Add new",
"globals.buttons.back": "Back",
"globals.buttons.cancel": "Cancel",
"globals.buttons.clone": "Clone",
"globals.buttons.close": "Close",

View file

@ -111,6 +111,7 @@
"forms.title": "Formularios",
"globals.buttons.add": "Agregar",
"globals.buttons.addNew": "Agregar nuevo",
"globals.buttons.back": "Back",
"globals.buttons.cancel": "Cancelar",
"globals.buttons.clone": "Clonar",
"globals.buttons.close": "Cerrar",

View file

@ -111,6 +111,7 @@
"forms.title": "Formulaires",
"globals.buttons.add": "Ajouter",
"globals.buttons.addNew": "Ajouter",
"globals.buttons.back": "Back",
"globals.buttons.cancel": "Annuler",
"globals.buttons.clone": "Cloner",
"globals.buttons.close": "Fermer",

View file

@ -111,6 +111,7 @@
"forms.title": "Formulari",
"globals.buttons.add": "Aggiungi",
"globals.buttons.addNew": "Aggiungi nuovo",
"globals.buttons.back": "Back",
"globals.buttons.cancel": "Annulla",
"globals.buttons.clone": "Clona",
"globals.buttons.close": "Chiudi",

View file

@ -111,6 +111,7 @@
"forms.title": "ഫോമുകൾ",
"globals.buttons.add": "ചേർക്കുക",
"globals.buttons.addNew": "പുതിയത് ചേർക്കുക",
"globals.buttons.back": "Back",
"globals.buttons.cancel": "ഉപേക്ഷിക്കുക",
"globals.buttons.clone": "ക്ലോൺ ചെയ്യുക",
"globals.buttons.close": "അടയ്ക്കുക",

View file

@ -111,6 +111,7 @@
"forms.title": "Formularze",
"globals.buttons.add": "Dodanj",
"globals.buttons.addNew": "Dodaj nowe",
"globals.buttons.back": "Back",
"globals.buttons.cancel": "Anuluj",
"globals.buttons.clone": "Klonuj",
"globals.buttons.close": "Zamknij",

View file

@ -111,6 +111,7 @@
"forms.title": "Formulários",
"globals.buttons.add": "Adicionar",
"globals.buttons.addNew": "Adicionar novo",
"globals.buttons.back": "Back",
"globals.buttons.cancel": "Cancelar",
"globals.buttons.clone": "Clonar",
"globals.buttons.close": "Fechar",

View file

@ -111,6 +111,7 @@
"forms.title": "Formulários",
"globals.buttons.add": "Adicionar",
"globals.buttons.addNew": "Adicionar novo",
"globals.buttons.back": "Back",
"globals.buttons.cancel": "Cancelar",
"globals.buttons.clone": "Duplicar",
"globals.buttons.close": "Fechar",

View file

@ -111,6 +111,7 @@
"forms.title": "Formulare",
"globals.buttons.add": "Adaugă",
"globals.buttons.addNew": "Adaugă nou",
"globals.buttons.back": "Back",
"globals.buttons.cancel": "Anulează",
"globals.buttons.clone": "Clonează",
"globals.buttons.close": "Închide",

View file

@ -111,6 +111,7 @@
"forms.title": "Формы",
"globals.buttons.add": "Добавить",
"globals.buttons.addNew": "Добавить",
"globals.buttons.back": "Back",
"globals.buttons.cancel": "Отменить",
"globals.buttons.clone": "Клонировать",
"globals.buttons.close": "Закрыть",

View file

@ -111,6 +111,7 @@
"forms.title": "Formlar",
"globals.buttons.add": "Ekle",
"globals.buttons.addNew": "Ekle yeni",
"globals.buttons.back": "Back",
"globals.buttons.cancel": "İptal",
"globals.buttons.clone": "Klonla",
"globals.buttons.close": "Kapat",

View file

@ -116,6 +116,10 @@ input[type="text"], input[type="email"], select {
display: none;
}
#btn-back {
display: none;
}
footer.container {
margin-top: 15px;
text-align: center;

View file

@ -6,5 +6,22 @@
{{ .Data.Message }}
</div>
<p>
<a href="" class="button" id="btn-back">{{ L.T "globals.buttons.back" }}</a>
</p>
<script>
(function() {
// If there's page history to go back to, show the back button.
if(history && history.length >= 2) {
var btn = document.getElementById("btn-back");
btn.style.display = 'inline-block';
btn.onclick = function(e) {
history.go(history.length > 2 ? -2 : -1);
e.preventDefault();
};
}
})();
</script>
{{ template "footer" .}}
{{ end }}