FossilRepo

Fix wiki search rendering full page into itself — return partial on HTMX requests

ragelink 2026-04-14 05:17 UTC trunk
Commit 37e1f33696615a4cc204e2f1b0f45095af4d2bd14c518f11e2d6ca3970fbf4b9
+1 -1
--- fossil/views.py
+++ fossil/views.py
@@ -870,11 +870,11 @@
870870
"per_page_options": PER_PAGE_OPTIONS,
871871
"active_tab": "wiki",
872872
}
873873
874874
if request.headers.get("HX-Request"):
875
- return render(request, "fossil/wiki_list.html", ctx)
875
+ return render(request, "fossil/partials/wiki_list_content.html", ctx)
876876
877877
return render(request, "fossil/wiki_list.html", ctx)
878878
879879
880880
def wiki_page(request, slug, page_name):
881881
--- fossil/views.py
+++ fossil/views.py
@@ -870,11 +870,11 @@
870 "per_page_options": PER_PAGE_OPTIONS,
871 "active_tab": "wiki",
872 }
873
874 if request.headers.get("HX-Request"):
875 return render(request, "fossil/wiki_list.html", ctx)
876
877 return render(request, "fossil/wiki_list.html", ctx)
878
879
880 def wiki_page(request, slug, page_name):
881
--- fossil/views.py
+++ fossil/views.py
@@ -870,11 +870,11 @@
870 "per_page_options": PER_PAGE_OPTIONS,
871 "active_tab": "wiki",
872 }
873
874 if request.headers.get("HX-Request"):
875 return render(request, "fossil/partials/wiki_list_content.html", ctx)
876
877 return render(request, "fossil/wiki_list.html", ctx)
878
879
880 def wiki_page(request, slug, page_name):
881
--- templates/fossil/wiki_list.html
+++ templates/fossil/wiki_list.html
@@ -27,54 +27,8 @@
2727
<a href="{% url 'fossil:wiki_create' slug=project.slug %}" class="inline-flex items-center rounded-md bg-brand px-3 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover focus:outline-none focus:ring-2 focus:ring-brand focus:ring-offset-2 focus:ring-offset-gray-950 transition-colors">New Page</a>
2828
{% endif %}
2929
</div>
3030
3131
<div id="wiki-content">
32
-<div class="flex gap-6">
33
- <!-- Main content: home page or page index -->
34
- <div class="flex-1 min-w-0">
35
- {% if home_page and not search %}
36
- <div class="overflow-hidden rounded-lg bg-gray-800 shadow-sm border border-gray-700">
37
- <div class="px-6 py-4 border-b border-gray-700">
38
- <h2 class="text-lg font-semibold text-gray-100">{{ home_page.name }}</h2>
39
- </div>
40
- <div class="px-6 py-6">
41
- <div class="prose prose-invert prose-gray max-w-none">
42
- {{ home_content_html }}
43
- </div>
44
- </div>
45
- </div>
46
- {% elif not pages %}
47
- <div class="rounded-lg bg-gray-800 border border-gray-700 p-8 text-center">
48
- <p class="text-sm text-gray-500">{% if search %}No wiki pages matching "{{ search }}".{% else %}No wiki pages yet. Create a "Home" page to get started.{% endif %}</p>
49
- </div>
50
- {% endif %}
51
- </div>
52
-
53
- <!-- Right sidebar: all pages -->
54
- <aside class="hidden lg:block w-52 flex-shrink-0">
55
- <div class="sticky top-6">
56
- <h3 class="text-xs font-semibold uppercase tracking-wider text-gray-500 mb-3">Wiki Pages</h3>
57
- <nav class="space-y-0.5">
58
- {% for p in pages %}
59
- <a href="{% url 'fossil:wiki_page' slug=project.slug page_name=p.name %}"
60
- class="block rounded-md px-3 py-1.5 text-sm {% if p.name == 'Home' %}text-brand-light font-medium{% else %}text-gray-400{% endif %} hover:text-gray-200 hover:bg-gray-800/50">
61
- {% if p.name == "Home" %}
62
- <span class="flex items-center gap-1.5">
63
- <svg class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12l8.954-8.955a1.126 1.126 0 011.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" /></svg>
64
- {{ p.name }}
65
- </span>
66
- {% else %}
67
- {{ p.name }}
68
- {% endif %}
69
- </a>
70
- {% endfor %}
71
- </nav>
72
- {% if not pages %}
73
- <p class="text-xs text-gray-600 px-3">No pages.</p>
74
- {% endif %}
75
- </div>
76
- </aside>
77
-</div>
78
-{% include "includes/_pagination_manual.html" %}
32
+{% include "fossil/partials/wiki_list_content.html" %}
7933
</div>
8034
{% endblock %}
8135
--- templates/fossil/wiki_list.html
+++ templates/fossil/wiki_list.html
@@ -27,54 +27,8 @@
27 <a href="{% url 'fossil:wiki_create' slug=project.slug %}" class="inline-flex items-center rounded-md bg-brand px-3 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover focus:outline-none focus:ring-2 focus:ring-brand focus:ring-offset-2 focus:ring-offset-gray-950 transition-colors">New Page</a>
28 {% endif %}
29 </div>
30
31 <div id="wiki-content">
32 <div class="flex gap-6">
33 <!-- Main content: home page or page index -->
34 <div class="flex-1 min-w-0">
35 {% if home_page and not search %}
36 <div class="overflow-hidden rounded-lg bg-gray-800 shadow-sm border border-gray-700">
37 <div class="px-6 py-4 border-b border-gray-700">
38 <h2 class="text-lg font-semibold text-gray-100">{{ home_page.name }}</h2>
39 </div>
40 <div class="px-6 py-6">
41 <div class="prose prose-invert prose-gray max-w-none">
42 {{ home_content_html }}
43 </div>
44 </div>
45 </div>
46 {% elif not pages %}
47 <div class="rounded-lg bg-gray-800 border border-gray-700 p-8 text-center">
48 <p class="text-sm text-gray-500">{% if search %}No wiki pages matching "{{ search }}".{% else %}No wiki pages yet. Create a "Home" page to get started.{% endif %}</p>
49 </div>
50 {% endif %}
51 </div>
52
53 <!-- Right sidebar: all pages -->
54 <aside class="hidden lg:block w-52 flex-shrink-0">
55 <div class="sticky top-6">
56 <h3 class="text-xs font-semibold uppercase tracking-wider text-gray-500 mb-3">Wiki Pages</h3>
57 <nav class="space-y-0.5">
58 {% for p in pages %}
59 <a href="{% url 'fossil:wiki_page' slug=project.slug page_name=p.name %}"
60 class="block rounded-md px-3 py-1.5 text-sm {% if p.name == 'Home' %}text-brand-light font-medium{% else %}text-gray-400{% endif %} hover:text-gray-200 hover:bg-gray-800/50">
61 {% if p.name == "Home" %}
62 <span class="flex items-center gap-1.5">
63 <svg class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12l8.954-8.955a1.126 1.126 0 011.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" /></svg>
64 {{ p.name }}
65 </span>
66 {% else %}
67 {{ p.name }}
68 {% endif %}
69 </a>
70 {% endfor %}
71 </nav>
72 {% if not pages %}
73 <p class="text-xs text-gray-600 px-3">No pages.</p>
74 {% endif %}
75 </div>
76 </aside>
77 </div>
78 {% include "includes/_pagination_manual.html" %}
79 </div>
80 {% endblock %}
81
--- templates/fossil/wiki_list.html
+++ templates/fossil/wiki_list.html
@@ -27,54 +27,8 @@
27 <a href="{% url 'fossil:wiki_create' slug=project.slug %}" class="inline-flex items-center rounded-md bg-brand px-3 py-1.5 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover focus:outline-none focus:ring-2 focus:ring-brand focus:ring-offset-2 focus:ring-offset-gray-950 transition-colors">New Page</a>
28 {% endif %}
29 </div>
30
31 <div id="wiki-content">
32 {% include "fossil/partials/wiki_list_content.html" %}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33 </div>
34 {% endblock %}
35

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button