Merge pull request #8 from non/topic/pronoun-list
Add support for a global pronoun list at /.
This commit is contained in:
commit
98e7444f18
@ -78,8 +78,25 @@
|
|||||||
(take 5 inputs)
|
(take 5 inputs)
|
||||||
(u/table-lookup inputs pronouns-table))))
|
(u/table-lookup inputs pronouns-table))))
|
||||||
|
|
||||||
(defn front []
|
;; we could choose to display the entire row for the label.
|
||||||
(str "pronoun.is is a www site for showing people how to use pronouns"))
|
;; currently the first two entries are enough to disambiguate the
|
||||||
|
;; pronouns -- will that always be true?
|
||||||
|
(defn make-link [row]
|
||||||
|
(let [link (str "/" (s/join "/" row))
|
||||||
|
label (str (first row) "/" (first (rest row)))]
|
||||||
|
[:li [:a {:href link} label]]))
|
||||||
|
|
||||||
|
(defn front [pronouns-table]
|
||||||
|
(let [links (map make-link (sort pronouns-table))]
|
||||||
|
(html
|
||||||
|
[:html
|
||||||
|
[:head
|
||||||
|
[:title "Main Page"]
|
||||||
|
[:link {:rel "stylesheet" :href "/pronouns.css"}]]
|
||||||
|
[:body
|
||||||
|
[:p "pronoun.is is a www site for showing people how to use pronouns"]
|
||||||
|
[:p "here are some pronouns the site knows about:"]
|
||||||
|
[:ul links]]])))
|
||||||
|
|
||||||
(defn not-found []
|
(defn not-found []
|
||||||
(str "We couldn't find those pronouns in our database, please ask us to "
|
(str "We couldn't find those pronouns in our database, please ask us to "
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
(defroutes app-routes
|
(defroutes app-routes
|
||||||
(GET "/" []
|
(GET "/" []
|
||||||
{:status 200
|
{:status 200
|
||||||
:headers {"Content-Type" "text/plain"}
|
:headers {"Content-Type" "text/html"}
|
||||||
:body (pages/front)})
|
:body (pages/front pronouns-table)})
|
||||||
|
|
||||||
(GET "/pronouns.css" {params :params}
|
(GET "/pronouns.css" {params :params}
|
||||||
{:status 200
|
{:status 200
|
||||||
|
Loading…
Reference in New Issue
Block a user