Source

nextrain / src / nextrain / snippets.clj

Full commit
(ns nextrain.snippets
  (:use hiccup.core))

(defn mobile-page
  [& {:as params}]
  (html [:div {:data-role "page" :id (:id params)}
         [:div {:data-role "header"}
           (:header params)]
         [:div {:data-role "content"}
           (:content params)]]))

(defn default-lat-lon []
  (html [:div {:data-role "page"}
         [:div {:data-role "header"}
           [:h1 "Your Location"]]
         [:div {:data-role "content"}
           [:div#lat "latitude"]
           [:div#lon "longitude"]]]))

(defn index-mobile-page []
  (mobile-page :id "indexpage"
               :header (html [:h1 "Nearest Stops"])
               :content (html [:div#stops-list-template
                                [:ul {:data-role "listview"}
                                 [:li.stop
                                  [:a {:class "stop_name stop_url@href"}]]]])))

(defn stop-mobile-page [stop]
  (println stop)
  (mobile-page :id "stoppage"
               :header  (html [:h1 (:stop_name stop)])
               :content (html [:div#times-list-template
                               [:ul#times-list {:data-role "listview"}]])))