Restyling; much reorganisation of documentation.

This commit is contained in:
Simon Brooke 2014-07-23 10:04:04 +01:00
parent 05e9daf662
commit c15cd08159
17 changed files with 217 additions and 257 deletions

View file

@ -41,7 +41,7 @@
(let [world (or (session/get :world)
(engine/transform-world
(heightmap/apply-heightmap
"resources/public/img/20x20/hill.png"
"resources/public/img/heightmaps/small_hill.png"
;; "resources/public/img/heightmaps/great_britain_and_ireland_small.png"
)
rules/init-rules))

View file

@ -1,5 +1,6 @@
(ns mw-ui.routes.home
(:use compojure.core
(:use clojure.walk
compojure.core
[mw-ui.routes.rules :as rules]
[mw-ui.routes.params :as params])
(:require [hiccup.core :refer [html]]
@ -13,13 +14,25 @@
:content (util/md->html "/md/mw-ui.md")}))
(defn world-page []
(layout/render "trusted-content.html" {:title "Watch your world grow"
:content (html (world/render-world-table))
:pause (or (session/get :pause) 5)
:maybe-refresh "refresh"}))
(layout/render "trusted-content.html"
{:title "Watch your world grow"
:world-selected "active"
:content (html (world/render-world-table))
:pause (or (session/get :pause) 5)
:maybe-refresh "refresh"}))
(defn about-page []
(layout/render "trusted-content.html" {:title "About MicroWorld" :content (util/md->html "/md/about.md")}))
(layout/render "trusted-content.html"
{:title "About MicroWorld"
:about-selected "active"
:content (util/md->html "/md/about.md")}))
(defn md-page [request]
(let [params (keywordize-keys (:params request))
content (or (:content params) "missing.md")]
(layout/render "trusted-content.html"
{:title "Welcome to MicroWorld"
:content (util/md->html (str "/md/" content))})))
(defn list-states []
(sort
@ -31,6 +44,7 @@
(layout/render "docs.html" {:title "Documentation"
:parser (util/md->html "/md/mw-parser.md" )
:states (util/list-resources "resources/public/img/tiles" #"([0-9a-z-_]+).png")
:lessons (util/list-resources "resources/public/md/lesson-plans" #"([0-9a-z-_]+).md")
:components ["mw-engine" "mw-parser" "mw-ui"]}))
(defroutes home-routes
@ -39,6 +53,7 @@
(GET "/docs" [] (docs-page))
(GET "/world" [] (world-page))
(GET "/params" [] (params/params-page))
(GET "/md" request (md-page request))
(POST "/params" request (params/params-page request))
(GET "/rules" request (rules/rules-page request))
(POST "/rules" request (rules/rules-page request)))

View file

@ -10,11 +10,11 @@
[noir.session :as session]))
(defn- send-params []
{{:title "Choose your world"
:heightmaps (util/list-resources "resources/public/img/heightmaps" #"([0-9a-z-_]+).png")
:pause (or (session/get :pause) 5)
:rulesets (util/list-resources "resources/rulesets" #"([0-9a-z-_]+).txt")
})
{:title "Choose your world"
:heightmaps (util/list-resources "resources/public/img/heightmaps" #"([0-9a-z-_]+).png")
:pause (or (session/get :pause) 5)
:rulesets (util/list-resources "resources/rulesets" #"([0-9a-z-_]+).txt")
})
(defn params-page
"Handler for params request. If no `request` passed, show empty params form.