-
-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTMX CSQL Fixture UI #35372
base: master
Are you sure you want to change the base?
HTMX CSQL Fixture UI #35372
Conversation
Looks like a great approach, very smooth and simple. |
<form hx-post="{{ request.path_info }}" | ||
hq-hx-action="save_expression" | ||
hx-swap="outerHTML" | ||
x-data="{ isUnsaved: false }" | ||
@change="isUnsaved = true;" | ||
@submit="isUnsaved = false;"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<form hx-post="{{ request.path_info }}" | |
hq-hx-action="save_expression" | |
hx-swap="outerHTML" | |
x-data="{ isUnsaved: false }" | |
@change="isUnsaved = true;" | |
@submit="isUnsaved = false;"> | |
<form | |
hx-post="{{ request.path_info }}" | |
hq-hx-action="save_expression" | |
hx-swap="outerHTML" | |
x-data="{ isUnsaved: false }" | |
@change="isUnsaved = true;" | |
@submit="isUnsaved = false;" | |
> |
{{ form.csql }} | ||
</div> | ||
<div class="col-2"> | ||
<button type="submit" class="btn btn-outline-primary" x-bind:disabled="!isUnsaved"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<button type="submit" class="btn btn-outline-primary" x-bind:disabled="!isUnsaved"> | |
<button | |
class="btn btn-outline-primary" type="submit" | |
:disabled="!isUnsaved" | |
> |
- I like to always have
class
be the first attribute - if there is a
HTMX
oralpine
attribute (:bind
in this case), we want it on a second line - I prefer shorthand
alpine
bindings, but could be convinced otherwise?
<button class="btn btn-outline-danger" | ||
hx-post="{{ request.path_info }}" | ||
hq-hx-action="delete_expression" | ||
hx-swap="delete" | ||
hx-target="closest form"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<button class="btn btn-outline-danger" | |
hx-post="{{ request.path_info }}" | |
hq-hx-action="delete_expression" | |
hx-swap="delete" | |
hx-target="closest form"> | |
<button | |
class="btn btn-outline-danger" | |
hx-post="{{ request.path_info }}" | |
hq-hx-action="delete_expression" | |
hx-swap="delete" | |
hx-target="closest form" | |
> |
<button type="button" | ||
class="btn btn-default" | ||
hx-post="{{ request.path_info }}" | ||
hq-hx-action="new_expression" | ||
hx-target="#csql-fixture-rows" | ||
hx-swap="beforeend"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<button type="button" | |
class="btn btn-default" | |
hx-post="{{ request.path_info }}" | |
hq-hx-action="new_expression" | |
hx-target="#csql-fixture-rows" | |
hx-swap="beforeend"> | |
<button | |
class="btn btn-default" type="button" | |
hx-post="{{ request.path_info }}" | |
hq-hx-action="new_expression" | |
hx-target="#csql-fixture-rows" | |
hx-swap="beforeend" | |
> |
{% for form in csql_fixture_forms %} | ||
{{ form }} | ||
{% endfor %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this was exactly the approach i was thinking when reviewing the page with @AddisonDunn. Less front end logic being front-loaded from the backend into Alpine, and more on the python side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was super pleased to see how well this plays with Django templates! I'm still not totally sold on the second commit here though - I do think I liked it better before adding Django forms, but if I find the time I might try a compromise - like maybe I make a partial template with the <form>
tags and the buttons, but have the fields themselves rendered by the Django form (at present, I set a custom template on the form, so it contains everything, which sounds nice in principle, but means I lose error handling in the template)
Product Description
Technical Summary
Feature Flag
Safety Assurance
Safety story
Automated test coverage
QA Plan
Migrations
Rollback instructions
Labels & Review