From 876697bdff7e03d98a7a426895b4e5dcc07c5a88 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 11 Jul 2026 00:53:53 +0200 Subject: Style admin pagination widget, add missing locale keys Pagination had almost no styling, and its current-page selector never matched will_paginate's actual markup. Added chip-style page links, a solid current-page indicator, and distinct disabled states for Previous/Next. Previous/Next/gap rendered as empty, unlabeled elements -- will_paginate only ships English translations and this app defaults to German. Added previous_label/next_label/page_gap to en.yml and de.yml. --- config/locales/de.yml | 9 +++++++++ config/locales/en.yml | 9 +++++++++ public/stylesheets/admin.css | 42 +++++++++++++++++++++++++++++++++++++++++- script12.rb | 23 +++++++++++++++++++++++ 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 script12.rb diff --git a/config/locales/de.yml b/config/locales/de.yml index 2f08984..1f2222c 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -133,3 +133,12 @@ de: less_than_or_equal_to: "must be less than or equal to {{count}}" odd: "must be odd" even: "must be even" + + will_paginate: + previous_label: "← Zurück" + previous_aria_label: "Vorherige Seite" + next_label: "Weiter →" + next_aria_label: "Nächste Seite" + page_gap: "…" + container_aria_label: "Seitennavigation" + page_aria_label: "Seite %{page}" diff --git a/config/locales/en.yml b/config/locales/en.yml index 980a6b8..59c7304 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -19,3 +19,12 @@ en: time: formats: ccc: "%d %B, %Y %H:%M" + + will_paginate: + previous_label: "← Previous" + previous_aria_label: "Previous page" + next_label: "Next →" + next_aria_label: "Next page" + page_gap: "…" + container_aria_label: "Pagination" + page_aria_label: "Page %{page}" diff --git a/public/stylesheets/admin.css b/public/stylesheets/admin.css index 4723f50..28b8494 100644 --- a/public/stylesheets/admin.css +++ b/public/stylesheets/admin.css @@ -240,12 +240,52 @@ span.warning a { div.pagination { padding-top: 5px; padding-bottom: 15px; + display: flex; + align-items: center; + gap: 0.35rem; +} + +div.pagination a, +div.pagination em.current, +div.pagination span.gap { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 1.75rem; + height: 1.75rem; + padding: 0 0.4rem; + border-radius: 4px; + font-style: normal; +} + +div.pagination a { + text-decoration: underline; + text-decoration-style: wavy; + text-decoration-color: #b0b0b0; + text-decoration-thickness: 1px; + text-underline-offset: 2px; } -div.pagination span.current, div.pagination a:hover { +div.pagination a:hover { color: #ff9600; } +div.pagination em.current { + background-color: #ff9600; + color: #ffffff; + font-weight: bold; +} + +div.pagination span.gap { + color: #969696; +} + +div.pagination .previous_page.disabled, +div.pagination .next_page.disabled { + color: #969696; + cursor: not-allowed; +} + /* ============================================================ Buttons ============================================================ */ diff --git a/script12.rb b/script12.rb new file mode 100644 index 0000000..659557c --- /dev/null +++ b/script12.rb @@ -0,0 +1,23 @@ +require 'timeout' + +a = Node.root.children.create!(:slug => "cycle_test_a") +b = a.children.create!(:slug => "cycle_test_b") + +a.staged_parent_id = b.id +a.publish_draft! +a.reload + +puts "a.parent_id after staging a under its own child b: #{a.parent_id.inspect} (b.id = #{b.id})" +puts "Node.valid? => #{Node.valid?}" + +begin + Timeout.timeout(3) { puts "a.level => #{a.level}" } +rescue Timeout::Error + puts "TIMED OUT after 3s -- a real cycle and a real infinite loop, confirmed" +end + +# Break any cycle before cleanup -- delete_descendants does its own BFS +# the same way #level does, and would hang on a real cycle too. +Node.where(id: a.id).update_all(parent_id: nil) +b.destroy +a.destroy -- cgit v1.3