From 7220af6a60bebd9936022cdb942544330f406922 Mon Sep 17 00:00:00 2001 From: Boris Date: Mon, 30 Mar 2026 22:44:13 +0300 Subject: [PATCH] Add mineral search and permalink pages - Search bar toggle in header (magnifying glass icon) - /daily-stone/search/?q= endpoint with results list - /daily-stone/mineral// permalink for each mineral - Mineral count shown in footer Co-Authored-By: Claude Opus 4.6 --- dailystone/templates/dailystone/search.html | 220 ++++++++++++++++++++ dailystone/templates/dailystone/stone.html | 120 ++++++++++- dailystone/urls.py | 2 + dailystone/views.py | 37 +++- 4 files changed, 365 insertions(+), 14 deletions(-) create mode 100644 dailystone/templates/dailystone/search.html diff --git a/dailystone/templates/dailystone/search.html b/dailystone/templates/dailystone/search.html new file mode 100644 index 0000000..4cba2ac --- /dev/null +++ b/dailystone/templates/dailystone/search.html @@ -0,0 +1,220 @@ + + + + + + Search — Daily Stone + + + +
+ +
+ + +
+ + +
+ + {% if results %} +
{{ results|length }} result{{ results|length|pluralize }} for "{{ query }}"
+ + {% else %} +
+

No minerals found for "{{ query }}"

+
+ {% endif %} + + +
+ + diff --git a/dailystone/templates/dailystone/stone.html b/dailystone/templates/dailystone/stone.html index 82f86e5..10d6ccc 100644 --- a/dailystone/templates/dailystone/stone.html +++ b/dailystone/templates/dailystone/stone.html @@ -60,14 +60,90 @@ margin-bottom: 0.25rem; } - .random-btn { + .header-actions { position: absolute; top: 1.5rem; right: 0; + display: flex; + gap: 0.4rem; + align-items: center; + } + + .search-toggle { + display: inline-flex; + align-items: center; + justify-content: center; + width: 34px; + height: 34px; + font-family: 'Georgia', serif; + color: var(--stone-text); + background: var(--stone-muted); + border: 1px solid var(--border); + border-radius: 3px; + text-decoration: none; + cursor: pointer; + transition: background 0.2s; + } + + .search-toggle:hover { + background: color-mix(in srgb, var(--stone-color) 20%, #f5f5f0); + } + + .search-toggle svg { + width: 14px; + height: 14px; + } + + .search-bar { + display: none; + margin: -0.5rem 0 1.5rem; + } + + .search-bar.open { + display: block; + } + + .search-bar form { + display: flex; + gap: 0.4rem; + } + + .search-bar input[type="text"] { + flex: 1; + padding: 0.5rem 0.7rem; + font-family: 'Georgia', serif; + font-size: 0.9rem; + border: 1px solid var(--border); + border-radius: 3px; + background: #fff; + color: var(--text); + outline: none; + } + + .search-bar input[type="text"]:focus { + border-color: var(--stone-color); + } + + .search-bar button { + padding: 0.5rem 0.75rem; + font-family: 'Georgia', serif; + font-size: 0.85rem; + color: var(--stone-text); + background: var(--stone-muted); + border: 1px solid var(--border); + border-radius: 3px; + cursor: pointer; + } + + .search-bar button:hover { + background: color-mix(in srgb, var(--stone-color) 20%, #f5f5f0); + } + + .random-btn { display: inline-flex; align-items: center; gap: 0.35rem; - padding: 0.4rem 0.75rem; + padding: 0.4rem 0.65rem; font-family: 'Georgia', serif; font-size: 0.8rem; color: var(--stone-text); @@ -271,6 +347,13 @@ text-decoration: underline; } + .page-footer .mineral-count { + display: block; + margin-top: 0.5rem; + font-size: 0.75rem; + color: var(--text-secondary); + } + .page-footer .home-link { display: inline-block; margin-top: 1rem; @@ -313,20 +396,34 @@ {% if mineral %} + +