From 12d2296991aad74ec0ae5f837aa27119ca062196 Mon Sep 17 00:00:00 2001 From: hallgren Date: Wed, 15 Jun 2016 10:20:30 +0000 Subject: [PATCH] GF cloud: more readable formatting of the GF version page Factor out common CSS from gfse/editor.css into clouds.css. --- src/compiler/GF/Server.hs | 31 ++++++++++++++++++++++++------- src/www/cloud.css | 20 ++++++++++++++++++++ src/www/gfse/editor.css | 19 ++----------------- src/www/index.html | 2 +- 4 files changed, 47 insertions(+), 25 deletions(-) create mode 100644 src/www/cloud.css diff --git a/src/compiler/GF/Server.hs b/src/compiler/GF/Server.hs index d5c84b87c..de0ec6abc 100644 --- a/src/compiler/GF/Server.hs +++ b/src/compiler/GF/Server.hs @@ -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 = rootrpath -- hmm, check for ".." + versionInfo (c1,c2) = + html200 . unlines $ + "": + "": + "": + "": + ("

"++hdr++"

"): + (zipWith (++) ("

":repeat "
") 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) = ""++rel path++""++show t + sh _ [] = [] + sh hdr gs = + "":("

"++hdr++"

"): + "
GrammarLast modified": + map sh1 gs++ + ["
"] + 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" diff --git a/src/www/cloud.css b/src/www/cloud.css new file mode 100644 index 000000000..30c239f43 --- /dev/null +++ b/src/www/cloud.css @@ -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; } diff --git a/src/www/gfse/editor.css b/src/www/gfse/editor.css index 22805b990..509fc0e6a 100644 --- a/src/www/gfse/editor.css +++ b/src/www/gfse/editor.css @@ -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; -} \ No newline at end of file +} diff --git a/src/www/index.html b/src/www/index.html index 175e76c1d..3e3ad586a 100644 --- a/src/www/index.html +++ b/src/www/index.html @@ -4,7 +4,7 @@ GF Cloud Service - +

GF Cloud Service