Skip to content

Commit

Permalink
Merge pull request #1078 from stveit/htmx-destinations-centre-content
Browse files Browse the repository at this point in the history
Center content of destinations page
  • Loading branch information
stveit authored Jan 14, 2025
2 parents 035e3fd + dc94ea6 commit 73bac64
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.d/1079.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Centre HTMX destination page content.
8 changes: 8 additions & 0 deletions src/argus/htmx/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4377,6 +4377,10 @@ details.collapse summary::-webkit-details-marker {
min-width: fit-content;
}

.max-w-4xl {
max-width: 56rem;
}

.max-w-xs {
max-width: 20rem;
}
Expand Down Expand Up @@ -4445,6 +4449,10 @@ details.collapse summary::-webkit-details-marker {
justify-content: flex-start;
}

.justify-center {
justify-content: center;
}

.justify-between {
justify-content: space-between;
}
Expand Down
2 changes: 1 addition & 1 deletion src/argus/htmx/templates/htmx/destination/_content.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="destination-content">
<div id="destination-content" class="flex flex-col items-center">
{% include "htmx/destination/_create_form.html" %}
{% for error in errors %}<p class="text-error">{{ error }}</p>{% endfor %}
{% include "htmx/destination/_form_list.html" %}
Expand Down
5 changes: 3 additions & 2 deletions src/argus/htmx/templates/htmx/destination/_create_form.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<form hx-post="{% url 'htmx:htmx-create' %}"
hx-trigger="submit"
hx-target="#destination-content">
hx-target="#destination-content"
class="max-w-4xl w-full">
{% csrf_token %}
<fieldset class="p-2 border rounded-box border-primary items-center gap-4 flex items-end">
<fieldset class="p-2 border rounded-box border-primary items-center gap-4 flex items-end justify-center">
<legend class="menu-title">Create destination</legend>
{% for field in create_form %}
<label class="form-control max-w-xs mb-auto">
Expand Down
4 changes: 2 additions & 2 deletions src/argus/htmx/templates/htmx/destination/_form_list.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div id="form-list">
<div id="form-list" class="max-w-4xl w-full">
{% for media, forms in grouped_forms.items %}
<details class="collapse bg-base-200 collapse-arrow" open="">
<summary class="collapse-title text-xl font-medium">{{ media.name }} ({{ forms|length }})</summary>
<div class="collapse-content">
{% for form in forms %}
<div class="flex w-full h-fit items-center">
<div class="flex w-full h-fit items-center justify-center">
{% include "htmx/destination/_edit_form.html" %}
{% include "htmx/destination/_delete_form.html" %}
</div>
Expand Down

0 comments on commit 73bac64

Please sign in to comment.