Skip to content
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

Closes #16009 - Added styling to form templates to enable floating button groups #17523

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
2 changes: 1 addition & 1 deletion netbox/project-static/dist/netbox.css

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions netbox/project-static/styles/custom/_misc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,11 @@ span.color-label {
.netbox-edition {
letter-spacing: .15rem;
}

// A floating div for form buttons
.btn-float-group {
position: sticky;
bottom: 0px;
z-index: 1;
padding: 2px 0px 10px 0px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to add a bit more top padding. IMO vertical spacing should be the same above and below the buttons while floating.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went a different direction here. Let me know what you think. Essentially I removed the button group div background altogether, which created truly 'floating' buttons and IMO added more real estate to the form by not covering it up.

NetBox Button Illustration Rev

}
4 changes: 2 additions & 2 deletions netbox/project-static/styles/overrides/_tabler.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pre {
}

// Altering background colors
.page, .page-tabs .nav-tabs .nav-link.active {
.page, .page-tabs .nav-tabs .nav-link.active, .btn-float-group {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to avoid declaring any custom classes here, as this module should be restricted to overrides for Tabler itself. Maybe we can inherit the background color from .page?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been moved to custom/_misc.scss. Inheriting from .page proved to be problematic as the class inherited many undesirable attributes.

background-color: var(--#{$prefix}bg-surface-tertiary) !important;
}
.page-body .card .card-header {
Expand Down Expand Up @@ -105,7 +105,7 @@ body[data-bs-theme=dark] {
.navbar, .page-header {
background-color: $rich-black;
}
.page, .page-tabs .nav-tabs .nav-link.active {
.page, .page-tabs .nav-tabs .nav-link.active, .btn-float-group {
background-color: $rich-black-light !important;
}

Expand Down
2 changes: 1 addition & 1 deletion netbox/templates/generic/bulk_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ <h2 class="col-9 offset-3">{% trans "Comments" %}</h2>

{% endif %}

<div class="text-end">
<div class="text-end btn-float-group">
<a href="{{ return_url }}" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
<button type="submit" name="_apply" class="btn btn-primary">{% trans "Apply" %}</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion netbox/templates/generic/object_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
{% endblock form %}
</div>

<div class="text-end my-3">
<div class="text-end my-3 btn-float-group">
{% block buttons %}
<a href="{{ return_url }}" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
{% if object.pk %}
Expand Down
2 changes: 1 addition & 1 deletion netbox/templates/inc/filter_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</div>
{% endif %}
</div>
<div class="card-footer text-end d-print-none border-0">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to move these buttons outside of the card for consistency with other floating button groups. (Also, the background color is off.)

screenshot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done

<div class="card-footer text-end btn-float-group d-print-none border-0">
<button type="button" class="btn btn-outline-danger m-1" data-reset-select>
<i class="mdi mdi-backspace"></i> {% trans "Reset" %}
</button>
Expand Down