Skip to content

Commit f98e513

Browse files
committed
New homepage and new top nav (#52)
1 parent 0364b87 commit f98e513

13 files changed

+100
-212
lines changed

Foundation.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Settings (widgetFile, Extra (..), GoogleAuth (..))
1111
import Settings.Development (development)
1212
import Settings.StaticFiles
1313
import qualified System.Random.MWC as MWC
14+
import Text.Blaze
1415
import Text.Hamlet (hamletFile)
1516
import Text.Jasmine (minifym)
1617
import Types
@@ -153,6 +154,12 @@ instance Yesod App where
153154
maximumContentLength _ (Just UploadHaddockR{}) = Just 100000000
154155
maximumContentLength _ _ = Just 2000000
155156

157+
instance ToMarkup (Route App) where
158+
toMarkup c = case c of
159+
AllSnapshotsR{} -> "Snapshots"
160+
UploadStackageR{} -> "Upload"
161+
AuthR (LoginR{}) -> "Login"
162+
156163
-- How to run database actions.
157164
instance YesodPersist App where
158165
type YesodPersistBackend App = SqlBackend

Handler/Home.hs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import Yesod.GitRepo (grContent)
1313
-- The majority of the code you will write in Yesod lives in these handler
1414
-- functions. You can spread them across multiple files if you are so
1515
-- inclined, or create a single monolithic file.
16-
getHomeR' :: Handler Html
17-
getHomeR' = contentHelper "Stackage Server" wcHomepage
16+
getHomeR :: Handler Html
17+
getHomeR = contentHelper "Stackage Server" wcHomepage
1818

1919
getAuthorsR :: Handler Html
2020
getAuthorsR = contentHelper "Library Authors" wcAuthors
@@ -27,15 +27,11 @@ contentHelper title accessor = do
2727
homepage <- getYesod >>= fmap accessor . liftIO . grContent . websiteContent
2828
defaultLayout $ do
2929
setTitle title
30-
$(combineStylesheets 'StaticR
31-
[ css_bootstrap_modified_css
32-
, css_bootstrap_responsive_modified_css
33-
])
3430
toWidget homepage
3531

3632
-- FIXME remove this and switch to above getHomeR' when new homepage is ready
37-
getHomeR :: Handler Html
38-
getHomeR = do
33+
getHomeR' :: Handler Html
34+
getHomeR' = do
3935
windowsLatest <- linkFor "unstable-ghc78hp-inclusive"
4036
restLatest <- linkFor "unstable-ghc78-inclusive"
4137
defaultLayout $ do

design/logo.svg

Lines changed: 17 additions & 17 deletions
Loading

static/img/stackage.png

-36.6 KB
Loading

templates/all-snapshots.hamlet

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<div .container>
2-
<h1>Snapshots
3-
$forall stackages <- groups
4-
$forall (_, _, uploaded, _, _) <- take 1 stackages
5-
<h3>
6-
#{uploaded}
7-
<ul .snapshots>
8-
$forall (ident, title, _uploaded, display, handle) <- stackages
9-
<li>
10-
<strong>
11-
<a href=@{SnapshotR ident StackageHomeR}>
12-
#{title}
13-
<p>
14-
#{display} (#{handle})
2+
<div .content>
3+
<h1>Snapshots
4+
$forall stackages <- groups
5+
$forall (_, _, uploaded, _, _) <- take 1 stackages
6+
<h3>
7+
#{uploaded}
8+
<ul .snapshots>
9+
$forall (ident, title, _uploaded, display, handle) <- stackages
10+
<li>
11+
<strong>
12+
<a href=@{SnapshotR ident StackageHomeR}>
13+
#{title}
14+
<p>
15+
#{display} (#{handle})

templates/default-layout-wrapper.hamlet

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ $newline never
2828
<script>
2929
document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/,'js');
3030
<body>
31-
<a href="https://github.com/fpco/stackage-server">
32-
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png">
33-
3431
<div id="main" role="main">
3532
^{pageBody pc}
3633

templates/default-layout.hamlet

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,39 @@
1-
<div .wrap>
2-
<div .container>
3-
<a .logo href=@{HomeR}>
4-
<img src=@{StaticR img_logo_png}>
5-
6-
<div .navbar .navbar-default role=navigation>
7-
<ul .nav>
8-
<li>
9-
<a href=@{AllSnapshotsR}>
10-
Snapshots
1+
<div class="navbar navbar-inverse navbar-static-top">
2+
<div class="navbar-inner">
3+
<div class="container">
4+
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
5+
<span class="icon-bar">
6+
<span class="icon-bar">
7+
<span class="icon-bar">
8+
<a class="brand" href="/">
9+
<img src="/static/img/stackage.png" title="FP Complete">
10+
<div>
11+
<ul class="nav">
12+
$forall route <- [AllSnapshotsR,UploadStackageR,AuthR LoginR]
13+
$maybe current <- cur
14+
$if route == current
15+
<li .active>
16+
<a href=@{route}>#{route}
17+
$else
1118
<li>
12-
<a href=@{PackageListR}>
13-
Packages
14-
<li>
15-
<a href=@{UploadStackageR}>
16-
Upload
17-
$maybe Entity _ user <- muser
18-
<li>
19-
<a href=@{ProfileR}>
20-
<span .user-handle>
21-
#{userHandle user}
22-
<li>
23-
<a href=@{AuthR LogoutR}>Logout
24-
$nothing
25-
<li>
26-
<a href=@{AuthR LoginR}>Login
19+
<a href=@{route}>#{route}
20+
$nothing
21+
<li>
22+
<a href=@{route}>#{route}
23+
2724

28-
$maybe msg <- mmsg
29-
<div .container>
30-
<div .alert .alter-info>#{msg}
25+
$maybe msg <- mmsg
26+
<div .container>
27+
<div .alert .alter-info>#{msg}
3128

32-
$case cur
33-
$of Just (AuthR _)
34-
<div .container>
35-
^{widget}
36-
$of _
29+
$case cur
30+
$of Just (AuthR _)
31+
<div .container>
32+
<h1>Authorization
33+
<p>Please login with an authorization method below:
3734
^{widget}
35+
$of _
36+
^{widget}
3837

3938
<div .footer>
4039
<div .container>

templates/default-layout.julius

Whitespace-only changes.

templates/default-layout.lucius

Lines changed: 24 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -9,74 +9,35 @@ html {
99

1010
body {
1111
background: #f0f0f0;
12-
margin:0 0 4em;
13-
padding:0;
1412
font-family: 'Lato', sans-serif;
1513
text-shadow: 1px 1px 1px #ffffff;
16-
font-size: 20px;
17-
line-height: 30px;
18-
}
19-
20-
p {
21-
margin-top: 20px;
14+
margin-bottom: 4em;
15+
padding-bottom: 2em;
2216
}
2317

24-
code {
18+
code,pre {
2519
color: #555;
20+
font-family: "ubuntu mono", monospace;
2621
}
2722

28-
.wrap {
29-
padding-top: 2em;
30-
padding-left: 15px;
31-
padding-right: 15px;
32-
padding-bottom: 2em;
23+
.brand > img {
24+
height: 20px;
3325
}
3426

35-
h1,h2 {
36-
font-weight: normal;
37-
color: #06537d;
38-
font-size: 45px;
27+
.navbar-inverse .navbar-inner {
28+
background: #0981c3;
3929
}
40-
41-
li + li {
42-
margin-top: 0.5em;
30+
.navbar-inverse .navbar-inner .btn-navbar {
31+
background: #0981c3;
4332
}
44-
45-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
46-
Logo
47-
*/
48-
49-
.logo {
50-
display: block;
51-
width: 300px;
52-
border: 0;
33+
.navbar-inverse .navbar-inner * {
34+
color: #fff !important
5335
}
54-
55-
56-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
57-
Navbar
58-
*/
59-
60-
.navbar .nav > li > a {
61-
padding-left: 0;
62-
color: #0981c3 !important;
63-
}
64-
65-
.navbar {
66-
margin-top: 20px;
67-
font-size: 25px;
68-
.nav {
69-
margin: auto;
70-
}
71-
li {
72-
margin-top: 0;
73-
}
36+
.navbar-inverse .nav .active>a, .navbar-inverse .nav .active>a:hover, .navbar-inverse .nav .active>a:focus {
37+
background: #0981c3 !important;
7438
}
7539

76-
77-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
78-
Footer
79-
*/
40+
.navbar-inner { border-color: #06537d !important; }
8041

8142
.footer {
8243
text-shadow: none;
@@ -106,3 +67,12 @@ li + li {
10667
.alert {
10768
margin-top: 1em;
10869
}
70+
71+
h1,h2,h3,h4,h5 {
72+
color: #06537d
73+
}
74+
75+
.content {
76+
font-size: 20px;
77+
line-height: 30px;
78+
}

0 commit comments

Comments
 (0)