mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-18 05:28:16 -06:00
Refactor 'controls' template block; ditch old classes
This commit is contained in:
parent
5e1e1a9afa
commit
ae399eb6ae
@ -7,45 +7,6 @@
|
|||||||
@import './utilities';
|
@import './utilities';
|
||||||
//@import './variables';
|
//@import './variables';
|
||||||
|
|
||||||
// Object list control buttons (Add/Clone/Import/Export)
|
|
||||||
.controls {
|
|
||||||
margin-bottom: map.get($spacers, 2);
|
|
||||||
|
|
||||||
@media print {
|
|
||||||
// Never print controls. Use this over the .noprint utility so plugin authors don't need to
|
|
||||||
// remember to add the class.
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Each group of buttons.
|
|
||||||
.control-group {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
// Left-align controls on mobile.
|
|
||||||
justify-content: flex-start;
|
|
||||||
|
|
||||||
// Right-align controls on larger screens.
|
|
||||||
@include media-breakpoint-up(lg) {
|
|
||||||
justify-content: flex-end;
|
|
||||||
}
|
|
||||||
|
|
||||||
> * {
|
|
||||||
// Pad each control button.
|
|
||||||
margin: map.get($spacers, 1);
|
|
||||||
|
|
||||||
&:first-child {
|
|
||||||
// Don't pad the left side of the first control button.
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
// Don't pad the right side of the last control button.
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Global Search
|
// Global Search
|
||||||
nav.search {
|
nav.search {
|
||||||
// Don't overtake dropdowns
|
// Don't overtake dropdowns
|
||||||
|
@ -10,23 +10,15 @@
|
|||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block controls %}
|
{% block control-buttons %}
|
||||||
<div class="controls">
|
{% if not object.pk or object.is_active and perms.core.add_configrevision %}
|
||||||
<div class="control-group">
|
{% url 'core:configrevision_add' as edit_url %}
|
||||||
{% plugin_buttons object %}
|
{% include "buttons/edit.html" with url=edit_url %}
|
||||||
{% if not object.pk or object.is_active and perms.core.add_configrevision %}
|
{% endif %}
|
||||||
{% url 'core:configrevision_add' as edit_url %}
|
{% if object.pk and not object.is_active and perms.core.delete_configrevision %}
|
||||||
{% include "buttons/edit.html" with url=edit_url %}
|
{% delete_button object %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if object.pk and not object.is_active and perms.core.delete_configrevision %}
|
{% endblock control-buttons %}
|
||||||
{% delete_button object %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="control-group">
|
|
||||||
{% custom_links object %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock controls %}
|
|
||||||
|
|
||||||
{% block subtitle %}
|
{% block subtitle %}
|
||||||
{% if object.created %}
|
{% if object.created %}
|
||||||
|
@ -13,15 +13,11 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block controls %}
|
{% block control-buttons %}
|
||||||
<div class="controls">
|
{% if request.user|can_delete:job %}
|
||||||
<div class="control-group">
|
{% delete_button job %}
|
||||||
{% if request.user|can_delete:job %}
|
{% endif %}
|
||||||
{% delete_button job %}
|
{% endblock control-buttons %}
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock controls %}
|
|
||||||
|
|
||||||
{% block tabs %}
|
{% block tabs %}
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
@ -59,13 +55,9 @@
|
|||||||
|
|
||||||
<form method="post">
|
<form method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="submit-row" style="margin-top: 20px">
|
<div class="text-end my-3">
|
||||||
<div class="controls">
|
<a href="{% url 'core:configrevision_list' %}" id="cancel" name="cancel" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
|
||||||
<div class="control-group">
|
<button type="submit" name="restore" class="btn btn-primary">{% trans "Restore" %}</button>
|
||||||
<a href="{% url 'core:configrevision_list' %}" id="cancel" name="cancel" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
|
|
||||||
<button type="submit" name="restore" class="btn btn-primary">{% trans "Restore" %}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
@ -11,19 +11,11 @@
|
|||||||
<li class="breadcrumb-item"><a href="{% url 'core:datafile_list' %}?source_id={{ object.source.pk }}">{{ object.source }}</a></li>
|
<li class="breadcrumb-item"><a href="{% url 'core:datafile_list' %}?source_id={{ object.source.pk }}">{{ object.source }}</a></li>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block controls %}
|
{% block control-buttons %}
|
||||||
<div class="controls">
|
{% if request.user|can_delete:object %}
|
||||||
<div class="control-group">
|
{% delete_button object %}
|
||||||
{% plugin_buttons object %}
|
{% endif %}
|
||||||
</div>
|
{% endblock control-buttons %}
|
||||||
{% if request.user|can_delete:object %}
|
|
||||||
{% delete_button object %}
|
|
||||||
{% endif %}
|
|
||||||
<div class="control-group">
|
|
||||||
{% custom_links object %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock controls %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
|
@ -4,15 +4,11 @@
|
|||||||
{% load perms %}
|
{% load perms %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block controls %}
|
{% block control-buttons %}
|
||||||
<div class="controls">
|
{% if request.user|can_delete:object %}
|
||||||
<div class="control-group">
|
{% delete_button object %}
|
||||||
{% if request.user|can_delete:object %}
|
{% endif %}
|
||||||
{% delete_button object %}
|
{% endblock control-buttons %}
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock controls %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
|
@ -6,19 +6,19 @@
|
|||||||
{% block title %}{% trans "Rack Elevations" %}{% endblock %}
|
{% block title %}{% trans "Rack Elevations" %}{% endblock %}
|
||||||
|
|
||||||
{% block controls %}
|
{% block controls %}
|
||||||
<div class="controls">
|
<div class="col-auto d-print-none">
|
||||||
<div class="control-group">
|
<div class="btn-list">
|
||||||
<a href="{% url 'dcim:rack_list' %}{% querystring request %}" class="btn btn-primary">
|
<a href="{% url 'dcim:rack_list' %}{% querystring request %}" class="btn btn-primary">
|
||||||
<i class="mdi mdi-format-list-checkbox"></i> {% trans "View List" %}
|
<i class="mdi mdi-format-list-checkbox"></i> {% trans "View List" %}
|
||||||
</a>
|
</a>
|
||||||
<div class="btn-group btn-group-sm" role="group">
|
<div class="btn-group" role="group">
|
||||||
<select class="btn btn-outline-secondary rack-view">
|
<select class="btn btn-outline-secondary rack-view">
|
||||||
<option value="images-and-labels" selected="selected">{% trans "Images and Labels" %}</option>
|
<option value="images-and-labels" selected="selected">{% trans "Images and Labels" %}</option>
|
||||||
<option value="images-only">{% trans "Images only" %}</option>
|
<option value="images-only">{% trans "Images only" %}</option>
|
||||||
<option value="labels-only">{% trans "Labels only" %}</option>
|
<option value="labels-only">{% trans "Labels only" %}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn-group btn-group-sm" role="group">
|
<div class="btn-group" role="group">
|
||||||
<a href="{% url 'dcim:rack_elevation_list' %}{% querystring request face='front' %}" class="btn btn-outline-secondary{% if rack_face == 'front' %} active{% endif %}">{% trans "Front" %}</a>
|
<a href="{% url 'dcim:rack_elevation_list' %}{% querystring request face='front' %}" class="btn btn-outline-secondary{% if rack_face == 'front' %} active{% endif %}">{% trans "Front" %}</a>
|
||||||
<a href="{% url 'dcim:rack_elevation_list' %}{% querystring request face='rear' %}" class="btn btn-outline-secondary{% if rack_face == 'rear' %} active{% endif %}">{% trans "Rear" %}</a>
|
<a href="{% url 'dcim:rack_elevation_list' %}{% querystring request face='rear' %}" class="btn btn-outline-secondary{% if rack_face == 'rear' %} active{% endif %}">{% trans "Rear" %}</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{# ObjectChange does not support the default add/edit/delete controls #}
|
{# ObjectChange does not support the default add/edit/delete controls #}
|
||||||
{% block controls %}{% endblock %}
|
{% block control-buttons %}{% endblock %}
|
||||||
{% block subtitle %}{% endblock %}
|
{% block subtitle %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@ -15,12 +15,7 @@
|
|||||||
{% endblock tabs %}
|
{% endblock tabs %}
|
||||||
|
|
||||||
{% block controls %}
|
{% block controls %}
|
||||||
<div class="controls">
|
{% add_button model %}
|
||||||
<div class="control-group">
|
|
||||||
{% block extra_controls %}{% endblock %}
|
|
||||||
{% add_button model %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock controls %}
|
{% endblock controls %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
{% load buttons %}
|
{% load buttons %}
|
||||||
{% load perms %}
|
{% load perms %}
|
||||||
|
|
||||||
|
{% block controls %}
|
||||||
|
{% if request.user|can_delete:job %}
|
||||||
|
{% delete_button job %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock controls %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-md-12"{% if not job.completed %} hx-get="{% url 'extras:report_result' job_pk=job.pk %}" hx-trigger="load delay:0.5s, every 5s"{% endif %}>
|
<div class="col col-md-12"{% if not job.completed %} hx-get="{% url 'extras:report_result' job_pk=job.pk %}" hx-trigger="load delay:0.5s, every 5s"{% endif %}>
|
||||||
@ -9,13 +15,3 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
{% block controls %}
|
|
||||||
<div class="controls">
|
|
||||||
<div class="control-group">
|
|
||||||
{% if request.user|can_delete:job %}
|
|
||||||
{% delete_button job %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock controls %}
|
|
@ -6,12 +6,7 @@
|
|||||||
{% block title %}{% trans "Scripts" %}{% endblock %}
|
{% block title %}{% trans "Scripts" %}{% endblock %}
|
||||||
|
|
||||||
{% block controls %}
|
{% block controls %}
|
||||||
<div class="controls">
|
{% add_button model %}
|
||||||
<div class="control-group">
|
|
||||||
{% block extra_controls %}{% endblock %}
|
|
||||||
{% add_button model %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock controls %}
|
{% endblock controls %}
|
||||||
|
|
||||||
{% block tabs %}
|
{% block tabs %}
|
||||||
|
@ -27,13 +27,9 @@
|
|||||||
{% endblock header %}
|
{% endblock header %}
|
||||||
|
|
||||||
{% block controls %}
|
{% block controls %}
|
||||||
<div class="controls">
|
{% if request.user|can_delete:job %}
|
||||||
<div class="control-group">
|
{% delete_button job %}
|
||||||
{% if request.user|can_delete:job %}
|
{% endif %}
|
||||||
{% delete_button job %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock controls %}
|
{% endblock controls %}
|
||||||
|
|
||||||
{% block tabs %}
|
{% block tabs %}
|
||||||
|
@ -16,7 +16,11 @@
|
|||||||
|
|
||||||
{# Controls #}
|
{# Controls #}
|
||||||
<div class="col-auto d-print-none">
|
<div class="col-auto d-print-none">
|
||||||
{% block controls %}{% endblock controls %}
|
{% block controls %}
|
||||||
|
<div class="btn-list">
|
||||||
|
{% block control-buttons %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
{% endblock controls %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -57,13 +57,16 @@ Context:
|
|||||||
{% endblock subtitle %}
|
{% endblock subtitle %}
|
||||||
|
|
||||||
{% block controls %}
|
{% block controls %}
|
||||||
{# Clone/Edit/Delete Buttons #}
|
<div class="btn-list mb-2">
|
||||||
<div class="btn-list">
|
{% plugin_buttons object %}
|
||||||
{% plugin_buttons object %}
|
|
||||||
|
{# Add/edit/delete/etc. buttons #}
|
||||||
|
{% block control-buttons %}
|
||||||
|
|
||||||
{# Extra buttons #}
|
{# Extra buttons #}
|
||||||
{% block extra_controls %}{% endblock %}
|
{% block extra_controls %}{% endblock %}
|
||||||
|
|
||||||
|
{# Default buttons #}
|
||||||
{% if perms.extras.add_bookmark and object.bookmarks %}
|
{% if perms.extras.add_bookmark and object.bookmarks %}
|
||||||
{% bookmark_button object %}
|
{% bookmark_button object %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -76,8 +79,16 @@ Context:
|
|||||||
{% if request.user|can_delete:object %}
|
{% if request.user|can_delete:object %}
|
||||||
{% delete_button object %}
|
{% delete_button object %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endblock control-buttons %}
|
||||||
|
</div>
|
||||||
|
|
||||||
{% custom_links object %}
|
{# Custom links #}
|
||||||
|
<div class="d-flex justify-content-end">
|
||||||
|
<div class="btn-list">
|
||||||
|
{% block custom-links %}
|
||||||
|
{% custom_links object %}
|
||||||
|
{% endblock custom-links %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock controls %}
|
{% endblock controls %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user