#6372: Improve form field styles

This commit is contained in:
checktheroads 2021-07-20 01:26:45 -07:00
parent 09066a4c6c
commit f671b7e5e2
8 changed files with 55 additions and 44 deletions

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -628,8 +628,10 @@ pre {
.card-header + .card-body { .card-header + .card-body {
padding-top: 0; padding-top: 0;
} }
.card-body {
overflow-x: auto; .card-body.small .form-control,
.card-body.small .form-select {
font-size: $input-font-size-sm;
} }
} }

View File

@ -60,7 +60,6 @@ $spacing-s: $input-padding-x;
div.ss-multi-selected .ss-values .ss-disabled, div.ss-multi-selected .ss-values .ss-disabled,
div.ss-single-selected span.placeholder .ss-disabled { div.ss-single-selected span.placeholder .ss-disabled {
color: var(--nbx-select-placeholder-color); color: var(--nbx-select-placeholder-color);
font-size: $form-select-font-size;
} }
.ss-single-selected { .ss-single-selected {

View File

@ -7,12 +7,15 @@
{% block content %} {% block content %}
<form action="" method="post" class="form form-horizontal"> <form action="" method="post" class="form form-horizontal">
{% csrf_token %} {% csrf_token %}
{% if request.POST.return_url %} {% if request.POST.return_url %}
<input type="hidden" name="return_url" value="{{ request.POST.return_url }}" /> <input type="hidden" name="return_url" value="{{ request.POST.return_url }}" />
{% endif %} {% endif %}
{% for field in form.hidden_fields %} {% for field in form.hidden_fields %}
{{ field }} {{ field }}
{% endfor %} {% endfor %}
<div class="row mb-3"> <div class="row mb-3">
<div class="col col-md-8"> <div class="col col-md-8">
{% include 'inc/table.html' %} {% include 'inc/table.html' %}
@ -20,7 +23,7 @@
<div class="col col-md-4"> <div class="col col-md-4">
<div class="card"> <div class="card">
<h5 class="card-header">{% block form_title %}Attributes{% endblock %}</h5> <h5 class="card-header">{% block form_title %}Attributes{% endblock %}</h5>
<div class="card-body"> <div class="card-body small">
{% for field in form.visible_fields %} {% for field in form.visible_fields %}
{% if field.name in form.nullable_fields %} {% if field.name in form.nullable_fields %}
{% render_field field bulk_nullable=True %} {% render_field field bulk_nullable=True %}
@ -30,12 +33,12 @@
{% endfor %} {% endfor %}
</div> </div>
<div class="card-footer text-end"> <div class="card-footer text-end">
<a href="{{ return_url }}" class="btn btn-outline-danger">Cancel</a> <a href="{{ return_url }}" class="btn btn-sm btn-outline-danger">Cancel</a>
<button type="submit" name="_apply" class="btn btn-primary">Apply</button> <button type="submit" name="_apply" class="btn btn-sm btn-primary">Apply</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
{% endblock content %} {% endblock content %}

View File

@ -2,34 +2,40 @@
{% load helpers %} {% load helpers %}
{% if field|widget_type == 'checkboxinput' %} {% if field|widget_type == 'checkboxinput' %}
<div class="mb-3"> <div class="row mb-3">
<div class="form-check{% if field.errors %} has-error{% endif %}"> <div class="col">
{{ field }} <div class="form-check{% if field.errors %} has-error{% endif %}">
<label for="{{ field.id_for_label }}" class="form-check-label"> {{ field }}
{{ field.label }} <label for="{{ field.id_for_label }}" class="form-check-label">
</label> {{ field.label }}
</label>
</div>
{% if field.help_text %}
<span class="form-text">{{ field.help_text|safe }}</span>
{% endif %}
{% if bulk_nullable %}
<div class="form-check my-1">
<input type="checkbox" class="form-check-input" name="_nullify" value="{{ field.name }}" />
<label class="form-check-label">Set Null</label>
</div>
{% endif %}
</div> </div>
{% if field.help_text %}
<span class="form-text">{{ field.help_text|safe }}</span>
{% endif %}
{% if bulk_nullable %}
<label class="form-check-label">
<input class="form-check-input" type="checkbox" name="_nullify" value="{{ field.name }}" /> Set null
</label>
{% endif %}
</div> </div>
{% elif field|widget_type == 'textarea' and not field.label %} {% elif field|widget_type == 'textarea' and not field.label %}
<div class="mb-3"> <div class="row mb-3">
{{ field }} <div class="col">
{% if bulk_nullable %} {{ field }}
<label class="checkbox-inline"> {% if field.help_text %}
<input type="checkbox" name="_nullify" value="{{ field.name }}" /> Set null <span class="form-text">{{ field.help_text|safe }}</span>
</label> {% endif %}
{% endif %} {% if bulk_nullable %}
{% if field.help_text %} <div class="form-check my-1">
<span class="form-text">{{ field.help_text|safe }}</span> <input type="checkbox" class="form-check-input" name="_nullify" value="{{ field.name }}" />
{% endif %} <label class="form-check-label">Set Null</label>
</div>
{% endif %}
</div>
</div> </div>
{% elif field|widget_type == 'slugwidget' %} {% elif field|widget_type == 'slugwidget' %}
@ -94,6 +100,12 @@
</label> </label>
<div class="col col-md-9"> <div class="col col-md-9">
{{ field }} {{ field }}
{% if bulk_nullable %}
<div class="form-check my-1">
<input type="checkbox" class="form-check-input" name="_nullify" value="{{ field.name }}" />
<label class="form-check-label">Set Null</label>
</div>
{% endif %}
</div> </div>
</div> </div>
@ -112,18 +124,13 @@
<strong>{{ field.label }}</strong> field is required. <strong>{{ field.label }}</strong> field is required.
{% endif %} {% endif %}
</div> </div>
{% if bulk_nullable %}
<div class="form-check my-1">
<input type="checkbox" class="form-check-input" name="_nullify" value="{{ field.name }}" />
<label class="form-check-label">Set Null</label>
</div>
{% endif %}
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% if bulk_nullable %}
<div class="form-check">
<input type="checkbox" class="form-check-input" name="_nullify" value="{{ field.name }}" />
<label class="form-check-label">Set Null</label>
</div>
{% if field.help_text %}
<span class="form-text">{{ field.help_text|safe }}</span>
{% endif %}
{% endif %}