GF cloud: more readable formatting of the GF version page

Factor out common CSS from gfse/editor.css into clouds.css.
This commit is contained in:
hallgren
2016-06-15 10:20:30 +00:00
parent 1465a825d5
commit 12d2296991
4 changed files with 47 additions and 25 deletions

View File

@@ -161,11 +161,7 @@ handle logLn documentroot state0 cache execute1 stateVar
-- "/stop" ->
-- "/start" ->
"/parse" -> parse (decoded qs)
"/version" -> do (c1,c2) <- PS.listPGFCache cache
let rel = makeRelative documentroot
sh1 (path,t) = rel path++" "++show t
sh = map sh1
return $ ok200 (unlines (gf_version:"":sh c1++"":sh c2))
"/version" -> versionInfo `fmap` PS.listPGFCache cache
"/flush" -> do PS.flushPGFCache cache; return (ok200 "flushed")
'/':rpath ->
-- This code runs without mutual exclusion, so it must *not*
@@ -183,6 +179,27 @@ handle logLn documentroot state0 cache execute1 stateVar
translatePath rpath = root</>rpath -- hmm, check for ".."
versionInfo (c1,c2) =
html200 . unlines $
"<!DOCTYPE html>":
"<meta name = \"viewport\" content = \"width = device-width\">":
"<link rel=\"stylesheet\" type=\"text/css\" href=\"cloud.css\" title=\"Cloud\">":
"":
("<h2>"++hdr++"</h2>"):
(zipWith (++) ("<p>":repeat "<br>") buildinfo)++
sh "Haskell run-time system" c1++
sh "C run-time system" c2
where
hdr:buildinfo = lines gf_version
rel = makeRelative documentroot
sh1 (path,t) = "<tr><td>"++rel path++"<td>"++show t
sh _ [] = []
sh hdr gs =
"":("<h3>"++hdr++"</h3>"):
"<table class=loaded_grammars><tr><th>Grammar<th>Last modified":
map sh1 gs++
["</table>"]
wrapCGI cgi = cgiHandler root (handleErrors . handleCGIErrors $ cgi) rq
look field =
@@ -371,7 +388,7 @@ ok200' t = Response 200 [t,xo]
json200 x = json200' id x
json200' f = ok200' jsonUTF8 . encodeString . f . encode
jsonp200' f = ok200' jsonpUTF8 . encodeString . f . encode
--html200 = ok200' htmlUTF8 . encodeString
html200 = ok200' htmlUTF8 . encodeString
resp204 = Response 204 [xo] "" -- no content
resp301 url = Response 301 [plain,xo,location url] $
"Moved permanently to "++url
@@ -389,7 +406,7 @@ plain = ct "text/plain" ""
plainUTF8 = ct "text/plain" csutf8
jsonUTF8 = ct "application/json" csutf8 -- http://www.ietf.org/rfc/rfc4627.txt
jsonpUTF8 = ct "application/javascript" csutf8
--htmlUTF8 = ct "text/html" csutf8
htmlUTF8 = ct "text/html" csutf8
ct t cs = ("Content-Type",t++cs)
csutf8 = "; charset=UTF-8"

20
src/www/cloud.css Normal file
View File

@@ -0,0 +1,20 @@
body { color: black; background: #eee; }
h1 { font-size: 175%; }
h1,h2,h3,h4,small { font-family: sans-serif;}
h1,h2,h3,h4 { color: #303030; text-shadow: rgba(0,0,0,0.25) 3px 3px 5px; }
h1:first-child, h2:first-child { margin-top: 0; margin-bottom: 1ex; }
h1 img { float: right; border: 0; max-width: 50%; }
h1 img.nofloat { float: none; }
img.cloud, img.right, div.right, div.modtime, div.version { float: right; }
li { margin-top: 0.5ex; margin-bottom: 0.5ex; }
div.modtime >small { visibility: hidden; }
div.modtime:hover >small { visibility: visible; }
.modtime,.version { color: #999; white-space: nowrap; }
table.loaded_grammars th { text-align: left; font-family: sans-serif; }
table.loaded_grammars td { padding-right: 1em; font-family: monospace; }
table.loaded_grammars tr td:nth-child(2) { color: #555; }

View File

@@ -1,11 +1,4 @@
body { color: black; background: #eee; }
h1 { font-size: 175%; }
h1,h2,h3,h4,small { font-family: sans-serif;}
h1,h2,h3,h4 { color: #303030; text-shadow: rgba(0,0,0,0.25) 3px 3px 5px; }
h1:first-child, h2:first-child { margin-top: 0; margin-bottom: 1ex; }
h1 img { float: right; border: 0; max-width: 50%; }
h1 img.nofloat { float: none; }
@import url(../cloud.css);
#editor {
/* This allows the div to grow wider than the window if necessary to
@@ -33,12 +26,6 @@ table.extension td { border-left-width: 0; min-width: 30em; }
.slideshow .hidden { display: none; }
img.cloud, img.right, div.right, div.modtime, div.version { float: right; }
div.modtime >small { visibility: hidden; }
div.modtime:hover >small { visibility: visible; }
.modtime,.version { color: #999; white-space: nowrap; }
table.grammar_list { border-collapse: collapse; margin-left: 1.0em; }
table.grammar_list td { padding: 0.4ex 0.25em; }
@@ -120,8 +107,6 @@ textarea.string_edit { vertical-align: top; }
ul.languages { -moz-column-width: 10em; }
li { margin-top: 0.5ex; margin-bottom: 0.5ex; }
#sharing h1, #sharing .footer { display: none; }
div.compiler_output .back_to_editor { display: none; }
@@ -164,4 +149,4 @@ div.sheet {
-o-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-webkit-transition: all 0.5s ease-in-out;
}
}

View File

@@ -4,7 +4,7 @@
<title>GF Cloud Service</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="gfse/editor.css" title="Cloud">
<link rel="stylesheet" type="text/css" href="cloud.css" title="Cloud">
<meta name = "viewport" content = "width = device-width">
<h1><a href="http://www.grammaticalframework.org/"><img src="Logos/gf0.png" alt=""></a><img class=nofloat src="P/gf-cloud.png" alt=""> GF Cloud Service</h1>