From 547957fb4ddb7a73fad1ab881be3117f92c2108f Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 10 Feb 2014 16:18:20 -0700 Subject: [PATCH] reduce dependencies for non-page-style mode --- .../meta/new-web/stubs/pkgs.rkt | 5 +- .../meta/new-web/www/index.rkt | 16 ++-- .../meta/new-web/www/resources.rkt | 6 +- .../plt-web-pkgs/plt-web-lib/layout.rkt | 17 ++-- .../plt-web-pkgs/plt-web-lib/resources.rkt | 86 +++++++++---------- .../plt-web-lib/resources/css/gumby-slice.css | 39 +-------- 6 files changed, 68 insertions(+), 101 deletions(-) diff --git a/new-racket-web/new-plt-services/meta/new-web/stubs/pkgs.rkt b/new-racket-web/new-plt-services/meta/new-web/stubs/pkgs.rkt index 9701b74532..69a5e12fe2 100644 --- a/new-racket-web/new-plt-services/meta/new-web/stubs/pkgs.rkt +++ b/new-racket-web/new-plt-services/meta/new-web/stubs/pkgs.rkt @@ -1,8 +1,7 @@ #lang plt-web -(require (only-in "../www/resources.rkt" www-site)) - -(define pkgs-site (site "stubs/pkgs" #:resources (site-resources www-site))) +(define pkgs-site (site "stubs/pkgs" + #:page-style? #f)) (provide pkgs) (define pkgs diff --git a/new-racket-web/new-plt-services/meta/new-web/www/index.rkt b/new-racket-web/new-plt-services/meta/new-web/www/index.rkt index fc12cc11b4..a021e95323 100644 --- a/new-racket-web/new-plt-services/meta/new-web/www/index.rkt +++ b/new-racket-web/new-plt-services/meta/new-web/www/index.rkt @@ -344,8 +344,8 @@ computing and from databases to charts. @columns[3 style: "text-color: black"]{ @h2[style: "font-size: 180%; margin-bottom: 10pt"]{News} - @p{Racket version 5.6 has been released.} - @p{@a[href: "racketcon.html"]{RacketCon 2014} will be in September in St Louis.}}} + @p{Racket version 6.0 has been released.} + @p{@a[href: "http://con.racket-lang.org/"]{RacketCon 2014} will be in September in St Louis.}}} @columns[12 #:row? #t #:center? #t style: "text-align:justify;font-size: 120%; margin-top: 20pt; "]{ @@ -423,11 +423,11 @@ explains how to install @row{ @columns[4]{ @panetitle{News & Events} -@p{@a[href: "racketcon.html"]{RacketCon} — The annual +@p{@a[href: "http://con.racket-lang.org/"]{RacketCon} — The annual Racket meeting, coming up in September. Previously - in @a[href: "http://con.racket-lang.org/2013"]{2013}, - @a[href: "http://con.racket-lang.org/2012"]{2012}, - and @a[href: "http://con.racket-lang.org/2011"]{2011}.} + in @a[href: "http://con.racket-lang.org/2013/"]{2013}, + @a[href: "http://con.racket-lang.org/2012/"]{2012}, + and @a[href: "http://con.racket-lang.org/2011/"]{2011}.} @p{@a[href: "http://blog.racket-lang.org/"]{Blog} — Announcements, helpful hints, and thoughtful rants.} @@ -443,7 +443,7 @@ explains how to install Chat in the @tt[style: "background-color: #d8d8e8;"]{@big{@strong{#racket}}} channel on @a[href: "http://freenode.net"]{@tt{freenode.net}} — An informal discussion channel for all things related to Racket. -(@a[href: "https://botbot.me/freenode/racket/"]{Browse the logs}.)} +@a[href: "https://botbot.me/freenode/racket/"]{Browse the logs}.} @p{@people — The people behind Racket.} @@ -480,7 +480,7 @@ File, query, and maybe fix existing reports.}}} @li{Aimed at the programming novice.}}} @columns[4]{@panetitle{Realm of Racket} - @p{Learn Racket and programming, one game at a time/} + @p{Learn Racket and programming, one game at a time.} @ul{ @li{Sample game code comes with the Racket distribution.} @li{For those just starting out with Racket.} diff --git a/new-racket-web/new-plt-services/meta/new-web/www/resources.rkt b/new-racket-web/new-plt-services/meta/new-web/www/resources.rkt index 6a7324c95f..75d0a0a21e 100644 --- a/new-racket-web/new-plt-services/meta/new-web/www/resources.rkt +++ b/new-racket-web/new-plt-services/meta/new-web/www/resources.rkt @@ -7,7 +7,7 @@ (site "www" #:navigation (list - @a[href: "http://pkgs.racket-lang.org"]{Packages} - @a[href: "http://docs.racket-lang.org"]{Documentation} - @a[href: "http://blog.racket-lang.org"]{Blog} + @a[href: (resource "stubs/pkgs" #f)]{Packages} + @a[href: (resource "stubs/docs" #f)]{Documentation} + @a[href: (resource "stubs/blog" #f)]{Blog} @navigation-button[@(a href: (resource "download/" #f) "Download")]))) diff --git a/new-racket-web/plt-web-pkgs/plt-web-lib/layout.rkt b/new-racket-web/plt-web-pkgs/plt-web-lib/layout.rkt index 638f9aaf4d..30d05acd59 100644 --- a/new-racket-web/plt-web-pkgs/plt-web-lib/layout.rkt +++ b/new-racket-web/plt-web-pkgs/plt-web-lib/layout.rkt @@ -136,7 +136,7 @@ (list-ref l n) d)) -(define ((navbar-maker logo columns) this) +(define ((navbar-maker logo columns page-style?) this) (define (icon name) @i[class: name]{}) (define (row . content) (apply div class: "row" content)) @@ -144,8 +144,10 @@ @div[class: "navbar gumby-content" gumby-fixed: "top" id: "nav1"]{ @row{ - @a[class: "toggle" gumby-trigger: "#nav1 > .row > ul" href: "#"]{ - @icon{icon-menu}} + @(if page-style? + @a[class: "toggle" gumby-trigger: "#nav1 > .row > ul" href: "#"]{ + @icon{icon-menu}} + '()) @a[class: "five columns logo" href: (url-of main-promise)]{ @img[class: "logo" src: logo width: "198" height: "60" alt: "Racket"]} @ul[class: "five columns"]{ @@ -211,7 +213,8 @@ @;@link[rel: "stylesheet" href: (resources "style.css")] @; TODO: Modify `racket-style' definition (and what it depends on) @; in "resources.rkt", possibly do something similar with the new files - @link[rel: "stylesheet" type: "text/css" href: style title: "default"] + @(and style + @link[rel: "stylesheet" type: "text/css" href: style title: "default"]) @; TODO: Edit the `more.css' definition in www/index.rkt @; More ideas for your here: h5bp.com/d/head-Tips @; All JavaScript at the bottom, except for Modernizr / Respond. @@ -234,9 +237,9 @@ [(make-navbar) make-navbar] ; page -> navbar [(icon-headers) icon-headers] ;; aliases for specific resource files - [(style-path) (resources "plt.css")] + [(style-path) (and page-style? (resources "plt.css"))] [(logo-path) (resources "logo-and-text.png")] - [(icon-path) (resources "plticon.ico")] + [(icon-path) (and page-style? (resources "plticon.ico"))] ;; get a resource file path [else (cond [(assoc what files) ;; delay the `url-of' until we're in the rendering context @@ -244,7 +247,7 @@ [else (error 'resource "unknown resource: ~e" what)])])) (define icon-headers (html-icon-headers (resources 'icon-path))) (define headers (html-headers resources icon-headers page-style?)) - (define make-navbar (navbar-maker (resources 'logo-path) navigation)) + (define make-navbar (navbar-maker (resources 'logo-path) navigation page-style?)) (define preamble (cons @doctype['html] (if page-style? gumby-preamble null))) (define postamble (if page-style? (make-gumby-postamble resources) null)) diff --git a/new-racket-web/plt-web-pkgs/plt-web-lib/resources.rkt b/new-racket-web/plt-web-pkgs/plt-web-lib/resources.rkt index ca5022db42..83f6d22d5e 100644 --- a/new-racket-web/plt-web-pkgs/plt-web-lib/resources.rkt +++ b/new-racket-web/plt-web-pkgs/plt-web-lib/resources.rkt @@ -20,7 +20,7 @@ ;; they can be #t (the default) for the standard ones, or some text that gets ;; added to the standard contents -- which is the user-agent line and the ;; ErrorDocument respectively. -(define (make-resource-files page dir robots htaccess navigation?) +(define (make-resource-files page dir robots htaccess page-style?) ;; the default target argument duplicate the behavior in "utils.rkt" (define (copyfile file [target (basename file)]) (list target (copyfile-resource (build-path resources-dir file) (web-path dir target)))) @@ -31,11 +31,12 @@ (list file (apply page (string->symbol (regexp-replace #rx"[.]html$" file "")) contents))) - `(,(writefile "plt.css" racket-style) + `(,@(if page-style? + (list + (writefile "plt.css" racket-style)) + null) ,(copyfile "logo-and-text.png" "logo-and-text.png") - ,(copyfile "logo.png" "logo.png") ; a kind of backward compatibility, just in case - ,(copyfile "plticon.ico" "plticon.ico") - ,@(if navigation? + ,@(if page-style? (list (copyfile "css/gumby.css" "gumby.css") (copyfile "js/libs/jquery-1.9.1.min.js" "jquery-1.9.1.min.js") @@ -48,32 +49,37 @@ (copyfile "fonts/icons/entypo.eot" "entypo.eot")) (list (copyfile "css/gumby-slice.css" "gumby-slice.css"))) - ;; the following resources are not used directly, so their names are - ;; irrelevant - @,writefile["google5b2dc47c0b1b15cb.html"]{ - google-site-verification: google5b2dc47c0b1b15cb.html} - @,writefile["BingSiteAuth.xml"]{ - - 140BE58EEC31CB97382E1016E21C405A} - ;; #t (the default) => no-op file, good to avoid error-log lines - ,(let* ([t (if (eq? #t robots) "Disallow:" robots)] - [t (and t (list "User-agent: *\n" t))]) - (if t (writefile "robots.txt" t) '(#f #f))) - ;; There are still some clients that look for a favicon.ico file - ,(copyfile "plticon.ico" "favicon.ico") - @,pagefile["page-not-found.html"]{ - @h3[style: "text-align: center; margin: 3em 0 1em 0;"]{ - Page not found} - @(λ xs (table align: 'center (tr (td (pre xs))))){ - > (@a[href: "/"]{(uncaught-exception-handler)} - (*(+(*)(*(+(*)(*)(*)(*)(*))(+(*)(*)(*)(*)(*))(+(*)(*)(*)(*))))@; - (+(*)(*)(*)(*)))) - uncaught exception: 404}} - ;; set the 404 page in htaccess instead of in the conf file, so we get it - ;; only in sites that we generate here - ,(let* ([t (and htaccess "ErrorDocument 404 /page-not-found.html")] - [t (if (boolean? htaccess) t (list htaccess "\n" t))]) - (if t (writefile ".htaccess" t) '(#f #f))))) + ,@(if page-style? + (list + (copyfile "plticon.ico" "plticon.ico") + (copyfile "logo.png" "logo.png") ; a kind of backward compatibility, just in case + ;; the following resources are not used directly, so their names are + ;; irrelevant + @writefile["google5b2dc47c0b1b15cb.html"]{ + google-site-verification: google5b2dc47c0b1b15cb.html} + @writefile["BingSiteAuth.xml"]{ + + 140BE58EEC31CB97382E1016E21C405A} + ;; #t (the default) => no-op file, good to avoid error-log lines + (let* ([t (if (eq? #t robots) "Disallow:" robots)] + [t (and t (list "User-agent: *\n" t))]) + (if t (writefile "robots.txt" t) '(#f #f))) + ;; There are still some clients that look for a favicon.ico file + (copyfile "plticon.ico" "favicon.ico") + @pagefile["page-not-found.html"]{ + @h3[style: "text-align: center; margin: 3em 0 1em 0;"]{ + Page not found} + @(λ xs (table align: 'center (tr (td (pre xs))))){ + > (@a[href: "/"]{(uncaught-exception-handler)} + (*(+(*)(*(+(*)(*)(*)(*)(*))(+(*)(*)(*)(*)(*))(+(*)(*)(*)(*))))@; + (+(*)(*)(*)(*)))) + uncaught exception: 404}} + ;; set the 404 page in htaccess instead of in the conf file, so we get it + ;; only in sites that we generate here + (let* ([t (and htaccess "ErrorDocument 404 /page-not-found.html")] + [t (if (boolean? htaccess) t (list htaccess "\n" t))]) + (if t (writefile ".htaccess" t) '(#f #f)))) + null))) (define page-sizes @list{ @@ -81,22 +87,14 @@ margin-right: auto; width: 45em; }) + +(define navbar-style + @list{}) + (define font-family @list{ font-family: Optima, Arial, Verdana, Helvetica, sans-serif; }) -(define navbar-style - @list{ - .logoname { - @font-family - decoration: none; - color: white; - font-size: 44px; - font-weight: bold; - top: 0; - position: absolute; - } - }) (define racket-style @list{ @@ -120,8 +118,6 @@ .bodycontent { @page-sizes } - @; ---- styles for the navbar ---- - @navbar-style @; ---- styles for extras ---- .parlisttitle { margin-bottom: 0.5em; diff --git a/new-racket-web/plt-web-pkgs/plt-web-lib/resources/css/gumby-slice.css b/new-racket-web/plt-web-pkgs/plt-web-lib/resources/css/gumby-slice.css index cae249facf..28721c8a46 100644 --- a/new-racket-web/plt-web-pkgs/plt-web-lib/resources/css/gumby-slice.css +++ b/new-racket-web/plt-web-pkgs/plt-web-lib/resources/css/gumby-slice.css @@ -1,5 +1,4 @@ @charset "UTF-8"; -@import url(http://fonts.googleapis.com/css?family=Open+Sans:500,400,300,600,700); /** * Gumby Framework * --------------- @@ -21,14 +20,12 @@ * header work. */ -.gumby-content { background: white; font-family: "Open Sans"; font-weight: 400; color: #1e1e1e; position: relative; -webkit-font-smoothing: antialiased; } +/* Banner needs 0 margin for body: */ +body { margin: 0px; padding: 0px; } + +.gumby-content { background: white; color: #1e1e1e; position: relative; -webkit-font-smoothing: antialiased; } @media only screen and (max-width: 767px) { .gumby-content { -webkit-text-size-adjust: none; -ms-text-size-adjust: none; width: 100%; min-width: 0; } } -/* Fonts */ -@font-face { font-family: "entypo"; font-style: normal; font-weight: 400; src: url(./entypo.eot); src: url("./entypo.eot?#iefix") format("ie9-skip-eot"), url("./entypo.woff") format("woff"), url("./entypo.ttf") format("truetype"); } - -.subhead { color: #777; font-weight: normal; margin-bottom: 20px; } - .row { width: 100%; max-width: 940px; min-width: 320px; margin: 0 auto; } @media only screen and (max-width: 960px) { .row { padding: 0 20px; } } .row .row { min-width: 0px; } @@ -39,8 +36,6 @@ .column:first-child, .columns:first-child, .alpha { margin-left: 0px; } -.column.omega, .columns.omega { float: right; } - /* Column Classes */ .row .five.columns { width: 40.42553%; } @@ -50,11 +45,6 @@ .navbar { width: 100%; min-height: 60px; display: block; margin-bottom: 20px; background: black; } @media only screen and (max-width: 767px) { .navbar { position: relative; border: none; } .navbar .column, .navbar .columns { min-height: 0; } } -.navbar.fixed { top: 0; left: 0; z-index: 99999; } -.navbar a.toggle { display: none; } -@media only screen and (max-width: 767px) { .navbar a.toggle { top: 18%; right: 4%; width: 46px; position: absolute; text-align: center; display: inline-block; color: white; background: black; height: 40px; line-height: 38px; -webkit-border-radius: 4px; -moz-border-radius: 4px; -ms-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; font-size: 30px; font-size: 1.875rem; } - .navbar a.toggle:hover { background: #0d0d0d; } - .navbar a.toggle:active, .navbar a.toggle.active { background: black; } } .navbar .logo { display: inline-block; margin: 0 2.12766% 0 0; padding: 0; height: 60px; line-height: 58px; } .navbar .logo a { display: block; padding: 0 0 0 16px; overflow: hidden; height: 60px; line-height: 58px; } .navbar .logo a img { max-height: 95%; } @@ -68,19 +58,6 @@ @media only screen and (max-width: 767px) { .navbar ul li { display: block; position: relative; min-height: 50px; max-height: 320px; height: auto; width: 100%; border-right: 0 !important; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; -webkit-transition-duration: 0.5s; -moz-transition-duration: 0.5s; -o-transition-duration: 0.5s; transition-duration: 0.5s; } } .navbar ul li > a { display: block; padding: 0 16px; white-space: nowrap; color: white; text-shadow: 0 1px 2px black, 0 1px 0 black; height: 60px; line-height: 58px; font-size: 16px; font-size: 1rem; } .navbar ul li > a i.icon-popup { position: absolute; } -.navbar ul li .btn { border-color: black !important; } -.navbar ul li.field { margin-bottom: 0 !important; margin-right: 0; } -@media only screen and (max-width: 767px) { .navbar ul li.field { padding: 0 20px; } } -.navbar ul li.field input.search { background: black; border: none; color: #f2f2f2; } -.navbar ul li .dropdown { width: auto; min-width: 0px; max-width: 320px; height: 0; position: absolute; background: #fafafa; overflow: hidden; z-index: 999; } -@media only screen and (max-width: 767px) { .navbar ul li .dropdown { width: 100%; max-width: 100%; position: relative; -webkit-box-shadow: none !important; -moz-box-shadow: none !important; box-shadow: none !important; } - .navbar ul li.active .dropdown { border-bottom: 1px solid black; } - .navbar ul li.active .dropdown ul { position: relative; top: 0; background: black; min-height: 50px; max-height: 250px; height: auto; overflow: auto; -webkit-box-shadow: none !important; -moz-box-shadow: none !important; box-shadow: none !important; } - .navbar ul li.active .dropdown ul li { min-height: 50px; border-bottom: black; } - .navbar ul li.active .dropdown ul li a { color: white; border-bottom: 1px solid black; } - .navbar ul li.active .dropdown ul li a:hover { color: #d04526; } } -@media only screen and (min-width: 768px) and (max-width: 939px) { .navbar > ul > li > .btn a { padding: 0 10px 0 10px !important; } - .navbar ul > li .dropdown ul li.active .dropdown { left: -320px; } } /**** Navbar positioning for Microsoft's browser who deserves not to be mentioned ****/ .ie7 .navbar > ul { width: auto; } @@ -92,11 +69,3 @@ .ie7 .navbar .logo a { display: block; overflow: hidden; } .ie7 .navbar > ul > li .field { display: block; padding: 12px 18px 0; width: 80%; } - -.navbar li .dropdown ul { margin: 0; display: block; } -.navbar li .dropdown ul > li { position: relative; display: block; width: 100%; float: left; text-align: left; height: auto; -webkit-border-radius: none; -moz-border-radius: none; -ms-border-radius: none; -o-border-radius: none; border-radius: none; } -@media only screen and (min-width: 768px) and (max-width: 939px) { .navbar li .dropdown ul > li { max-width: 320px; word-wrap: break-word; } } -.navbar li .dropdown ul > li a { display: block; padding: 0 20px; color: #d04526; border-bottom: 1px solid #cccccc; text-shadow: none; height: 51px; line-height: 49px; } -@media only screen and (max-width: 767px) { .navbar li .dropdown ul > li a { padding: 0 20px; } } -.navbar li .dropdown ul > li .dropdown { display: none; background: white; } -.navbar li .dropdown ul li:first-child a { -webkit-border-radius: 0; -moz-border-radius: 0; -ms-border-radius: 0; -o-border-radius: 0; border-radius: 0; }