-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
fix: fix formactions template to consider arguments #144
Open
mschoettle
wants to merge
6
commits into
django-crispy-forms:main
Choose a base branch
from
mschoettle:fix-formactions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2caacfe
fix: fix formactions template to consider arguments
mschoettle 3e75dbc
tests: add tests for FormActions
mschoettle 7378045
Apply suggestions from code review
mschoettle b75622a
Merge remote-tracking branch 'origin/main' into fix-formactions
mschoettle 9364c20
Merge remote-tracking branch 'origin/main' into fix-formactions
mschoettle 71b1631
bring back extra field_class div
mschoettle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
11 changes: 4 additions & 7 deletions
11
crispy_bootstrap5/templates/bootstrap5/layout/formactions.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
<div{% if formactions.attrs %} {{ formactions.flat_attrs }}{% endif %} class="mb-3"> | ||
{% if label_class %} | ||
<div class="aab {{ label_class }}"></div> | ||
{% endif %} | ||
|
||
<div class="{{ field_class }}"> | ||
<div | ||
{% if formactions.flat_attrs %}{{ formactions.flat_attrs }}{% endif %} | ||
class="mb-3{% if 'form-horizontal' in form_class %} row{% endif %} {{ formactions.css_class|default:'' }} {{ field_class }}" | ||
{% if formactions.id %} id="{{ formactions.id }}"{% endif %}> | ||
{{ fields_output|safe }} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div | ||
test="formactions-test" | ||
class="mb-3 formactions-test-class field-class" | ||
id="formactions-test-id"> <b>test</b> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we still need to add
field_class
.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.
I applied all the suggestions but then thought after that
field_class
might not be appropriate here: Wouldfield_class
not be applied to each child field ofFormActions
?Consider the following test:
Output:
As per
field.html
the<input>
gets wrapped into a div with CSS classfield-class
.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.
Is
FormActions
used to wrapField
s? The crispy-form docs say...With an example form as per the docs. (please forgive the lack of style on the cancel button).
Main branch:
This patch:
This therefore looks like a visual regression to me.
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.
Thanks! I reverted that change and also brought back the div for
label_class
to be consistent with the other template packs.