preview with markdown processing added

This commit is contained in:
Christian Mueller
2012-05-27 22:11:13 +02:00
parent 2eef1b0150
commit 967e6d8a32
4 changed files with 24 additions and 13 deletions
+5 -3
View File
@@ -44,8 +44,9 @@
(rule ".article-font"
:font-family :Georgia
:font-size :1.3em)
(rule ".max-width"
:width "900px")
(rule "article"
:font-family :Georgia
:font-size :1.2em)
(rule "*:focus"
:outline [:0px :none :transparent])
(rule "textarea"
@@ -53,7 +54,7 @@
:font-size :1.3em
:border :none
:height :600px)
(rule "#form-button"
(rule "#preview-button"
helvetica-neue
:display :none
:cursor :pointer
@@ -62,6 +63,7 @@
:font-size :0.8em
:opacity :0.8)
(rule ".central-body"
:width "900px"
:margin-top :5em
:margin-bottom :5em
:margin-left "auto"
+14 -6
View File
@@ -1,9 +1,10 @@
(ns NoteHub.views.pages
(:require [NoteHub.views.common :as common])
(:use [noir.core :only [defpage]]
[hiccup.form]))
[hiccup.form]
[markdown :only [md-to-html-string]]))
(defpage "/" []
(defpage "/" {}
(common/layout "Free Markdown Hosting"
[:div#hero
[:h1 "NoteHub"]
@@ -12,9 +13,16 @@
[:br]
[:a.button {:href "/new"} "New Page"]]))
(defpage "/new" []
(defpage "/new" {}
(common/layout "New Markdown Note"
[:div.central-body.max-width
(text-area {:class "max-width"} :write-textarea)
(submit-button {:id "form-button"} "Preview")]))
[:div.central-body
(form-to [:post "/preview-note"]
(text-area {:class "max-width"} :draft)
(submit-button {:id "preview-button"} "Preview"))]))
; Actions.
(defpage [:post "/preview-note"] {:keys [draft]}
(common/layout "Preview of ..."
[:article.central-body
(md-to-html-string draft)]))