Update web/templates/search.html
This commit is contained in:
parent
0e10a3c930
commit
82f7ce6ed5
@ -59,11 +59,11 @@
|
||||
<!-- ===== History Dropdown ===== -->
|
||||
<div class="card" style="padding:0; margin:16px 0 12px;">
|
||||
<h1 class="page-title dropdown-toggle history-title"
|
||||
data-target="#history-panel"
|
||||
role="button"
|
||||
aria-expanded="false">
|
||||
Search History <span class="chevron">▾</span>
|
||||
</h1>
|
||||
data-target="#history-panel"
|
||||
role="button"
|
||||
aria-expanded="false">
|
||||
Search History <span class="chevron">▾</span>
|
||||
</h1>
|
||||
<div id="history-panel" class="dropdown-panel">
|
||||
<hr style="border:none; border-top:1px solid var(--border); margin:12px 0;">
|
||||
|
||||
@ -116,11 +116,18 @@
|
||||
root.classList.remove('fs-small','fs-default','fs-large','fs-xlarge');
|
||||
root.classList.add('fs-'+size);
|
||||
}
|
||||
fetch("{% url 'api_get_prefs' %}").then(r=>r.json()).then(j=>{
|
||||
if (j.ok) applyFont(j.font_size || 'default');
|
||||
}).catch(()=>{});
|
||||
fetch("{% url 'api_get_prefs' %}", { cache: 'no-store', credentials: 'same-origin' })
|
||||
.then(r=>r.json()).then(j=>{
|
||||
if (j.ok) applyFont(j.font_size || 'default');
|
||||
}).catch(()=>{});
|
||||
|
||||
// Search history (PUT BACK selected-fields subtitle)
|
||||
// Small helper to add a cache-busting param
|
||||
function bust(url){
|
||||
const sep = url.includes('?') ? '&' : '?';
|
||||
return url + sep + 't=' + Date.now();
|
||||
}
|
||||
|
||||
// Search history (keeps selected-fields subtitle)
|
||||
function renderHistory(items){
|
||||
const list = document.getElementById('searchHistoryList');
|
||||
const empty = document.getElementById('searchHistoryEmpty');
|
||||
@ -140,9 +147,13 @@
|
||||
list.appendChild(li);
|
||||
});
|
||||
}
|
||||
fetch("{% url 'api_get_search_history' %}").then(r=>r.json()).then(j=>{
|
||||
if (j.ok) renderHistory(j.items);
|
||||
}).catch(()=>{});
|
||||
fetch(bust("{% url 'api_get_search_history' %}"), {
|
||||
cache: 'no-store',
|
||||
credentials: 'same-origin'
|
||||
})
|
||||
.then(r=>r.json()).then(j=>{
|
||||
if (j.ok) renderHistory(j.items);
|
||||
}).catch(()=>{});
|
||||
|
||||
// Recently viewed
|
||||
function renderRecent(items){
|
||||
@ -163,9 +174,13 @@
|
||||
list.appendChild(li);
|
||||
});
|
||||
}
|
||||
fetch("{% url 'api_get_recent_views' %}").then(r=>r.json()).then(j=>{
|
||||
if (j.ok) renderRecent(j.items);
|
||||
}).catch(()=>{});
|
||||
fetch(bust("{% url 'api_get_recent_views' %}"), {
|
||||
cache: 'no-store',
|
||||
credentials: 'same-origin'
|
||||
})
|
||||
.then(r=>r.json()).then(j=>{
|
||||
if (j.ok) renderRecent(j.items);
|
||||
}).catch(()=>{});
|
||||
|
||||
// Dropdown toggle for History
|
||||
document.querySelectorAll('.dropdown-toggle').forEach(btn=>{
|
||||
@ -224,19 +239,15 @@
|
||||
}
|
||||
.page-title.open .chevron { transform: rotate(180deg); }
|
||||
.dropdown-toggle { cursor:pointer; }
|
||||
</style>
|
||||
|
||||
<style>
|
||||
/* ...keep your existing styles... */
|
||||
|
||||
/* Ensure the history heading keeps the chevron next to the text */
|
||||
/* Keep the chevron next to the text */
|
||||
.history-title{
|
||||
display:inline-flex !important; /* don't stretch full width */
|
||||
display:inline-flex !important;
|
||||
align-items:center;
|
||||
justify-content:flex-start !important;
|
||||
gap:8px; /* space between text and chevron */
|
||||
padding:10px 16px; /* left/right white space */
|
||||
margin:0; /* remove default h1 margin */
|
||||
gap:8px;
|
||||
padding:10px 16px;
|
||||
margin:0;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
Loading…
Reference in New Issue
Block a user