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

remove inline css #372

Merged
merged 5 commits into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,31 @@ table tr th, table tr td {
0 0 0 2.1em #212529,
0 0 0 2.6em #95a5a6;
}

.login {
background-color: var(--light, #eee);
}
.login main {
max-width: 330px;
margin: 40px auto;
}

meter.progress {
-webkit-appearance: none;
-moz-appearance: none;
background-image: none;
width: 100%;
}
meter.progress::-webkit-meter-inner-element {
display: block;
}
meter.progress::-webkit-meter-bar {
border: 0;
border-radius: 0;
}
meter.progress::-webkit-meter-optimum-value {
background: var(--primary);
}
meter.progress::-moz-meter-bar {
background: var(--primary);
}
Copy link
Collaborator Author

@xi xi Mar 31, 2021

Choose a reason for hiding this comment

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

I tested this in firefox and chrome, but still this is all hacky and brittle. IMHO we could also use <meter> without bootstrap styling.

Copy link
Member

Choose a reason for hiding this comment

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

How hacky and brittle is it? Like in what way does it break? I think if it mostly works and "breaks" by falling back to a more default styling, that would probably be okay?

Copy link
Collaborator Author

@xi xi Apr 1, 2021

Choose a reason for hiding this comment

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

I think it is unlikely that this breaks in a way that affects other elements on the page, but it could well be that the relevant part of the bar is not colored.

I would feel safer with reverting d2060da. However, other people tent to value esthetics higher than I do.

Copy link
Member

Choose a reason for hiding this comment

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

I'll try to also test it in safari and maybe edge. If it also works there, I'd just go ahead with it and deploy it. the bar isn't used a lot and also has numbers on it, so even if it breaks it would be noticeable and we could still make changes.

5 changes: 2 additions & 3 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8"/>
<meta http-equiv="Content-Security-Policy" content="default-src 'self';
script-src 'self' 'unsafe-inline' 'unsafe-eval';
style-src 'self' 'unsafe-inline' http://fonts.googleapis.com https://fonts.googleapis.com;
style-src 'self' http://fonts.googleapis.com https://fonts.googleapis.com;
connect-src 'self' https://localhost:41951 https://127.0.0.1:41951;
font-src 'self' http://fonts.gstatic.com https://fonts.gstatic.com;
img-src 'self' data:; ">
Expand All @@ -21,10 +21,9 @@
<link rel="shortcut icon" href="{% static "images/favicon.ico" %}">
<link rel="apple-touch-icon" href="{% static "images/apple-touch-icon.png" %}">

{% block extracss %}{% endblock %}
<script src="{% static "alpinejs/dist/alpine.js" %}"></script>
</head>
<body>
<body class="{% block body_class%}{% endblock %}">
{% if not nochrome %}
<header class="navbar navbar-expand-lg navbar-dark bg-primary sticky-top mb-3">
<a class="navbar-brand" href="/"><i class="fa fa-archive"></i> {{ SITE_NAME }}</a>
Expand Down
2 changes: 1 addition & 1 deletion templates/devices/detail/device_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ <h4>{% trans "Description" %}</h4>
</div>
</div>

<ul class="nav nav-tabs mb-3" style="margin-top: 20px;">
<ul class="nav nav-tabs my-3">
{% if can_change_device %}
<li class="nav-item"><a class="nav-link active" href="#notes" data-toggle="tab">{% trans "Notes" %}</a></li>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion templates/devices/forms/device_form_automatic.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</div>
<div x-show="hasDevice()">
<hr />
<div class="row" style="margin-bottom: 12px">
<div class="row mb-3">
<div class="col-md-6">
<h4>Lagerregal ID: <b x-text="device.id"></b></h4>
</div>
Expand Down
19 changes: 2 additions & 17 deletions templates/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,10 @@

{% block title %}{% trans "Log in" %}{% endblock %}

{% block extracss %}
<style>
body {
background-color: #eee;
}

h1 {
color: #1abc9c;
}

main {
max-width: 330px;
margin: 40px auto;
}
</style>
{% endblock %}
{% block body_class %}login{% endblock %}

{% block content %}
<h1 class="mb-5 text-center"><i class="fa fa-archive"></i> {{ SITE_NAME }}</h1>
<h1 class="mb-5 text-center text-success"><i class="fa fa-archive"></i> {{ SITE_NAME }}</h1>
{% if form.errors %}
<div data-alert class="alert-danger alert">
{% trans "Your username and password didn't match. Please try again." %}
Expand Down
14 changes: 2 additions & 12 deletions templates/snippets/widgets/statistics.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@
{% trans "Devices" %}
</div>
<div class="col-md-9">
<div class="progress mb-0">
<div class="progress-bar progress-bar-{{ device_percentcolor }}" role="progressbar"
aria-valuenow="{{ device_percent }}" aria-valuemin="0" aria-valuemax="100"
style="width: {{ device_percent }}%;">
</div>
</div>
<meter class="progress" max="100" value="{{ device_percent }}"></meter>
<span>{{ device_available }}</span>
<span class="pull-right">{{ device_all }}</span>
</div>
Expand All @@ -37,12 +32,7 @@
{% trans "IP-Addresses" %}
</div>
<div class="col-md-9">
<div class="progress mb-0">
<div class="progress-bar progress-bar-{{ ipaddress_percentcolor }}" role="progressbar"
aria-valuenow="{{ ipaddress_percent }}" aria-valuemin="0" aria-valuemax="100"
style="width: {{ ipaddress_percent }}%;">
</div>
</div>
<meter class="progress" max="100" value="{{ ipaddress_percent }}"></meter>
<span>{{ ipaddress_available }}</span>
<span class="pull-right">{{ ipaddress_all }}</span>
</div>
Expand Down