steal front page fonts from samth
This commit is contained in:
parent
7cea25c79f
commit
4d97b5d74d
|
@ -175,47 +175,90 @@
|
||||||
"s.parentNode.insertBefore(ga, s);\n"
|
"s.parentNode.insertBefore(ga, s);\n"
|
||||||
"})();"))
|
"})();"))
|
||||||
|
|
||||||
(define (serve-home request)
|
;; generate SUBMIT button image
|
||||||
|
;; (require images/icons/control)
|
||||||
|
;; (require images/icons/style)
|
||||||
|
;; (require pict racket/draw)
|
||||||
|
;; (send
|
||||||
|
;; (pict->bitmap
|
||||||
|
;; (cc-superimpose
|
||||||
|
;; (bitmap (record-icon #:color (make-object color% 64 64 255) #:height 64
|
||||||
|
;; #:material glass-icon-material))
|
||||||
|
;; (bitmap (play-icon #:color light-metal-icon-color #:height 32
|
||||||
|
;; #:material metal-icon-material))))
|
||||||
|
;; save-file "htdocs/submit.png" 'png)
|
||||||
|
|
||||||
|
(define-syntax-rule (~~ prop ...) (string-join (list prop ...) ";"))
|
||||||
|
|
||||||
|
;; ----------------------------------------------------------------------------
|
||||||
|
;; serve home -----------------------------------------------------------------
|
||||||
|
(define (serve-home request #:title [title ""]
|
||||||
|
#:content [content ""]
|
||||||
|
#:status [status ""])
|
||||||
(define (response-generator embed/url)
|
(define (response-generator embed/url)
|
||||||
(response/xexpr
|
(response/xexpr
|
||||||
`(html
|
`(html ([style "background-image:url('/plt-back.1024x768.png');"])
|
||||||
|
;; head ----------------------------------------------------------------
|
||||||
(head
|
(head
|
||||||
(title "PasteRack: An evaluating Racket pastebin.")
|
(title "PasteRack: An evaluating Racket pastebin.")
|
||||||
(script ((type "text/javascript")) ,google-analytics-script))
|
(script ((type "text/javascript")) ,google-analytics-script)
|
||||||
(body ((style "margin-top:20px"))
|
(link ([type "text/css"] [rel "stylesheet"]
|
||||||
(div ((style "margin-left:5px;position:relative;float:left;margin-right:-10em"))
|
[href "http://fonts.googleapis.com/css?family=PT+Sans"]))
|
||||||
|
(link ([type "text/css"] [rel "stylesheet"]
|
||||||
|
[href "http://fonts.googleapis.com/css?family=Droid+Sans+Mono"])))
|
||||||
|
;; body ----------------------------------------------------------------
|
||||||
|
(body ((style "font-family:'PT Sans',sans-serif"))
|
||||||
|
;; left --------------------------------------------------------------
|
||||||
|
(div ((style ,(~~ "position:absolute;left:1em;top:2em"
|
||||||
|
"width:12em"
|
||||||
|
"font-size:95%")))
|
||||||
(h4 "Total pastes: " ,(number->string (DBSIZE)))
|
(h4 "Total pastes: " ,(number->string (DBSIZE)))
|
||||||
(h4 "Sample pastes:")
|
(h4 "Sample pastes:")
|
||||||
(table ((style "margin-top:-15px"))
|
(table ((style "margin-top:-15px;font-size:95%"))
|
||||||
,@(for/list ([pnum sample-pastes])
|
,@(for/list ([pnum sample-pastes])
|
||||||
(define name (bytes->string/utf-8 (HGET pnum 'name)))
|
(define name (bytes->string/utf-8 (HGET pnum 'name)))
|
||||||
`(tr (td ,(mk-link (mk-paste-url pnum) pnum))
|
`(tr (td ,(mk-link (mk-paste-url pnum) pnum))
|
||||||
(td ((style "width:1px"))) (td ,name))))
|
(td ((style "width:1px"))) (td ,name))))
|
||||||
(h4 "Recent pastes:")
|
(h4 "Recent pastes:")
|
||||||
(table ((style "margin-top:-15px"))
|
(table ((style "margin-top:-15px;font-size:95%"))
|
||||||
,@(reverse
|
,@(reverse
|
||||||
(for/list ([pnum recent-pastes] #:when pnum)
|
(for/list ([pnum recent-pastes] #:when pnum)
|
||||||
(define name (bytes->string/utf-8 (HGET pnum 'name)))
|
(define name (bytes->string/utf-8 (HGET pnum 'name)))
|
||||||
`(tr (td ,(mk-link (mk-paste-url pnum) pnum))
|
`(tr (td ,(mk-link (mk-paste-url pnum) pnum))
|
||||||
(td ((style "width:1px"))) (td ,name))))))
|
(td ((style "width:1px"))) (td ,name))))))
|
||||||
(div
|
;; middle ------------------------------------------------------------
|
||||||
|
(div ((style ,(~~ "position:absolute;left:14em;top:2em")))
|
||||||
(center
|
(center
|
||||||
(img ((src ,racket-logo-url)))
|
(img ((src ,racket-logo-url)))
|
||||||
(h1 ((style "font-family:sans-serif"))
|
(h2 ,(mk-link pastebin-url "PasteRack")
|
||||||
,(mk-link pastebin-url "PasteRack") ": An evaluating "
|
": An evaluating pastebin for "
|
||||||
,(mk-link racket-lang-url "Racket") " pastebin.")
|
,(mk-link racket-lang-url "Racket") ".")
|
||||||
(form ((action ,(embed/url process-paste)) (method "post"))
|
(form ((action ,(embed/url process-paste)) (method "post"))
|
||||||
(table (tr
|
(table (tr
|
||||||
(td (input ((type "text") (name "name") (size "60"))))
|
(td (input ([type "text"] [name "name"] [size "60"]
|
||||||
(td "(paste title)")))
|
[value ,title]
|
||||||
(textarea ((rows "32") (cols "80") (name "paste")))
|
[style ,(~~ "background-color:#FFFFF0"
|
||||||
|
"border:inset thin"
|
||||||
|
"font-size:105%"
|
||||||
|
"font-family:'PT Sans',sans-serif")])))
|
||||||
|
(td ((style "font-size:90%")) "(paste title)")))
|
||||||
|
(textarea ([style ,(~~ "font-family:'Droid Sans Mono',monospace"
|
||||||
|
"background-color:#FFFFF0"
|
||||||
|
"border:inset"
|
||||||
|
"border-width:thin")]
|
||||||
|
[rows "20"] [cols "80"] [name "paste"]) ,content)
|
||||||
(br)
|
(br)
|
||||||
(table (tr (td ((style "width:10em")))
|
(table (tr
|
||||||
(td ((style "width:8em"))
|
(td ((style "width:11em")))
|
||||||
(input ((type "submit") (value "Submit Paste"))))
|
(td ((style "width:5em"))
|
||||||
(td (input ((type "checkbox") (name "astext") (value "off")))
|
; (input ([type "submit"] [value "Submit Paste and Run"])))
|
||||||
" Submit as text only"))))
|
(input ([type "image"] [alt "Submit Paste and Run"]
|
||||||
|
[src "submit.png"])))
|
||||||
|
(td (input ([type "checkbox"] [name "astext"] [value "off"])))
|
||||||
|
(td ((style "font-size:90%")) " Submit as text only"))
|
||||||
|
(tr (td)(td ,status))))
|
||||||
(br)(br)(br)
|
(br)(br)(br)
|
||||||
|
;; bottom ------------------------------------------------------------
|
||||||
(div ((style "font-size:small;color:#808080"))
|
(div ((style "font-size:small;color:#808080"))
|
||||||
"Powered by " ,(mk-link racket-lang-url "Racket") ". "
|
"Powered by " ,(mk-link racket-lang-url "Racket") ". "
|
||||||
"View "
|
"View "
|
||||||
|
@ -223,7 +266,6 @@
|
||||||
" Report issues or suggestions "
|
" Report issues or suggestions "
|
||||||
,(mk-link "https://github.com/stchang/pasterack/issues" "here") ".")
|
,(mk-link "https://github.com/stchang/pasterack/issues" "here") ".")
|
||||||
))
|
))
|
||||||
(div ((style "width:10em;position:relative;float:right")))
|
|
||||||
))))
|
))))
|
||||||
(send/suspend/dispatch response-generator))
|
(send/suspend/dispatch response-generator))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user