Browse Source

bugfix: google web fonts enabled

master
Christian Mueller 12 years ago
parent
commit
58f61b5caa
  1. 7
      resources/public/style.less
  2. 19
      src/NoteHub/views/common.clj

7
resources/public/style.less

@ -10,6 +10,9 @@
@width: 800px; @width: 800px;
@header_font: 'Noticia Text';
@text_font: 'Georgia';
// mixins // mixins
.helvetica { .helvetica {
font-weight: 300; font-weight: 300;
@ -109,7 +112,7 @@ html, body {
article { article {
.central-element; .central-element;
margin-top: 5em; margin-top: 5em;
font-family: 'Georgia'; font-family: @text_font, 'Georgia';
text-align: justify; text-align: justify;
font-size: 1.2em; font-size: 1.2em;
} }
@ -155,5 +158,5 @@ h1 {
margin-bottom: 3em; margin-bottom: 3em;
} }
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
font-family: 'Noticia Text','PT Serif','Georgia'; font-family: @header_font,'Noticia Text','PT Serif','Georgia';
} }

19
src/NoteHub/views/common.clj

@ -19,7 +19,9 @@
[params title & content] [params title & content]
; for the sake of security: escape all symbols of the param values ; for the sake of security: escape all symbols of the param values
(let [params (into {} (for [[k v] params] [k (escape-html v)])) (let [params (into {} (for [[k v] params] [k (escape-html v)]))
theme (:theme params "default")] theme (:theme params "default")
header-font (:header-font params)
text-font (:text-font params)]
(html5 (html5
[:head [:head
[:title (print-str (get-message :name) "—" title)] [:title (print-str (get-message :name) "—" title)]
@ -28,14 +30,8 @@
[:link {:href [:link {:href
(clojure.string/replace (clojure.string/replace
(str "http://fonts.googleapis.com/css?family=" (str "http://fonts.googleapis.com/css?family="
(apply (apply str
str (interpose "|" ["PT+Serif:700" "Noticia+Text:700" header-font text-font]))
(interpose "|"
; ugly thing, but it cannot be avoided since these
; fonts have to be loaded (independently of CSS)
(concat ["PT+Serif:700" "Noticia+Text:700"]
(vals (select-keys params
[:header-font :text-font])))))
"&subset=latin,cyrillic") " " "+") "&subset=latin,cyrillic") " " "+")
:rel "stylesheet" :rel "stylesheet"
:type "text/css"}] :type "text/css"}]
@ -53,7 +49,10 @@
'@foreground_halftone': themes['" theme "'].foreground.halftone, '@foreground_halftone': themes['" theme "'].foreground.halftone,
'@link_fresh': themes['" theme "'].link.fresh, '@link_fresh': themes['" theme "'].link.fresh,
'@link_visited': themes['" theme "'].link.visited, '@link_visited': themes['" theme "'].link.visited,
'@link_hover': themes['" theme "'].link.hover});"))) '@link_hover': themes['" theme "'].link.hover"
(when header-font (str ", '@header_font': '" header-font "'"))
(when text-font (str ",'@text_font': '" text-font "'"))
"});")))
; google analytics code should appear in prod mode only ; google analytics code should appear in prod mode only
(if-not (dev-mode?) (include-js "/js/google-analytics.js"))] (if-not (dev-mode?) (include-js "/js/google-analytics.js"))]
[:body {:onload "loadPage()"} content]))) [:body {:onload "loadPage()"} content])))

Loading…
Cancel
Save