Fix: services pagination. Fix: login/signup auto-redirect to homepage if already logged in

This commit is contained in:
hyzen
2026-06-09 12:02:55 +05:30
parent 4094266e78
commit 9fdcfdd885
8 changed files with 25 additions and 42 deletions

View File

@@ -100,9 +100,6 @@
'auth-message auth-message--success';
document.getElementById('auth-message').style.display = 'block';
document.getElementById('login-form').style.display = 'none';
setTimeout(function () {
window.location.href = '/';
}, 1500);
return;
}
@@ -130,6 +127,7 @@
var submitBtn = document.getElementById('login-submit');
var eyeBtn = form.querySelector('.auth-form__eye');
var pwdInput = document.getElementById('login-password');
var pwdInput = document.getElementById('login-password');
eyeBtn.addEventListener('click', function () {
var isText = pwdInput.type === 'text';

View File

@@ -1,33 +1,22 @@
{{ define "main" }}
<nav class="uninotes-breadcrumbs breadcrumbs">
<a href="/services/">Services</a>
<span>{{ .Title }}</span>
<a href="/services/">Services</a>
<span>{{ .Title }}</span>
</nav>
<h1>{{ .Title }}</h1>
{{ .Content }}
{{/* Prev/next among sibling services */}}
{{ $allPages := .CurrentSection.Pages.ByTitle }}
{{ $currentTitle := .Title }}
{{ $currentIdx := 0 }}
{{ range $i, $p := $allPages }}
{{ if eq $p.Title $currentTitle }}{{ $currentIdx = $i }}{{ end }}
{{ end }}
{{ if gt (len $allPages) 1 }}
{{ .Content }} {{/* Prev/next among sibling services */}} {{ $allPages :=
.CurrentSection.Pages.ByWeight }} {{ $currentTitle := .Title }} {{ $currentIdx := 0 }} {{ range $i,
$p := $allPages }} {{ if eq $p.Title $currentTitle }}{{ $currentIdx = $i }}{{ end }} {{ end }} {{ if
gt (len $allPages) 1 }}
<nav class="page-nav">
{{ if gt $currentIdx 0 }}
{{ $prev := index $allPages (sub $currentIdx 1) }}
<a class="page-nav__previous-link" href="{{ $prev.RelPermalink }}">← {{ $prev.LinkTitle }}</a>
{{ end }}
{{ if lt $currentIdx (sub (len $allPages) 1) }}
{{ $next := index $allPages (add $currentIdx 1) }}
<a class="page-nav__next-link" href="{{ $next.RelPermalink }}">{{ $next.LinkTitle }} →</a>
{{ end }}
{{ if gt $currentIdx 0 }} {{ $prev := index $allPages (sub $currentIdx 1) }}
<a class="page-nav__previous-link" href="{{ $prev.RelPermalink }}">← {{ $prev.LinkTitle }}</a>
{{ end }} {{ if lt $currentIdx (sub (len $allPages) 1) }} {{ $next := index $allPages (add
$currentIdx 1) }}
<a class="page-nav__next-link" href="{{ $next.RelPermalink }}">{{ $next.LinkTitle }} →</a>
{{ end }}
</nav>
{{ end }}
{{ end }}
{{ end }} {{ end }}

View File

@@ -183,9 +183,6 @@
'auth-message auth-message--success';
document.getElementById('auth-message').style.display = 'block';
document.getElementById('signup-form').style.display = 'none';
setTimeout(function () {
window.location.href = '/';
}, 1500);
return;
}
@@ -195,7 +192,6 @@
sessionStorage.getItem('f4_login_next') ||
'';
// Save referrer as next-page if not already set and referrer is on this site
if (!_signupNext && document.referrer) {
try {
var _refUrl = new URL(document.referrer);
@@ -394,11 +390,11 @@
if (data.success) {
showMsg('Account created! Redirecting to login\u2026', 'success');
setTimeout(function () {
window.location.href =
_signupNext && _signupNext.startsWith('/')
? '/login/?next=' + encodeURIComponent(_signupNext)
: '/login/';
window.location.href = '/login/';
var _loginUrl = '/login/';
if (_signupNext && _signupNext.startsWith('/')) {
_loginUrl = '/login/?next=' + encodeURIComponent(_signupNext);
}
window.location.href = _loginUrl;
}, 1800);
} else {
showMsg(data.message || 'Sign-up failed. Please try again.', 'error');