diff --git a/src/cljs/youyesyet/core.cljs b/src/cljs/youyesyet/core.cljs index 1e28d4b..cc6cccb 100644 --- a/src/cljs/youyesyet/core.cljs +++ b/src/cljs/youyesyet/core.cljs @@ -9,6 +9,7 @@ [youyesyet.ajax :refer [load-interceptors!]] [youyesyet.handlers] [youyesyet.subscriptions] + [youyesyet.ui-utils :as ui] [youyesyet.views.map :as maps]) (:import goog.History)) @@ -36,19 +37,9 @@ (nav-link "#/about" "About" :about collapsed?)]])) -(defn back-link [] - [:div.back-link-container {:id "back-link-container"} - [:a {:href "javascript:history.back()" :id "back-link"} "Back"]]) - - -(defn big-link [text target] - [:div.big-link-container - [:a.big-link {:href target} text]]) - - (defn about-page [] [:div.container {:id "main-container"} - (back-link) + (ui.back-link) [:div.row [:div.col-md-12 "this is the story of youyesyet... work in progress"]]]) diff --git a/src/cljs/youyesyet/ui_utils.cljs b/src/cljs/youyesyet/ui_utils.cljs new file mode 100644 index 0000000..7b9d4c4 --- /dev/null +++ b/src/cljs/youyesyet/ui_utils.cljs @@ -0,0 +1,36 @@ +(ns youyesyet.ui-utils) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; +;;;; youyesyet.views.electors: electors view for youyesyet. +;;;; +;;;; This program is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU General Public License +;;;; as published by the Free Software Foundation; either version 2 +;;;; of the License, or (at your option) any later version. +;;;; +;;;; This program is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with this program; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +;;;; USA. +;;;; +;;;; Copyright (C) 2016 Simon Brooke for Radical Independence Campaign +;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;; User interface stuff common to many views + + +(defn back-link [] + [:div.back-link-container {:id "back-link-container"} + [:a {:href "javascript:history.back()" :id "back-link"} "Back"]]) + + +(defn big-link [text target] + [:div.big-link-container + [:a.big-link {:href target} text]]) diff --git a/src/cljs/youyesyet/views/about.cljs b/src/cljs/youyesyet/views/about.cljs new file mode 100644 index 0000000..13832db --- /dev/null +++ b/src/cljs/youyesyet/views/about.cljs @@ -0,0 +1,40 @@ +(ns youyesyet.views.about + (:require [re-frame.core :refer [reg-sub]] + [youyesyet.ui-utils :as ui])) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; +;;;; youyesyet.views.electors: electors view for youyesyet. +;;;; +;;;; This program is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU General Public License +;;;; as published by the Free Software Foundation; either version 2 +;;;; of the License, or (at your option) any later version. +;;;; +;;;; This program is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with this program; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +;;;; USA. +;;;; +;;;; Copyright (C) 2016 Simon Brooke for Radical Independence Campaign +;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +;;; The pattern from the re-com demo (https://github.com/Day8/re-com) is to have +;;; one source file/namespace per view. Each namespace contains a function 'panel' +;;; whose output is an enlive-style specification of the view to be redered. + +(defn panel + "Generate the about panel." + [] + [:div.container {:id "main-container"} + (ui/back-link) + [:div.row + [:div.col-md-12 + "this is the story of youyesyet... work in progress"]]]) diff --git a/src/cljs/youyesyet/views/home.cljs b/src/cljs/youyesyet/views/home.cljs new file mode 100644 index 0000000..15c628d --- /dev/null +++ b/src/cljs/youyesyet/views/home.cljs @@ -0,0 +1,48 @@ +(ns youyesyet.views.home + (:require [re-frame.core :refer [reg-sub]] + [youyesyet.ui-utils :as ui])) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; +;;;; youyesyet.views.electors: electors view for youyesyet. +;;;; +;;;; This program is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU General Public License +;;;; as published by the Free Software Foundation; either version 2 +;;;; of the License, or (at your option) any later version. +;;;; +;;;; This program is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with this program; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +;;;; USA. +;;;; +;;;; Copyright (C) 2016 Simon Brooke for Radical Independence Campaign +;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +;;; The pattern from the re-com demo (https://github.com/Day8/re-com) is to have +;;; one source file/namespace per view. Each namespace contains a function 'panel' +;;; whose output is an enlive-style specification of the view to be redered. +;;; I propose to follow this pattern. This file will provide the home view. + +(defn panel + "Generate the home panel." + [] + [:div.container {:id "main-container"} + (ui/big-link "About" "#/about") + (ui/big-link "Map" "#/map") + [:div.jumbotron + [:h1 "You Yes Yet?"] + [:p "Time to start building your site!"] + [:p [:a.btn.btn-primary.btn-lg {:href "http://luminusweb.net"} "Learn more ยป"]]]]) + (when-let [docs @(rf/subscribe [:docs])] + [:div.row + [:div.col-md-12 + [:div {:dangerouslySetInnerHTML + {:__html (md->html docs)}}]]]) diff --git a/src/cljs/youyesyet/views/map.cljs b/src/cljs/youyesyet/views/map.cljs index 5705b40..d926295 100644 --- a/src/cljs/youyesyet/views/map.cljs +++ b/src/cljs/youyesyet/views/map.cljs @@ -86,7 +86,7 @@ [:div#map {:style {:height "500px"}}]) -(defn map-div +(defn panel "A reagent class for the map object." [] (reagent/create-class {:reagent-render map-render