Replace inline CSS with Bootstrap classes

This replaces occurrences of inline CSS that can be replaced directly
(equivalent style) with Bootstrap classes.

Inline styles are generally longer, are not cached, make implementing
CSP policies harder, etc.
This commit is contained in:
Naglis Jonaitis 2024-01-26 10:32:48 +02:00 committed by Drew DeVault
parent 1d342a2a35
commit 237aa3712e
13 changed files with 33 additions and 33 deletions

View File

@ -15,7 +15,7 @@ pre, body {
</style>
{% endblock %}
{% block content %}
<div class="header-extension" style="margin-bottom: 0;">
<div class="header-extension mb-0">
<div class="blob container-fluid">
<span>
{{ utils.breadcrumb(ref, commit.id, repo, path, entry, view, path_join, stat, pygit2, humanize) }}
@ -47,7 +47,7 @@ pre, body {
This row has some weird styles going on. This prevents the page from
scrolling horizontally
#}
<div class="row" style="margin-right: 0;">
<div class="row mr-0">
<div class="col-md-12 code-view">
<pre class="ruler"><span>{% for i in range(
editorconfig.max_line_length()) %} {% endfor %}</span></pre>

View File

@ -11,7 +11,7 @@ pre {
</style>
{% endblock %}
{% block content %}
<div class="header-extension" style="margin-bottom: 0;">
<div class="header-extension mb-0">
<div class="blob container-fluid">
<span>
{{ utils.breadcrumb(ref, commit.id, repo, path, entry, view, path_join, stat, pygit2, humanize) }}
@ -67,9 +67,9 @@ pre {
This row has some weird styles going on. This prevents the page from
scrolling horizontally
#}
<div class="row" style="margin-right: 0;">
<div class="row mr-0">
{% if markdown and not force_source %}
<div class="col-md-10 offset-md-1" style="margin-top: 1rem">
<div class="col-md-10 offset-md-1 mt-3">
{{ markdown }}
</div>
{% else %}
@ -86,7 +86,7 @@ pre {
</div>
{% elif blob.is_binary %}
<div class="col-md-12">
<div style="padding: 1rem">
<div class="p-3">
<p>
<span title="{{ blob.size }} bytes">
{{humanize.naturalsize(blob.size,
@ -107,7 +107,7 @@ pre {
</div>
{% else %}
<div class="col-md-12">
<div style="padding: 1rem">
<div class="p-3">
<p>
<span title="{{ blob.size }} bytes">
{{humanize.naturalsize(blob.size,

View File

@ -15,7 +15,7 @@
</div>
</div>
<div class="col-md-2">
<div style="margin-bottom: 1rem">
<div class="mb-3">
<a
href="{{url_for("repo.patch",
owner=repo.owner.canonical_name,

View File

@ -12,7 +12,7 @@
</div>
{% endif %}
<div class="container">
<div class="row" style="margin-bottom: 1rem">
<div class="row mb-3">
<div class="col-md-4">
<h3>clone</h3>
<dl>

View File

@ -24,7 +24,7 @@
{% if path != [''] and len(commits) != 0 %}
<div class="header-extension">
<div class="container">
<span style="padding-left: 1rem">
<span class="pl-3">
{{ utils.breadcrumb(ref, commits[0].id, repo, path, entry, view, path_join, stat, pygit2, humanize) }}
</span>
<div class="clearfix"></div>

View File

@ -98,7 +98,7 @@
<div class="event-list">
<div class="event">
{% if tag.message %}
<pre style="padding-bottom: 0;">{{strip_pgp_signature(tag.message)}}</pre>
<pre class="pb-0">{{strip_pgp_signature(tag.message)}}</pre>
{% endif %}
</div>
</div>

View File

@ -35,7 +35,7 @@
{% set commit = git_repo.get(tag.target) %}
{% endif %}
<div class="event">
<h4 style="margin-bottom: 0.5rem">
<h4 class="mb-2">
{% if isinstance(tag, pygit2.Commit) %}
{% set refname = commit.id.hex %}
{% set author = commit.author %}
@ -53,7 +53,7 @@
<small class="pull-right text-muted">
{{signature_time(author) | date}}
<a
style="margin-left: 0.5rem"
class="ml-2"
href="{{url_for("repo.archive",
owner=repo.owner.canonical_name,
repo=repo.name, ref=refname, fmt=sig_fmt or "tar.gz")}}"
@ -61,7 +61,7 @@
>.{{ sig_fmt or "tar.gz" }} {{icon("caret-right")}}</a>
{% if sig_fmt %}
<a
style="margin-left: 0.5rem"
class="ml-2"
href="{{url_for("repo.archivesig",
owner=repo.owner.canonical_name,
repo=repo.name, ref=refname, fmt=sig_fmt)}}"
@ -70,13 +70,13 @@
>.asc {{icon("caret-right")}}</a>
{% endif %}
<a
style="margin-left: 0.5rem"
class="ml-2"
href="{{url_for("repo.tree",
owner=repo.owner.canonical_name,
repo=repo.name, ref=refname)}}"
>browse {{icon("caret-right")}}</a>
<a
style="margin-left: 0.5rem"
class="ml-2"
href="{{url_for("repo.log",
owner=repo.owner.canonical_name,
repo=repo.name, ref=refname)}}"
@ -84,7 +84,7 @@
</small>
</h4>
{% if tag.message %}
<pre style="padding-bottom: 0;">{{strip_pgp_signature(tag.message)}}</pre>
<pre class="pb-0">{{strip_pgp_signature(tag.message)}}</pre>
{% endif %}
</div>
{% endfor %}
@ -101,7 +101,7 @@
<div class="event">
{{name.decode("utf-8", "replace")}}
{{ utils.commit_event(repo, commit, skip_body=True) }}
<div class="row" style="margin-top: 0.5rem">
<div class="row mt-2">
<div class="col">
<a
href="{{url_for("repo.tree",

View File

@ -65,7 +65,7 @@
{% endif %}
</small>
</div>
<div class="form-group" style="margin-bottom: 0">
<div class="form-group mb-0">
<label for="patchset_cc">Cc</label>
<input
type="text"
@ -77,7 +77,7 @@
</div>
</div>
<div class="col-md-2 d-flex flex-column justify-content-end">
<div class="form-group" style="margin-bottom: 0">
<div class="form-group mb-0">
<button class="btn btn-primary btn-block">
Send patchset {{icon('caret-right')}}
</button>
@ -94,7 +94,7 @@
</p>
{# TODO: More concise send-email commands, e.g. use HEAD where appropriate #}
<pre
style="margin-bottom: 0;"
class="mb-0"
>git config format.subjectPrefix "PATCH {{repo.name}}" <span class="text-muted"># Only necessary once</span>
git send-email {% if version != 1 %}-v{{version}} {% endif %}{% if cover_letter %}--cover-letter {% endif %}{% if start.parent_ids %}{{start.short_id}}^..{% else %}--root {% endif %}{{end.short_id}}</pre>
</div>

View File

@ -7,7 +7,7 @@
owner_name=owner.canonical_name, repo_name=repo.name)}}">
{{csrf_token()}}
<div class="form-group">
<label for="name" style="display: block">
<label for="name" class="d-block">
Repository name
<a
href="/{{ owner.canonical_name }}/{{ repo.name }}/settings/rename"

View File

@ -7,7 +7,7 @@
<form method="POST">
{{csrf_token()}}
<div class="form-group">
<label for="name" style="display: block">
<label for="name" class="d-block">
New repository name:
</label>
<input

View File

@ -36,9 +36,9 @@
{% if message %}
<div class="alert alert-success">{{message}}</div>
{% endif %}
<div class="row" style="margin-bottom: 1rem">
<div class="row mb-3">
<div class="col-md-6">
<div class="event-list" style="margin-bottom: 0.5rem">
<div class="event-list mb-2">
{% for c in commits %}
<div class="event">
{{ utils.commit_event(repo, c) }}

View File

@ -31,7 +31,7 @@
</div>
</div>
<div class="container">
<div class="row" style="margin-bottom: 1rem">
<div class="row mb-3">
<div class="col-md-12">
{# chromium has a hard limit on 1000 rows per grid #}
{% for index in range(0, len(tree), 501) %}

View File

@ -1,7 +1,7 @@
{% macro breadcrumb(ref, permaref, repo, path, entry, view, path_join, stat, pygit2, humanize) %}
{% set ref_s = ref.decode("utf-8", "replace") %}
{% if ref_s != repo.git_repo.default_branch_name() %}
<span style="margin-right: 1rem">
<span class="mr-3">
<span class="text-muted">ref:</span> {{ ref_s }}
</span>
{% endif %}
@ -20,14 +20,14 @@ endif %}{% endfor %}
{% if entry %}
{# Root tree has no filemode #}
{% set filemode = entry.filemode or stat.S_IFDIR %}
<span class="text-muted" style="margin-left: 1rem">
<span class="text-muted ml-3">
<span title="{{"{0:0o}".format(filemode)}}">
{{stat.filemode(filemode)}}
</span>
</span>
{% if is_blob %}
<span class="text-muted" style="margin-left: 1rem">
<span class="text-muted ml-3">
<span title="{{ entry.size }} bytes">
{{humanize.naturalsize(entry.size,
binary=True).replace("Byte", "byte")}}
@ -37,7 +37,7 @@ endif %}{% endfor %}
{% endif %}
{% set path = path_join(*path) %}
<div class="blob-nav" style="margin-left: 1rem">
<div class="blob-nav ml-3">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link {% if view in ["blob", "tree"] %}active{% endif %}"
@ -115,7 +115,7 @@ endif %}{% endfor %}
</small>
{% if parents and any(c.parents) %}
<span style="margin-left: 0.5rem">
<span class="ml-2">
{{icon('code-branch', cls="sm")}}
{% for parent in c.parents %}
<a href="{{url_for("repo.commit",
@ -131,7 +131,7 @@ endif %}{% endfor %}
{% endif %}
{% if c.id.hex in refs %}
<span style="margin-left: 0.5rem">
<span class="ml-2">
{% for ref in refs[c.id.hex] %}
<a
class="ref {{ref.type}}
@ -176,7 +176,7 @@ instead.
</div>
{% else %}
{% for patch in diff %}
<pre style="margin-bottom: 0; background: transparent; padding: 0;"
<pre class="mb-0 bg-transparent p-0"
>{#
#}{{patch.delta.status_char()}} {% if parent %}<a
href="{{url_for("repo.tree",