Skip to content

Commit

Permalink
Implement styles
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Dec 26, 2017
1 parent 4354ecb commit 7ef1d7d
Show file tree
Hide file tree
Showing 11 changed files with 448 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/lib/.precomp
/alerts.sqlite.db
/static/main.css
/static/.sass-cache/
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

Code for alerts.perl6.org and supporting IRC bot

## DEVELOPMENT

### Website styles

The styles are in `static/main.scss`. You'll need to run `./sassify` to
have [SASS preprocessor](http://sass-lang.com/) watch for changes and
generate CSS styles for the site.


----

#### REPOSITORY
Expand Down
43 changes: 32 additions & 11 deletions bin/server.p6
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ sub MAIN (Str:D :$host = 'localhost', UInt:D :$port = 10000) {
get -> 'alert', Int $id {
content 'text/html', html-render-alerts $Alerts.get: $id
}
get -> 'main.css' { static 'static/main.css' }#$CSS }
get -> 'main.css' { static 'static/main.css' }
get -> 'rss.svg' { static 'static/rss.svg' }
get -> 'api.svg' { static 'static/api.svg' }
get -> 'twitter.svg' { static 'static/twitter.svg' }
get -> 'camelia.svg' { static 'static/camelia.svg' }
}

with Cro::HTTP::Server.new: :$host, :$port, :$application {
Expand All @@ -32,11 +36,19 @@ sub html-render-alerts(*@alerts) {
~ @alerts.map(-> $a {
q:to/✎✎✎✎✎/;
<li class="alert alert-\qq[$a.severity()]">
<p class="info"><a href="/alert/\qq[$a.id()]">#\qq[$a.id()]</a>
| \qq[$a.time-human()]
| posted by \qq[$a.creator()]
| severity: \qq[$a.severity()]
\qq[{"| affects: $a.affects()" if $a.affects}]
<h2 class="info"><a href="/alert/\qq[$a.id()]">#\qq[$a.id()]</a>
<span class="sep">|</span>
<span class="time">\qq[$a.time-human()]</span>
<span class="sep">|</span>
severity: <span class="severity">\qq[$a.severity()]</span>
\qq[{
'<span class="sep">|</span>
affects: <span class="affects">\qq[$a.affects()]</span>'
if $a.affects
}]
<span class="sep">|</span>
posted by <span class="creator">\qq[$a.creator()]</span>
</h2>
<p>\qq[$a.alert()]</p>
</li>
Expand All @@ -57,14 +69,23 @@ sub html-layout-default (Str:D $content) {
<link rel="stylesheet" href="/main.css">
</head>
<body>
<h1>Perl 6 Alerts</h1>
<div id="content">
<h1>
<a href="https://perl6.org/"><img src="/camelia.svg" alt="»ö«"
width=25 height=25></a>
<a href="/">Perl 6 Alerts</a>
<a href="/rss"><img src="/rss.svg" alt="RSS" width=25 height=25></a>
<a href="https://twitter.com/p6lert"
><img src="/twitter.svg" alt="Twitter" width=25 height=25></a>
<a href="/api"
><img src="/api.svg" alt="API" width=25 height=25></a
><small>keeping up to date with important changes</small></h1>
\qq[$content]
<footer>
<small>Code for this website is available at
<a href="https://github.com/perl6/alerts">github.com/perl6/alerts</a>
</footer>
</div>
<footer>
<small>Code for this website is available at
<a href="https://github.com/perl6/alerts">github.com/perl6/alerts</a>
</footer>
</body>
</html>
✎✎✎✎✎
Expand Down
2 changes: 1 addition & 1 deletion lib/P6lert/Alert.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ has Str:D $.affects is required;
has Severity:D $.severity is required;

method time-human {
DateTime.new: $!time
DateTime.new($!time).Date
}
3 changes: 3 additions & 0 deletions sassify
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
cd static
sass --watch main.scss:main.css
20 changes: 20 additions & 0 deletions static/api.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
158 changes: 158 additions & 0 deletions static/camelia.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7ef1d7d

Please sign in to comment.