Browse Source

js loading made optional

master
Christian Mueller 14 years ago
parent
commit
6dbfaa058b
  1. 18
      src/NoteHub/views/common.clj
  2. 2
      src/NoteHub/views/pages.clj

18
src/NoteHub/views/common.clj

@ -91,18 +91,26 @@ @@ -91,18 +91,26 @@
(rule "h1, h2, h3, h4"
:font-family (gen-comma-list "'Noticia Text'" "'PT Serif'"))))
(defpartial layout [title & content]
(defpartial generate-layout
[params title & content]
(html5
[:head
[:title "NoteHub — " title]
(include-js "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js")
[:link {:href (str "http://fonts.googleapis.com/css?family="
"PT+Serif:700|Noticia+Text:700"
"&subset=latin,cyrillic" )
:rel "stylesheet"
:type "text/css"}]
[:style {:type "text/css"} global-css]]
[:body
content
(if (params :js)
[:body content
(javascript-tag "var CLOSURE_NO_DEPS = true;")
(include-js "/cljs/main.js")]))
(include-js "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js")
(include-js "/cljs/main.js")]
[:body content])))
(defn layout [& args]
(if (map? (first args))
(apply generate-layout args)
(apply generate-layout {} args)))

2
src/NoteHub/views/pages.clj

@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
; New Note Page
(defpage "/new" {}
(common/layout "New Markdown Note"
(common/layout {:js true} "New Markdown Note"
[:div.central-element
(form-to [:post "/post-note"]
(hidden-field :session-key (get-flash-key))

Loading…
Cancel
Save