Migrate bootstrap 4 from bootstrap 3

Closes: #1818. The new navbar collapse handles items better without a scrollbar.

- Switch dependency to newer bootstrap4 library.

- Bootstrap 4 has 5 grid levels instead of 4. Adjust all classes accordingly to
retain current semantics.

- Update for newer markup for dropdowns.

- Replace use for labels with badges. Labels have been removed. Use
badge-secondary instead of label-default.

- Replace use of btn-xs with btn-sm. Size is roughly the same.

- Accommodate removal of form-horizontal.

- .hidden* and .visible* classes have been removed. Use alternate utilities.

- Replace use of table-condensed with table-sm.

- Update progress bar background styling. .progress-bar-* have been replaced
with bg-*.

- Drop support for IE9 and below. Bootstrap 4 does not support those browsers.

- Use the new simplified markup for navs, navbar and navbar-toggler. Accommodate
removal of .navbar-fixed-top.

- Update the JSXC page too.

- Update all values that are using rem units. The base font size is now 1rem =
16px instead of 1rem = 10px. This the default for bootstrap 4.

- A button inside a dropdown menu is natively supported by bootstrap 4. Remove
custom styling done earlier.

- Drop use of removed class thumbnail.

- Override colors for buttons and warnings to keep the old style.

- Use new markup for close buttons inside alerts.

- Use .collapse.show instead of .collapse.in as per bootstrap 4 styling.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
achalaramu authored and Veiko Aasa committed 2020-12-19 11:26:32 +02:00
1 parent 58751d241e
commit 00bc55f762
47 files changed
+468 -380

No files matched your search

@@ -12,8 +12,8 @@
<p>{% trans "Delete this archive permanently?" %}</p>
<div class="row">
<div class="col-lg-12">
<table class="table table-bordered table-condensed table-striped">
<div class="col-xl-12">
<table class="table table-bordered table-sm table-striped">
<thead>
<th>{% trans "Name" %}</th>
<th>{% trans "Time" %}</th>
@@ -65,7 +65,7 @@
</tr>
</thead>
<tbody class="collapse in" id="{{ uuid }}">
<tbody class="collapse show" id="{{ uuid }}">
{% if repository.mounted %}
{% for archive in repository.archives %}
@@ -40,7 +40,7 @@
{% trans "How to verify?" %}
</a>
</p>
<div class="collapse panel-body" id="help">
<div class="collapse card-body" id="help">
<p>
{% blocktrans trimmed %}
Run the following command on the SSH host machine. The output
@@ -31,7 +31,7 @@
</div>
<div class="row">
<div class="col-sm-6">
<div class="col-md-6">
{% if not libraries %}
<p>{% trans 'No libraries available.' %}</p>
{% else %}
@@ -7,12 +7,7 @@
<form class="form form-diagnostics-button" method="post"
action="{% url 'diagnostics:app' app_id %}">
{% csrf_token %}
{% if enabled %}
<input type="submit" class="btn btn-default no-running-status"
value="{% trans "Run Diagnostics" %}"/>
{% else %}
<input type="submit" class="btn btn-default"
value="{% trans "Run Diagnostics" %}" disabled="disabled"/>
{% endif %}
<input type="submit" class="dropdown-item no-running-status"
value="{% trans "Run Diagnostics" %}"
{% if not enabled %} disabled="disabled" {% endif %}/>
</form>
@@ -17,11 +17,11 @@
<td>{{ test }}</td>
<td class="diagnostics-result">
{% if result == 'passed' %}
<span class="label label-success">{% trans result %}</span>
<span class="badge badge-success">{% trans result %}</span>
{% elif result == 'failed' %}
<span class="label label-danger">{% trans result %}</span>
<span class="badge badge-danger">{% trans result %}</span>
{% elif result == 'error' %}
<span class="label label-warning">{% trans result %}</span>
<span class="badge badge-warning">{% trans result %}</span>
{% else %}
{{ result }}
{% endif %}
@@ -33,7 +33,7 @@
{% block configuration %}
{% if domain_names|length > 0 %}
<h3>Configuration</h3>
<h3>{% trans "Configuration" %}</h3>
<form class="form" method="post">
{% csrf_token %}
@@ -38,22 +38,22 @@
<center>
<button data-toggle="collapse"
data-target=".{{component.component_id}}"
class="btn btn-info btn-xs">+</button>
class="btn btn-info btn-sm">+</button>
</center>
</td>
<td><strong>{{ component.name }}</strong></td>
<td>
{% if component.is_enabled %}
<span class='label label-success'>
<span class='badge badge-success'>
{% trans "Enabled" %}</span>
{% else %}
<span class='label label-warning'>
<span class='badge badge-warning'>
{% trans "Disabled" %}</span>
{% endif %}
</td>
</tr>
{% for port in component.ports_details %}
<tr class="collapse out {{component.component_id}}"
<tr class="collapse {{component.component_id}}"
style="background-color: #f9f9f9" >
<td></td>
<td class='cell-indented'><em>{{ port.name }}</em>:
@@ -63,16 +63,16 @@
</td>
<td>
{% if port.name in internal_enabled_ports and port.name in external_enabled_ports %}
<span class='label label-success'>
<span class='badge badge-success'>
{% trans "Permitted" %}</span>
{% elif port.name in internal_enabled_ports %}
<span class='label label-warning'>
<span class='badge badge-warning'>
{% trans "Permitted (internal only)" %}</span>
{% elif port.name in external_enabled_ports %}
<span class='label label-warning'>
<span class='badge badge-warning'>
{% trans "Permitted (external only)" %}</span>
{% else %}
<span class='label label-danger'>
<span class='badge badge-danger'>
{% trans "Blocked" %}</span>
{% endif %}
</td>
@@ -39,7 +39,7 @@
</div>
<div class="row">
<div class="col-sm-6">
<div class="col-md-6">
{% if not repos %}
<p>{% trans 'No repositories available.' %}</p>
{% else %}
@@ -20,7 +20,7 @@
</div>
<div class="row">
<div class="col-sm-6">
<div class="col-md-6">
{% if not sites %}
<p>{% trans "No wikis or blogs available." %}</p>
{% else %}
@@ -27,6 +27,14 @@
# THE SOFTWARE.
*/
h1 {
/* From bootstrap 3 .page-header */
text-align: center;
padding-bottom: 0.5625rem;
margin: 2.5rem 0 1.25rem;
border-bottom: 1px solid #eee;
}
/* Elements to hide on page load */
.logout {
display: none;
+16 -16
View File
@@ -37,7 +37,7 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="/javascript/bootstrap/css/bootstrap.min.css" media="all"
<link href="/javascript/bootstrap4/css/bootstrap.min.css" media="all"
rel="stylesheet" type="text/css" />
<link href="/javascript/jquery-ui/themes/base/jquery-ui.min.css"
media="all" rel="stylesheet" type="text/css" />
@@ -50,7 +50,7 @@
<script src="/javascript/jquery-ui/jquery-ui.min.js"></script>
<script src="/javascript/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<script src="/javascript/jquery-fullscreen/jquery.fullscreen.js"></script>
<script src="/javascript/bootstrap/js/bootstrap.min.js"></script>
<script src="/javascript/bootstrap4/js/bootstrap.bundle.min.js"></script>
<script src="/javascript/jsxc/lib/jsxc.dep.js"></script>
<script src="/javascript/jsxc/jsxc.js"></script>
@@ -61,49 +61,49 @@
data-jsxc-root="{% static 'jsxc/libjs-jsxc' %}">
<div class="container" id="content" role="main">
<div class="row">
<div class="col-md-6 col-md-offset-3 col-xs-8 col-xs-offset-2">
<h1 class="page-header text-center">Jabber Chat</h1>
<div class="col-lg-6 offset-lg-3">
<h1>Jabber Chat</h1>
<div class="form form-horizontal">
<div class="form-group">
<label for="xmpp-domain" class="col-xs-4 control-label">
<div class="form">
<div class="form-group row">
<label for="xmpp-domain" class="col-sm-4 col-form-label">
Domain:
</label>
<div class="col-xs-8">
<div class="col-sm-8">
<input type="text" id="xmpp-domain" name="xmpp-domain"
class="form-control" />
<p id="server-flash"></p>
</div>
</div>
<form id="jsxc-login-form" class="form form-horizontal">
<form id="jsxc-login-form" class="form">
<fieldset>
<div class="form-group row">
<label for="jsxc-username" class="col-xs-4 control-label">
<label for="jsxc-username" class="col-sm-4 col-form-label">
Username:
</label>
<div class="col-xs-8">
<div class="col-sm-8">
<input type="text" id="jsxc-username"
class="form-control" />
</div>
</div>
<div class="form-group row">
<label for="jsxc-password" class="col-xs-4 control-label">
<label for="jsxc-password" class="col-sm-4 col-form-label">
Password:
</label>
<div class="col-xs-8">
<div class="col-sm-8">
<input type="password" id="jsxc-password"
class="form-control" />
</div>
</div>
<div class="form-group row">
<div class="col-xs-offset-4 col-xs-8">
<div class="offset-sm-4 col-sm-8">
<button type="submit" id="jsxc-submit"
class="submit btn btn-primary"
data-loading-text="Logging in...">Log in</button>
<button class="logout btn btn-default">Log out</button>
<button class="logout btn btn-secondary">Log out</button>
</div>
</div>
</fieldset>
@@ -113,7 +113,7 @@
</div>
</div>
<div class="hidden">
<div class="d-none">
<a href="{% static 'jslicense.html' %}" data-jslicense="1">
{% trans "JavaScript license information" %}</a>
</div>
@@ -23,7 +23,7 @@
<h3>{% trans "Status" %}</h3>
{% if status.domains %}
<table class="table table-bordered table-condensed table-striped">
<table class="table table-bordered table-sm table-striped">
<thead>
<tr>
<th>{% trans "Domain" %}</th>
@@ -38,13 +38,13 @@
<td>{{ domain }}</td>
<td>
{% if domain_status.certificate_available and domain_status.validity == "valid" %}
<span class="label label-success">
<span class="badge badge-success">
{% blocktrans trimmed with expiry_date=domain_status.expiry_date %}
Valid, expires on {{ expiry_date }}
{% endblocktrans %}
</span>
{% elif domain_status.certificate_available and not domain_status.validity == "valid" %}
<span class="label label-warning">
<span class="badge badge-warning">
{% if "revoked" in domain_status.validity %}
{% blocktrans trimmed %}
Revoked
@@ -64,16 +64,16 @@
{% endif %}
</span>
{% else %}
<span class="label label-warning">
<span class="badge badge-warning">
{% trans "No certificate" %}
</span>
{% endif %}
</td>
<td>
{% if domain_status.web_enabled %}
<span class="label label-success">{% trans "Enabled" %}</span>
<span class="badge badge-success">{% trans "Enabled" %}</span>
{% else %}
<span class="label label-warning">{% trans "Disabled" %}</span>
<span class="badge badge-warning">{% trans "Disabled" %}</span>
{% endif %}
</td>
<td>
+4 -2
View File
@@ -36,8 +36,10 @@ class PrependWidget(Widget):
field = self.base_widget.render(name, value, attrs, renderer)
widget_html = '''
<div class="input-group">
<span class="input-group-addon">
%(data)s
<span class="input-group-prepend">
<span class="input-group-text">
%(data)s
</span>
</span>
%(field)s
</div>'''
@@ -11,8 +11,8 @@
{% if domains %}
<div class="row">
<div class="col-sm-6">
<table class="table table-bordered table-condensed table-striped">
<div class="col-md-6">
<table class="table table-bordered table-sm table-striped">
<thead>
<tr>
<th>{% trans "Address" %}</th>
@@ -74,7 +74,7 @@
{% for domain in key.all_domains %}
{% if domain not in key.imported_domains %}
<li>
<span class="label label-default"
<span class="badge badge-secondary"
><span class="fa fa-times"
aria-hidden="true"></span></span>
<span class="monkeysphere-importable-domain"
@@ -82,7 +82,7 @@
</li>
{% elif domain not in key.available_domains %}
<li>
<span class="label label-warning"
<span class="badge badge-warning"
><span class="fa fa-exclamation-triangle"
aria-hidden="true"></span></span>
<span class="monkeysphere-unavailable-domain"
@@ -90,7 +90,7 @@
</li>
{% else %}
<li>
<span class="label label-success"
<span class="badge badge-success"
><span class="fa fa-check"
aria-hidden="true"></span></span>
<span class="monkeysphere-imported-domain"
@@ -10,7 +10,7 @@
<h2>{% trans "Monkeysphere" %}</h2>
<table class="table table-bordered table-condensed table-striped">
<table class="table table-bordered table-sm table-striped">
<tbody>
<tr>
<td>{% trans "OpenPGP Fingerprint" %}</td>
+1 -1
View File
@@ -8,7 +8,7 @@
{% block configuration %}
<table class="table table-bordered table-condensed table-striped names-table">
<table class="table table-bordered table-sm table-striped names-table">
<thead>
<tr>
<th>{% trans "Type" %}</th>
@@ -21,7 +21,7 @@
{% block content %}
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
<div class="col-md-8 offset-md-2">
<div>
<a href="{% url 'networks:edit' connection.uuid %}"
class="btn btn-primary" role="button"
@@ -55,7 +55,7 @@
<div class="list-group-item">
{% trans "Primary connection" %}
<div class="pull-right">
<span class="label label-success">{% trans "yes" %}</span>
<span class="badge badge-success">{% trans "yes" %}</span>
</div>
</div>
{% endif %}
@@ -106,10 +106,10 @@
{% trans "Link state" %}
<div class="pull-right">
{% if device.ethernet.carrier %}
<span class='label label-success'>
<span class='badge badge-success'>
{% trans "cable is connected" %}</span>
{% else %}
<span class='label label-warning'>
<span class='badge badge-warning'>
{% trans "please check cable" %}</span>
{% endif %}
</div>
@@ -147,7 +147,7 @@
<div class="list-group-item">
{% trans "Signal strength" %}
<div class="pull-right">
<span class="btn btn-primary btn-xs">
<span class="btn btn-primary btn-sm">
{{ access_point.strength }}%
</span>
</div>
@@ -255,7 +255,7 @@
<div class="list-group-item">
{% trans "Firewall zone" %}
<div class="pull-right">
<span class="label label-success">{{ connection.zone_string }}</span>
<span class="badge badge-success">{{ connection.zone_string }}</span>
</div>
</div>
</div>
@@ -275,7 +275,7 @@
<div class="list-group-item">
{% trans "Firewall zone" %}
<div class="pull-right">
<span class="label label-warning">{{ connection.zone_string }}</span>
<span class="badge badge-warning">{{ connection.zone_string }}</span>
</div>
</div>
</div>
@@ -294,7 +294,7 @@
<div class="list-group-item">
{% trans "Firewall zone" %}
<div class="pull-right">
<span class="label label-warning">{% trans "External" %}</span>
<span class="badge badge-danger">{% trans "External" %}</span>
</div>
</div>
</div>
@@ -45,19 +45,19 @@
</style>
<div class="row connection-diagram">
<div class="col-sm-2">
<div class="col-md-2">
<img src="{% static 'theme/img/network-internet.svg' %}"
class="col-image network-entity" alt="{% trans "Internet" %}"/>
</div>
<div class="col-sm-3">
<div class="col-md-3">
<img src="{% static 'theme/img/network-spacing.svg' %}"
class="col-image network-spacing hidden-xs"
class="col-image network-spacing d-none d-md-block"
alt="{% trans "Spacing" %}"/>
<img src="{% static 'theme/img/network-connection.svg' %}"
class="col-image network-connection hidden-xs"
class="col-image network-connection d-none d-md-block "
alt="{% trans "Connection" %}"/>
<img src="{% static 'theme/img/network-connection-vertical.svg' %}"
class="network-connection-vertical visible-xs-block"
class="network-connection-vertical d-md-none"
alt="{% trans "Connection" %}"/>
<div class="connection-list">
<p class="connection-list-heading">{% trans "External" %}</p>
@@ -77,16 +77,16 @@
{% endfor %}
</div>
</div>
<div class="col-sm-2">
<div class="col-md-2">
<img src="{% static 'theme/img/network-freedombox.svg' %}"
class="col-image network-entity" alt="{{ box_name }}"/>
</div>
<div class="col-sm-3">
<div class="col-md-3">
<img src="{% static 'theme/img/network-spacing.svg' %}"
class="col-image network-spacing hidden-xs"
class="col-image network-spacing d-none d-md-block"
alt="{% trans "Spacing" %}"/>
<img src="{% static 'theme/img/network-connection.svg' %}"
class="col-image network-connection hidden-xs"
class="col-image network-connection d-none d-md-block"
alt="{% trans "Connection" %}"/>
<div class="connection-list">
<p class="connection-list-heading">{% trans "Internal" %}</p>
@@ -108,10 +108,10 @@
{% endfor %}
</div>
<img src="{% static 'theme/img/network-connection-vertical.svg' %}"
class="network-connection-vertical visible-xs-block"
class="network-connection-vertical d-md-none"
alt="{% trans "Connection" %}"/>
</div>
<div class="col-sm-2">
<div class="col-md-2">
<img src="{% static 'theme/img/network-computer.svg' %}"
class="col-image network-entity" alt="{% trans "Computer" %}"/>
</div>
@@ -50,10 +50,10 @@
{% endif %}
{% if connection.is_active %}
<span class="label label-success connection-status-label">
<span class="badge badge-success connection-status-label">
{% trans "Active" %}</span>
{% else %}
<span class="label label-warning connection-status-label">
<span class="badge badge-warning connection-status-label">
{% trans "Inactive" %}</span>
{% endif %}
@@ -11,7 +11,7 @@
<h3>{{ title }}</h3>
<div class="row">
<div class="col-sm-6">
<div class="col-md-6">
<div class="list-group">
{% for access_point in access_points %}
<div class="list-group-item clearfix">
@@ -23,7 +23,7 @@
{% else %}
--
{% endif %}
<span class="btn btn-primary btn-xs pull-right">
<span class="btn btn-primary btn-sm pull-right">
{{ access_point.strength }}%
</span>
</div>
@@ -22,7 +22,7 @@
{% endblocktrans %}
</p>
<p class="bg-warning">
<p class="alert alert-warning">
{% blocktrans trimmed %}
<b>Warning:</b> Existing client profiles will be invalidated by this operation. All
OpenVPN users on {{ box_name }} must download their new profiles. OpenVPN
+7 -7
View File
@@ -31,10 +31,10 @@
{% if is_enabled %}
<h3>{% trans "Shares" %}</h3>
<p>
{% blocktrans trimmed %}
Note: Only specially created directories will be shared on selected disks,
not the whole disk.
{% endblocktrans %}
{% blocktrans trimmed %}
Note: Only specially created directories will be shared on selected
disks, not the whole disk.
{% endblocktrans %}
</p>
{% for disk in disks %}
@@ -48,11 +48,11 @@
<div class="progress">
<div class="progress-bar progress-bar-striped
{% if disk.percent_used < 75 %}
progress-bar-success
bg-success
{% elif disk.percent_used < 90 %}
progress-bar-warning
bg-warning
{% else %}
progress-bar-danger
bg-danger
{% endif %}"
role="progressbar" aria-valuenow="{{ disk.percent_used }}"
aria-valuemin="0" aria-valuemax="100"
@@ -31,7 +31,7 @@
{% if not shares %}
<p>{% trans 'No shares currently configured.' %}</p>
{% else %}
<table class="table table-bordered table-condensed table-striped" id="shares-list">
<table class="table table-bordered table-sm table-striped" id="shares-list">
<thead>
<tr>
<th>{% trans "Name" %}</th>
@@ -7,10 +7,10 @@
{% load i18n %}
{% block configuration %}
<form class="form-horizontal" method="post">
<form id="snapshot-configure" class="form-horizontal" method="post">
{% csrf_token %}
<h3>{% trans "Configuration" %}</h3>
{{ form|bootstrap_horizontal:'col-sm-4' }}
{{ form|bootstrap_horizontal:'col-md-4' }}
<input type="submit" class="btn btn-primary" name="update"
value="{% trans "Update setup" %}"/>
</form>
@@ -11,7 +11,7 @@
<p>{% trans "Delete the following snapshots permanently?" %}</p>
<table class="table table-bordered table-condensed table-striped">
<table class="table table-bordered table-sm table-striped">
<thead>
<th>{% trans "Number" %}</th>
<th>{% trans "Date" %}</th>
@@ -11,20 +11,17 @@
<form class="form" method="post">
<div class="button-table">
<div class="button-row row">
{% csrf_token %}
<div class="col-xs-6 text-left">
<input type="submit" class="btn btn-primary" name="create"
value="{% trans 'Create Snapshot' %}"/>
</div>
<div class="col-xs-6 text-right">
<input type="submit" class="btn btn-danger" name="delete_selected"
value="{% trans 'Delete Snapshots' %}"
{{ has_deletable_snapshots|yesno:',disabled="disabled"' }}/>
</div>
<div class="btn-toolbar">
{% csrf_token %}
<input type="submit" class="btn btn-primary" name="create"
value="{% trans 'Create Snapshot' %}"/>
<input type="submit" class="btn btn-danger button-secondary"
name="delete_selected"
value="{% trans 'Delete Snapshots' %}"
{{ has_deletable_snapshots|yesno:',disabled="disabled"' }}/>
</div>
<table class="table table-bordered table-condensed table-striped">
<table class="table table-bordered table-sm table-striped">
<thead>
<th>{% trans "Number" %}</th>
<th>{% trans "Date" %}</th>
@@ -38,12 +35,12 @@
<td>
{{ snapshot.number }}
{% if snapshot.is_default %}
<span class="label label-default">
<span class="badge badge-secondary">
{% trans "will be used at next boot" %}
</span>
{% endif %}
{% if snapshot.is_active %}
<span class="label label-success">
<span class="badge badge-success">
{% trans "in use" %}
</span>
{% endif %}
@@ -19,7 +19,7 @@
{% endblocktrans %}
</p>
<table class="table table-bordered table-condensed table-striped">
<table class="table table-bordered table-sm table-striped">
<thead>
<th>{% trans "Number" %}</th>
<th>{% trans "Date" %}</th>
+1 -1
View File
@@ -12,7 +12,7 @@
<div class="row">
{% csrf_token %}
<div class="col-sm-4 col-sm-offset-4">
<div class="col-md-4 offset-md-4">
{{ form|bootstrap }}
<div class="text-center">
@@ -19,7 +19,7 @@
<p>{% trans "The following storage devices are in use:" %}</p>
<table class="table table-bordered table-condensed table-striped">
<table class="table table-bordered table-sm table-striped">
<thead>
<tr>
<th>{% trans "Device" %}</th>
@@ -42,11 +42,11 @@
<div class="progress">
<div class="progress-bar progress-bar-striped
{% if disk.percent_used < 75 %}
progress-bar-success
bg-success
{% elif disk.percent_used < 90 %}
progress-bar-warning
bg-warning
{% else %}
progress-bar-danger
bg-danger
{% endif %}"
role="progressbar" aria-valuenow="disk.percent_used"
aria-valuemin="0" aria-valuemax="100"
+3 -3
View File
@@ -19,7 +19,7 @@
{{ block.super }}
{% if status.hs_enabled %}
<table class="table table-bordered table-condensed table-striped tor-hs">
<table class="table table-bordered table-sm table-striped tor-hs">
<thead>
<tr>
<th>{% trans "Onion Service" %}</th>
@@ -63,8 +63,8 @@
{% endblocktrans %}
</p>
<div class="row">
<div class="col-sm-6">
<table class="table table-bordered table-condensed table-striped tor-relay-ports">
<div class="col-md-6">
<table class="table table-bordered table-sm table-striped tor-relay-ports">
<thead>
<tr>
<th>{% trans "Service" %}</th>
@@ -31,7 +31,7 @@
</div>
<div class="row">
<div class="col-sm-6">
<div class="col-md-6">
<div class="list-group">
{% for user in object_list %}
<div class="list-group-item clearfix">