More visually noticeable navigation bar

svn: r10572

original commit: d2c666f1e7ca100a73505223ffb02d338c7d7d37
This commit is contained in:
Eli Barzilay 2008-07-03 05:27:01 +00:00
parent e820ac1623
commit 995a809f7e
2 changed files with 76 additions and 69 deletions

View File

@ -196,8 +196,7 @@
" background-color: #eee; color: #888;" " background-color: #eee; color: #888;"
" border: 1px solid #ddd; text-align: center;")] " border: 1px solid #ddd; text-align: center;")]
[type "text"] [type "text"]
[value "...search..."] [value "...search manuals..."]
[size "12"]
[title "Enter a search string to search the manuals"] [title "Enter a search string to search the manuals"]
[onkeypress ,(format "return DoSearchKey(event, this, ~s);" (version))] [onkeypress ,(format "return DoSearchKey(event, this, ~s);" (version))]
[onfocus ,(sa "this.style.color=\"black\";" [onfocus ,(sa "this.style.color=\"black\";"
@ -535,9 +534,9 @@
(div ([class "maincolumn"]) (div ([class "maincolumn"])
(div ([class "main"]) (div ([class "main"])
,@(render-version d ri) ,@(render-version d ri)
,@(navigation d ri #f) ,@(navigation d ri #t)
,@(render-part d ri) ,@(render-part d ri)
,@(navigation d ri #t)))))))))) ,@(navigation d ri #f))))))))))
(define/private (part-parent d ri) (define/private (part-parent d ri)
(collected-info-parent (part-collected-info d ri))) (collected-info-parent (part-collected-info d ri)))
@ -564,7 +563,7 @@
(define/public (derive-filename d) "bad.html") (define/public (derive-filename d) "bad.html")
(define/private (navigation d ri pre-space?) (define/private (navigation d ri top?)
(define parent (part-parent d ri)) (define parent (part-parent d ri))
(define-values (prev0 next0) (find-siblings d ri)) (define-values (prev0 next0) (find-siblings d ri))
(define prev (define prev
@ -612,61 +611,63 @@
(make-with-attributes #f (make-with-attributes #f
`([title . ,(if title* (string-append label " to " title*) label)] `([title . ,(if title* (string-append label " to " title*) label)]
,@more)))) ,@more))))
(if (not (or prev next parent index up-path)) (define (navbar)
null `(div ([class "navset"]
`(,@(if pre-space? '((p nbsp)) null) [style ,(let ([v (if top? 'bottom 'top)])
(div ([class "navleft"]) (format "margin-~a: 2em; border-~a: ~a"
,@(render (make-element v v "2px solid #e0e0c0;"))])
(if parent (span ([class "navleft"])
(make-target-url "index.html" #f) ,@(render (make-element
"nonavigation") (if parent
contents-content)) (make-target-url "index.html" #f)
,@(if index "nonavigation")
`(nbsp contents-content))
,@(render (if (eq? d index) ,@(if index
(make-element "nonavigation" index-content) `(nbsp
(make-link-element ,@(render (if (eq? d index)
#f index-content (car (part-tags index))))) (make-element "nonavigation" index-content)
#; ; no need for these index-local searches (make-link-element
,@(if (eq? d index) #f index-content (car (part-tags index)))))
null #; ; no need for these index-local searches
`((span ([class "smaller"]) nbsp ,(search-index-box))))) ,@(if (eq? d index)
null) null
,@(if up-path `(nbsp ,(search-box)) null)) `((span ([class "smaller"]) nbsp ,(search-index-box)))))
(div ([class "navright"]) null)
,@(render ,@(if up-path `(nbsp ,(search-box)) null))
(make-element (span ([class "navright"])
(cond [(not parent) "nonavigation"] ,@(render
[prev (titled-url "backward" prev)] (make-element
[else (titled-url "backward" "index.html" (cond [(not parent) "nonavigation"]
#:title-from [prev (titled-url "backward" prev)]
(and (part? parent) parent))]) [else (titled-url "backward" "index.html"
prev-content) #:title-from
sep-element (and (part? parent) parent))])
(make-element prev-content)
(cond sep-element
[(and (part? parent) (toc-part? parent) (make-element
(part-parent parent ri)) (cond
(titled-url "up" parent)] [(and (part? parent) (toc-part? parent)
[parent (titled-url "up" "index.html" #:title-from parent)] (part-parent parent ri))
;; up-path = #t => go up to the start page, using (titled-url "up" parent)]
;; cookies to get to the user's version of it (see [parent (titled-url "up" "index.html" #:title-from parent)]
;; scribblings/main/private/utils for the code that ;; up-path = #t => go up to the start page, using
;; creates these cookies.) ;; cookies to get to the user's version of it (see
[(eq? #t up-path) ;; scribblings/main/private/utils for the code that
(titled-url ;; creates these cookies.)
"up" "../index.html" [(eq? #t up-path)
`[onclick (titled-url
. ,(format "return GotoPLTRoot(\"~a\");" (version))])] "up" "../index.html"
[up-path (titled-url "up" up-path)] `[onclick
[else "nonavigation"]) . ,(format "return GotoPLTRoot(\"~a\");" (version))])]
up-content) [up-path (titled-url "up" up-path)]
sep-element [else "nonavigation"])
(make-element (if next up-content)
(titled-url "forward" next) sep-element
"nonavigation") (make-element
next-content))) (if next (titled-url "forward" next) "nonavigation")
(p nbsp)))) next-content)))
nbsp)) ; needed to make the navset background visible
(if (or prev next parent index up-path) (list (navbar)) null))
(define/override (render-one d ri fn) (define/override (render-one d ri fn)
(render-one-part d ri fn null)) (render-one-part d ri fn null))

View File

@ -58,18 +58,24 @@ table td {
/* ---------------------------------------- */ /* ---------------------------------------- */
/* Navigation */ /* Navigation */
.navset {
background-color: #f0f0e0;
}
.navleft { .navleft {
margin-left: 1ex;
position: relative; position: relative;
float: left; float: left;
white-space: nowrap; white-space: nowrap;
} }
.navright { .navright {
margin-right: 1ex;
position: relative; position: relative;
float: right; float: right;
white-space: nowrap; white-space: nowrap;
} }
.nonavigation { .nonavigation {
color: #EEEEEE; color: #e0e0e0;
} }
/* ---------------------------------------- */ /* ---------------------------------------- */
@ -116,15 +122,15 @@ table td {
/* Table of contents, inline */ /* Table of contents, inline */
.toclink { .toclink {
text-decoration: none; text-decoration: none;
color: blue; color: blue;
font-size: 85%; font-size: 85%;
} }
.toptoclink { .toptoclink {
text-decoration: none; text-decoration: none;
color: blue; color: blue;
font-weight: bold; font-weight: bold;
} }
/* ---------------------------------------- */ /* ---------------------------------------- */
@ -139,13 +145,13 @@ font-weight: bold;
.tocview { .tocview {
text-align: left; text-align: left;
background-color: #F5F5DC; background-color: #f0f0e0;
} }
.tocsub { .tocsub {
text-align: left; text-align: left;
margin-top: 0.5em; margin-top: 0.5em;
background-color: #F5F5F5; background-color: #f0f0e0;
} }
.tocviewtitle { .tocviewtitle {