-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Bootstrap v5 #7411
Open
smithdc1
wants to merge
23
commits into
encode:master
Choose a base branch
from
smithdc1:bootstrap-v5
base: master
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
Bootstrap v5 #7411
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
830f515
Updated static files to BS-v5 & added popper.js
smithdc1 7be17e9
Navbar and top buttons
smithdc1 db22809
Page header
smithdc1 69ba59c
Pagination (numbers.html)
smithdc1 8492841
HTML/Raw data forms
smithdc1 44c9d8f
Changed form-group to mb-3
smithdc1 fc7235e
Horizontal forms
smithdc1 39c22e0
Fixed tests following horizontal form changes
smithdc1 5577d36
Vertical forms
smithdc1 fe7a0cf
Filters
smithdc1 5a5cece
Inline Forms
smithdc1 ec558a4
Admin
smithdc1 a3d9232
Docs
smithdc1 b0c51d8
remove fontawesome
smithdc1 971bca6
Remove duplicate <p> tags
smithdc1 0d1d54d
Used bootstrap5 bundled js
smithdc1 3d156f4
Bump Bootstrap to v5.0.0-beta3
smithdc1 db81b27
Namespaced data attributes
smithdc1 b5bf67d
Changed hide to d-none
smithdc1 d5edf0f
Changed left/right to start/end
smithdc1 cde3503
Fixed dropdown button
smithdc1 a1e9721
Fixed test test_rendering_nested_fields_with_not_mappable_value
smithdc1 8a7ff84
Update rest_framework/templates/rest_framework/base.html
tomchristie 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
16 changes: 7 additions & 9 deletions
16
rest_framework/templates/rest_framework/vertical/checkbox.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,18 +1,16 @@ | ||
<div class="mb-3 {% if field.errors %}has-error{% endif %}"> | ||
<div class="checkbox"> | ||
<label> | ||
<input type="checkbox" name="{{ field.name }}" value="true" {% if field.value %}checked{% endif %}> | ||
{% if field.label %}{{ field.label }}{% endif %} | ||
</label> | ||
</div> | ||
<div class="mb-3"> | ||
<div class="form-check"> | ||
<input class="form-check-input{% if field.errors %} is-invalid{% endif %}" type="checkbox" name="{{ field.name }}" value="true" {% if field.value %}checked{% endif %}> | ||
{% if field.label %}<label class="form-check-label">{{ field.label }}</label>{% endif %} | ||
|
||
{% if field.errors %} | ||
{% for error in field.errors %} | ||
<span class="help-block">{{ error }}</span> | ||
<span class="invalid-feedback">{{ error }}</span> | ||
{% endfor %} | ||
{% endif %} | ||
|
||
{% if field.help_text %} | ||
<span class="help-block">{{ field.help_text|safe }}</span> | ||
<span class="form-text">{{ field.help_text|safe }}</span> | ||
{% endif %} | ||
</div> | ||
</div> |
41 changes: 17 additions & 24 deletions
41
rest_framework/templates/rest_framework/vertical/checkbox_multiple.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,37 +1,30 @@ | ||
{% load rest_framework %} | ||
|
||
<div class="mb-3 {% if field.errors %}has-error{% endif %}"> | ||
<div class="mb-3"> | ||
{% if field.label %} | ||
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label> | ||
<label class="form-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label> | ||
{% endif %} | ||
|
||
{% if style.inline %} | ||
<div> | ||
{% for key, text in field.choices|items %} | ||
<label class="checkbox-inline"> | ||
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}> | ||
{{ text }} | ||
</label> | ||
{% endfor %} | ||
</div> | ||
{% else %} | ||
<div> | ||
{% for key, text in field.choices|items %} | ||
<div class="checkbox"> | ||
<label> | ||
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}> | ||
{{ text }} | ||
</label> | ||
<div class="form-check {% if style.inline %}form-check-inline{% endif %}"> | ||
<input class="form-check-input{% if field.errors %} is-invalid{% endif %}" type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}> | ||
<label class="form-check-label">{{ text }}</label> | ||
</div> | ||
{% endfor %} | ||
{% endif %} | ||
|
||
{% if field.errors %} | ||
{% for error in field.errors %} | ||
<span class="help-block">{{ error }}</span> | ||
{% endfor %} | ||
{% endif %} | ||
{% if field.errors %} | ||
{# A fake input to trigger the error messages as it needs to be after a valid input #} | ||
{# If it's with the last input and it's inline then the error stacks under the last input label #} | ||
{# It has no name so no data will be sent #} | ||
<input type="radio" class="is-invalid" style="display: none"/> | ||
{% for error in field.errors %} | ||
<span class="invalid-feedback">{{ error }}</span> | ||
{% endfor %} | ||
{% endif %} | ||
|
||
{% if field.help_text %} | ||
<span class="help-block">{{ field.help_text|safe }}</span> | ||
<span class="form-text">{{ field.help_text|safe }}</span> | ||
{% endif %} | ||
</div> | ||
</div> |
4 changes: 2 additions & 2 deletions
4
rest_framework/templates/rest_framework/vertical/dict_field.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,7 +1,7 @@ | ||
<div class="mb-3"> | ||
{% if field.label %} | ||
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label> | ||
<label class="form-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label> | ||
{% endif %} | ||
|
||
<p class="form-control-static">Dictionaries are not currently supported in HTML input.</p> | ||
<p class="form-label">Dictionaries are not currently supported in HTML input.</p> | ||
</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
10 changes: 5 additions & 5 deletions
10
rest_framework/templates/rest_framework/vertical/input.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,17 +1,17 @@ | ||
<div class="mb-3 {% if field.errors %}has-error{% endif %}"> | ||
<div class="mb-3"> | ||
{% if field.label %} | ||
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label> | ||
<label class="form-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label> | ||
{% endif %} | ||
|
||
<input name="{{ field.name }}" {% if style.input_type != "file" %}class="form-control"{% endif %} type="{{ style.input_type }}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value is not None %}value="{{ field.value }}"{% endif %} {% if style.autofocus and style.input_type != "hidden" %}autofocus{% endif %}> | ||
<input name="{{ field.name }}" {% if style.input_type != "file" %}class="form-control{% if field.errors %} is-invalid{% endif %}"{% endif %} type="{{ style.input_type }}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value is not None %}value="{{ field.value }}"{% endif %} {% if style.autofocus and style.input_type != "hidden" %}autofocus{% endif %}> | ||
|
||
{% if field.errors %} | ||
{% for error in field.errors %} | ||
<span class="help-block">{{ error }}</span> | ||
<span class="invalid-feedback">{{ error }}</span> | ||
{% endfor %} | ||
{% endif %} | ||
|
||
{% if field.help_text %} | ||
<span class="help-block">{{ field.help_text|safe }}</span> | ||
<span class="form-text">{{ field.help_text|safe }}</span> | ||
{% endif %} | ||
</div> |
4 changes: 2 additions & 2 deletions
4
rest_framework/templates/rest_framework/vertical/list_field.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,7 +1,7 @@ | ||
<div class="mb-3"> | ||
{% if field.label %} | ||
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label> | ||
<label class="form-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label> | ||
{% endif %} | ||
|
||
<p class="form-control-static">Lists are not currently supported in HTML input.</p> | ||
<p class="form-label">Lists are not currently supported in HTML input.</p> | ||
</div> |
6 changes: 2 additions & 4 deletions
6
rest_framework/templates/rest_framework/vertical/list_fieldset.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,7 @@ | ||
<fieldset> | ||
{% if field.label %} | ||
<legend {% if style.hide_label %}class="sr-only"{% endif %}> | ||
{{ field.label }} | ||
</legend> | ||
<label class="form-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label> | ||
{% endif %} | ||
|
||
<p>Lists are not currently supported in HTML input.</p> | ||
<p class="form-label">Lists are not currently supported in HTML input.</p> | ||
</fieldset> |
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
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
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
10 changes: 5 additions & 5 deletions
10
rest_framework/templates/rest_framework/vertical/textarea.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,17 +1,17 @@ | ||
<div class="mb-3 {% if field.errors %}has-error{% endif %}"> | ||
<div class="mb-3"> | ||
{% if field.label %} | ||
<label {% if style.hide_label %}class="sr-only"{% endif %}> | ||
<label class="form-label {% if style.hide_label %}sr-only{% endif %}"> | ||
{{ field.label }} | ||
</label> | ||
{% endif %} | ||
|
||
<textarea name="{{ field.name }}" class="form-control" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if style.rows %}rows="{{ style.rows }}"{% endif %}>{% if field.value %}{{ field.value }}{% endif %}</textarea> | ||
<textarea name="{{ field.name }}" class="form-control{% if field.errors %} is-invalid{% endif %}" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if style.rows %}rows="{{ style.rows }}"{% endif %}>{% if field.value %}{{ field.value }}{% endif %}</textarea> | ||
|
||
{% if field.errors %} | ||
{% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %} | ||
{% for error in field.errors %}<span class="invalid-feedback">{{ error }}</span>{% endfor %} | ||
{% endif %} | ||
|
||
{% if field.help_text %} | ||
<span class="help-block">{{ field.help_text|safe }}</span> | ||
<span class="form-text">{{ field.help_text|safe }}</span> | ||
{% endif %} | ||
</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 in Bootstrap 5 .sr-only was removed: https://getbootstrap.com/docs/5.0/getting-started/accessibility/#visually-hidden-content
The reason I am noticing this is because when I set hide_label to True in my serializer field I saw the class is added but when I looked in the CSS it was not there.
So anywhere in any of the forms it uses .sr-only which I think is a lot of templates would have to swap out to the v5 class.