Skip to content

Commit 7ef1d7d

Browse files
committed
Implement styles
1 parent 4354ecb commit 7ef1d7d

File tree

11 files changed

+448
-33
lines changed

11 files changed

+448
-33
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/lib/.precomp
22
/alerts.sqlite.db
3+
/static/main.css
4+
/static/.sass-cache/

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
Code for alerts.perl6.org and supporting IRC bot
44

5+
## DEVELOPMENT
6+
7+
### Website styles
8+
9+
The styles are in `static/main.scss`. You'll need to run `./sassify` to
10+
have [SASS preprocessor](http://sass-lang.com/) watch for changes and
11+
generate CSS styles for the site.
12+
13+
514
----
615

716
#### REPOSITORY

bin/server.p6

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ sub MAIN (Str:D :$host = 'localhost', UInt:D :$port = 10000) {
1414
get -> 'alert', Int $id {
1515
content 'text/html', html-render-alerts $Alerts.get: $id
1616
}
17-
get -> 'main.css' { static 'static/main.css' }#$CSS }
17+
get -> 'main.css' { static 'static/main.css' }
18+
get -> 'rss.svg' { static 'static/rss.svg' }
19+
get -> 'api.svg' { static 'static/api.svg' }
20+
get -> 'twitter.svg' { static 'static/twitter.svg' }
21+
get -> 'camelia.svg' { static 'static/camelia.svg' }
1822
}
1923

2024
with Cro::HTTP::Server.new: :$host, :$port, :$application {
@@ -32,11 +36,19 @@ sub html-render-alerts(*@alerts) {
3236
~ @alerts.map(-> $a {
3337
q:to/✎✎✎✎✎/;
3438
<li class="alert alert-\qq[$a.severity()]">
35-
<p class="info"><a href="/alert/\qq[$a.id()]">#\qq[$a.id()]</a>
36-
| \qq[$a.time-human()]
37-
| posted by \qq[$a.creator()]
38-
| severity: \qq[$a.severity()]
39-
\qq[{"| affects: $a.affects()" if $a.affects}]
39+
<h2 class="info"><a href="/alert/\qq[$a.id()]">#\qq[$a.id()]</a>
40+
<span class="sep">|</span>
41+
<span class="time">\qq[$a.time-human()]</span>
42+
<span class="sep">|</span>
43+
severity: <span class="severity">\qq[$a.severity()]</span>
44+
\qq[{
45+
'<span class="sep">|</span>
46+
affects: <span class="affects">\qq[$a.affects()]</span>'
47+
if $a.affects
48+
}]
49+
<span class="sep">|</span>
50+
posted by <span class="creator">\qq[$a.creator()]</span>
51+
</h2>
4052
4153
<p>\qq[$a.alert()]</p>
4254
</li>
@@ -57,14 +69,23 @@ sub html-layout-default (Str:D $content) {
5769
<link rel="stylesheet" href="/main.css">
5870
</head>
5971
<body>
60-
<h1>Perl 6 Alerts</h1>
6172
<div id="content">
73+
<h1>
74+
<a href="https://perl6.org/"><img src="/camelia.svg" alt="»ö«"
75+
width=25 height=25></a>
76+
<a href="/">Perl 6 Alerts</a>
77+
<a href="/rss"><img src="/rss.svg" alt="RSS" width=25 height=25></a>
78+
<a href="https://twitter.com/p6lert"
79+
><img src="/twitter.svg" alt="Twitter" width=25 height=25></a>
80+
<a href="/api"
81+
><img src="/api.svg" alt="API" width=25 height=25></a
82+
><small>keeping up to date with important changes</small></h1>
6283
\qq[$content]
84+
<footer>
85+
<small>Code for this website is available at
86+
<a href="https://github.com/perl6/alerts">github.com/perl6/alerts</a>
87+
</footer>
6388
</div>
64-
<footer>
65-
<small>Code for this website is available at
66-
<a href="https://github.com/perl6/alerts">github.com/perl6/alerts</a>
67-
</footer>
6889
</body>
6990
</html>
7091
✎✎✎✎✎

lib/P6lert/Alert.pm6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ has Str:D $.affects is required;
1212
has Severity:D $.severity is required;
1313

1414
method time-human {
15-
DateTime.new: $!time
15+
DateTime.new($!time).Date
1616
}

sassify

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
cd static
3+
sass --watch main.scss:main.css

static/api.svg

Lines changed: 20 additions & 0 deletions
Loading

static/camelia.svg

Lines changed: 158 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)