Skip to content

Commit d84de83

Browse files
committed
Modernize
1 parent 8fd8c01 commit d84de83

File tree

6 files changed

+91
-111
lines changed

6 files changed

+91
-111
lines changed

config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
DAILY_HASH_BITS = 9
22

3+
ASSETS_URL = '/pkgs.void/static'
4+
5+
VOIDLINUX_URL = 'https://voidlinux.org'
6+
37
DATASOURCE_CLASS = 'SqliteDataSource'
48

59
DATASOURCE_ARGUMENTS = ['index.sqlite3']

present.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ def escape_attr(arg):
5858
def web_parameters():
5959
return {
6060
'root_url': config.ROOT_URL,
61+
'assets_url': config.ASSETS_URL,
62+
'voidlinux_url': config.VOIDLINUX_URL,
6163
'escape_attr': escape_attr,
6264
}
6365

static/style.css

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,17 @@
1-
html, body {
2-
background: #ddd;
3-
color: #222;
4-
}
5-
6-
header {
7-
font-size: 1.2em;
8-
text-align: right;
9-
}
10-
11-
.searchbox {
12-
margin: 1ex;
13-
}
14-
15-
.content {
16-
max-width: 90ex;
17-
max-width: 90ch;
18-
margin: auto;
1+
.btn-primary {
2+
color: #fff !important;
3+
background-color: #478061 !important;
4+
border-color: #478061 !important;
195
}
206

217
a {
22-
color: #0000E0;
23-
}
24-
25-
.horizontal {
26-
display: inline;
27-
padding: 0;
28-
}
29-
30-
.horizontal li {
31-
display: inline;
32-
margin: auto 1ex;
33-
}
34-
35-
dd {
36-
margin-bottom: 1ex;
37-
}
38-
39-
ul, .breakable {
40-
columns: 40ex 2;
41-
columns: 40ch 2;
42-
}
43-
44-
ul.continuous {
45-
columns: auto 1;
46-
}
47-
48-
li, .non-breakable {
49-
break-inside: avoid;
50-
}
51-
52-
hr {
53-
max-width: 20ex;
54-
max-width: 20ch;
55-
color: #bfb;
56-
border: none;
57-
border-top: dotted 0.4em #bfb;
58-
margin: 1.3em auto;
8+
color: #478061 !important;
599
}
6010

61-
li > aside, .masked > aside {
62-
font-size: 0.8em;
63-
display: inline;
11+
.bg-void {
12+
background-color: #478061 !important;
6413
}
6514

66-
.archs-per-version a {
67-
white-space: nowrap;
15+
.nav-link {
16+
color: white !important;
6817
}

templates/base.html

Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,57 @@
11
<!DOCTYPE html>
2-
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
3-
4-
5-
6-
7-
2+
<html lang="en">
83
<head>
94
<meta charset="utf-8"/>
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
106
<title>${_context.get('title', 'Packages')} from Void</title>
11-
<link href="${root_url}/static/style.css" rel="stylesheet" type="text/css"/>
12-
7+
<link rel="icon" type="image/png" href="${assets_url}/img/favicon.png" />
8+
<link rel="stylesheet" href="${assets_url}/style.css"/>
9+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
10+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script>
1311
</head>
1412

15-
1613
<body>
17-
<header>
18-
<nav>
19-
<ul class="horizontal">
20-
<li><a href="${root_url}">Homepage</a></li>
21-
<li><a href="https://github.com/void-linux/void-packages">Templates repository</a></li>
22-
<li><a href="https://voidlinux.org">Void Linux homepage</a></li>
23-
<li><a href="${root_url}/all">All packages</a></li>
24-
</ul>
25-
</nav>
26-
<form action="${root_url}/search" class="searchbox" method="GET">
27-
<input name="term" type="text"/>
28-
<input type="submit" value="View"/>
29-
<input type="submit" name="find" value="Find"/>
30-
</form>
14+
<header class="d-flex flex-wrap justify-content-center py-3 mb-4 border-bottom bg-void">
15+
<div class="container">
16+
<ul class="nav nav-pills">
17+
<li class="nav-item"><a class="nav-link" href="${voidlinux_url}/">Home</a></li>
18+
<li class="nav-item"><a class="nav-link" href="${voidlinux_url}/news">News</a></li>
19+
<li class="nav-item"><a class="nav-link" href="${voidlinux_url}/download/">Download</a></li>
20+
<li class="nav-item"><a class="nav-link" aria-current="page" href="${root_url}">Packages</a></li>
21+
<li class="nav-item"><a class="nav-link" href="${voidlinux_url}/acknowledgments/">Acknowledgments</a></li>
22+
<li class="nav-item"><a class="nav-link" href="https://docs.voidlinux.org">Documentation</a></li>
23+
<li class="nav-item"><a class="nav-link" href="https://man.voidlinux.org/">Manual pages</a></li>
24+
<li class="nav-item"><a class="nav-link" href="https://github.com/void-linux">Github</a></li>
25+
</ul>
26+
</div>
3127
</header>
28+
<div class="container">
29+
<div class="searchbar mb-4">
30+
<div class="row g-3 align-items-center">
31+
<div class="col-auto">
32+
<a href="${root_url}">Featured packages</a>
33+
</div>
34+
<div class="col-auto">
35+
<a href="${root_url}/all">All packages</a>
36+
</div>
37+
<div class="col">
38+
<form action="${root_url}/search" method="GET" class="form-inline">
39+
<div class="row g-3 align-items-center">
40+
<div class="col">
41+
<input name="term" type="text" class="form-control"/>
42+
</div>
43+
<div class="col-auto">
44+
<input type="submit" value="View" class="btn btn-primary"/>
45+
</div>
46+
<div class="col-auto">
47+
<input type="submit" name="find" value="Find" class="btn btn-primary"/>
48+
</div>
49+
</div>
50+
</form>
51+
</div>
52+
</div>
53+
</div>
3254
{== _content ==}
55+
</div>
3356
</body>
3457
</html>

templates/main.html

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<?py _context['title'] = title ?>
2-
<div class="content">
3-
<main>
4-
<div class="breakable">
5-
6-
<?py for entry in lists: ?>
7-
<?py include('small/main_list.html', entry=entry) ?>
8-
<?py #endfor ?>
9-
</div>
10-
<p>Site was updated at ${updated}.</p>
11-
</main>
12-
</div><footer>Server side code is AGPL licensed. You can view <a href="https://github.com/Chocimier/pkgs.void">git repo</a> or get <a href="${root_url}/static/source/pkgs.void.tar.bz2">source tarball</a>.</footer>
2+
<div class="content">
3+
<main>
4+
<div class="d-flex flex-wrap justify-content-between align-items-start">
5+
<?py for entry in lists: ?>
6+
<?py include('small/main_list.html', entry=entry) ?>
7+
<?py #endfor ?>
8+
</div>
9+
</main>
10+
<footer class="mt-4 text-center">
11+
<p>Site was updated at ${updated}.</p>
12+
<p>Server side code is AGPL licensed. You can view <a href="https://github.com/Chocimier/pkgs.void">git repo</a> or get <a href="${root_url}/static/source/pkgs.void.tar.bz2">source tarball</a>.</p>
13+
</footer>
14+
</div>

templates/small/main_list.html

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
<div class="non-breakable">
2-
<h2>${entry['title']}</h2>
3-
<?py tag = 'ul' if entry.get('bullets') else 'ol' ?>
4-
<{== tag ==}>
5-
<?py echo(' ') ?>
6-
<?py for i in entry['packages']: ?>
7-
<li>
8-
<a href="${root_url}/package/${i}">${i}</a>
9-
</li><?py
10-
#endfor ?>
11-
12-
</{== tag ==}>
13-
<?py if 'more' in entry: ?>
14-
<a href="${root_url}/${entry['address']}">${entry['more']}</a>
15-
<?py #endif ?>
16-
</div>
17-
1+
<div class="card">
2+
<div class="card-body">
3+
<h5 class="card-title">${entry['title']}</h2>
4+
<?py tag = 'ul' if entry.get('bullets') else 'ol' ?>
5+
<{== tag ==} class="card-text">
6+
<?py echo(' ') ?>
7+
<?py for i in entry['packages']: ?>
8+
<li>
9+
<a href="${root_url}/package/${i}">${i}</a>
10+
</li>
11+
<?py #endfor ?>
12+
</{== tag ==}>
13+
<?py if 'more' in entry: ?>
14+
<a class="btn btn-primary" href="${root_url}/${entry['address']}">${entry['more']}</a>
15+
<?py #endif ?>
16+
</div>
17+
</div>

0 commit comments

Comments
 (0)