Skip to content

Commit a79e413

Browse files
committed
Basic search page
1 parent 1f46d81 commit a79e413

File tree

4 files changed

+102
-0
lines changed

4 files changed

+102
-0
lines changed

static/css/bs53p.css

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,11 @@ textarea {
423423
height: auto;
424424
}
425425

426+
[type="search"] {
427+
-webkit-appearance: textfield;
428+
outline-offset: -2px;
429+
}
430+
426431
/* rtl:raw:
427432
[type="tel"],
428433
[type="url"],
@@ -718,6 +723,7 @@ textarea.form-control {
718723
outline: 0;
719724
box-shadow: var(--bs-btn-focus-box-shadow);
720725
}
726+
721727
:not(.btn-check) + .btn:active,
722728
.btn:first-child:active,
723729
.btn.active,
@@ -726,6 +732,7 @@ textarea.form-control {
726732
background-color: var(--bs-btn-active-bg);
727733
border-color: var(--bs-btn-active-border-color);
728734
}
735+
729736
:not(.btn-check) + .btn:active:focus-visible,
730737
.btn:first-child:active:focus-visible,
731738
.btn.active:focus-visible,
@@ -884,6 +891,7 @@ textarea.form-control {
884891
outline: 0;
885892
box-shadow: 0 0 0 0.25rem rgba(13, 84, 43, 0.25);
886893
}
894+
887895
.nav-link:disabled {
888896
color: var(--bs-nav-link-disabled-color);
889897
pointer-events: none;
@@ -1083,6 +1091,32 @@ textarea.form-control {
10831091
top: -1px;
10841092
}
10851093

1094+
.alert {
1095+
--bs-alert-bg: transparent;
1096+
--bs-alert-padding-x: 1rem;
1097+
--bs-alert-padding-y: 1rem;
1098+
--bs-alert-margin-bottom: 1rem;
1099+
--bs-alert-color: inherit;
1100+
--bs-alert-border-color: transparent;
1101+
--bs-alert-border: var(--bs-border-width) solid var(--bs-alert-border-color);
1102+
--bs-alert-border-radius: var(--bs-border-radius);
1103+
--bs-alert-link-color: inherit;
1104+
position: relative;
1105+
padding: var(--bs-alert-padding-y) var(--bs-alert-padding-x);
1106+
margin-bottom: var(--bs-alert-margin-bottom);
1107+
color: var(--bs-alert-color);
1108+
background-color: var(--bs-alert-bg);
1109+
border: var(--bs-alert-border);
1110+
border-radius: var(--bs-alert-border-radius);
1111+
}
1112+
1113+
.alert-danger {
1114+
--bs-alert-color: var(--bs-danger-text-emphasis);
1115+
--bs-alert-bg: var(--bs-danger-bg-subtle);
1116+
--bs-alert-border-color: var(--bs-danger-border-subtle);
1117+
--bs-alert-link-color: var(--bs-danger-text-emphasis);
1118+
}
1119+
10861120
@keyframes progress-bar-stripes {
10871121
0% {
10881122
background-position-x: 1rem;
@@ -1285,6 +1319,19 @@ textarea.form-control {
12851319
}
12861320
}
12871321

1322+
.placeholder {
1323+
display: inline-block;
1324+
min-height: 1em;
1325+
vertical-align: middle;
1326+
cursor: wait;
1327+
background-color: currentcolor;
1328+
opacity: 0.5;
1329+
}
1330+
.placeholder.btn::before {
1331+
display: inline-block;
1332+
content: "";
1333+
}
1334+
12881335
@keyframes placeholder-glow {
12891336
50% {
12901337
opacity: 0.2;
@@ -1401,6 +1448,11 @@ textarea.form-control {
14011448
align-items: center !important;
14021449
}
14031450

1451+
.my-3 {
1452+
margin-top: 1rem !important;
1453+
margin-bottom: 1rem !important;
1454+
}
1455+
14041456
.me-0 {
14051457
margin-right: 0 !important;
14061458
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{% extends "_base.html" %}
2+
{% load djpress_tags %}
3+
{% block content %}
4+
<div class="row">
5+
<div class="col col-md-8 pt-3">
6+
{% search_title outer="h3" outer_class="search-heading" pre_text="Search Results for '" post_text="'" %}
7+
{% search_form placeholder="Search posts..." button_text="Search" form_class="search-form" input_class="form-control" button_class="btn btn-primary my-3" %}
8+
{% search_errors error_class="alert alert-danger" %}
9+
{% for post in posts %}
10+
{% post_wrap %}
11+
{% post_title outer_tag="h4" include_empty=True %}
12+
<footer>
13+
<p>Posted on {% post_date %}</p>
14+
</footer>
15+
{% end_post_wrap %}
16+
{% empty %}
17+
{% if search_query %}<p>No posts available.</p>{% endif %}
18+
{% endfor %}
19+
{% is_paginated as paginated %}
20+
{% if paginated %}
21+
{% get_pagination_range as page_range %}
22+
{% get_pagination_current_page as current_page %}
23+
<nav aria-label="Page navigation">
24+
<ul class="pagination">
25+
{% for page in page_range %}
26+
{% if page == current_page %}
27+
<li class="page-item active" aria-current="page">
28+
<a class="page-link" href="?page={{ page }}">{{ page }}</a>
29+
</li>
30+
{% else %}
31+
<li class="page-item">
32+
<a class="page-link" href="?page={{ page }}">{{ page }}</a>
33+
</li>
34+
{% endif %}
35+
{% endfor %}
36+
</ul>
37+
</nav>
38+
{% endif %}
39+
</div>
40+
</div>
41+
{% endblock content %}

templates/snippets/header.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
</a>
2323
</li>
2424
{% endif %}
25+
<li class="nav-item">
26+
<a href="{% search_url %}" class="nav-link icon-link px-sm-2 px-1">
27+
{% include "svg/search.svg" %}
28+
<span class="d-none d-md-inline">Search</span>
29+
</a>
30+
</li>
2531
<li class="nav-item">
2632
<a href="{% url "contact_form:contact_form" %}"
2733
hx-get="{% url 'contact_form:contact_form' %}"

templates/svg/search.svg

Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)