#30: More progress, not finished.

This commit is contained in:
simon 2017-03-22 20:58:50 +00:00
parent 5b35b5bc18
commit e782560d40
12 changed files with 73 additions and 157 deletions

View file

@ -37,19 +37,24 @@
</div> </div>
</div> </div>
<footer> <footer>
<div id="credits"> <div id="credits">
<div> <div>
<img src="img/ric-logo.png" width="24" height="24"/> <img src="img/ric-logo.png" width="24" height="24"/>
A project of the A project of the
<a href="https://radical.scot/">Radical Independence Campaign</a> || <a href="https://radical.scot/">Radical Independence Campaign</a> ||
Version {{version}} Version {{version}}
</div> </div>
<div> <div>
<img height="16" width="16" alt="Clojure" src="img/luminus-logo.png"/>Built with <a href="http://www.luminusweb.net/">LuminusWeb</a> || <img height="16" width="16" alt="Clojure" src="img/luminus-logo.png"/>Built with <a href="http://www.luminusweb.net/">LuminusWeb</a> ||
<img height="16" width="16" alt="Clojure" src="img/clojure-icon.gif"/> Powered by <a href="http://clojure.org">Clojure</a> || <img height="16" width="16" alt="Clojure" src="img/clojure-icon.gif"/> Powered by <a href="http://clojure.org">Clojure</a> ||
<img height="16" width="16" alt="GitHub" src="img/github-logo-transparent.png"/>Find me/fork me on <a href="https://github.com/simon-brooke/smeagol">Github</a> || <img height="16" width="16" alt="GitHub" src="img/github-logo-transparent.png"/>Find me/fork me on <a href="https://github.com/simon-brooke/smeagol">Github</a> ||
<img height="16" width="16" alt="Free Software Foundation" src="img/gnu.small.png"/>Licensed under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License version 2.0</a> <img height="16" width="16" alt="Free Software Foundation" src="img/gnu.small.png"/>Licensed under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License version 2.0</a>
</div> </div>
</div> </div>
</footer>
<script type="text/javascript">
var context = "{{servlet-context}}";
var csrfToken = "{{csrf-token}}";
</script>
</body> </body>
</html> </html>

View file

@ -9,10 +9,11 @@
We're not going to do login in the long term; we're going to use oauth. We're not going to do login in the long term; we're going to use oauth.
This is a temporary login form. This is a temporary login form.
</p> </p>
<form action="login" method="post"> <form action="auth" method="post">
{% csrf-field %}
<p class="widget"> <p class="widget">
<label for="name">Username</label> <label for="username">Username</label>
<input type="text" id="name" name="name"/> <input type="text" id="username" name="username"/>
</p> </p>
<p class="widget"> <p class="widget">
<label for="password">Your post-code</label> <label for="password">Your post-code</label>

View file

@ -4,7 +4,7 @@
<a href="javascript:history.back()" id="back-link">Back</a> <a href="javascript:history.back()" id="back-link">Back</a>
</div> </div>
<div class="big-link-container"> <div class="big-link-container">
<a href="login" class="big-link" id="yes-link">Yes</a> <a href="auth" class="big-link" id="yes-link">Yes</a>
</div> </div>
<div class="big-link-container"> <div class="big-link-container">
<a href="register" class="big-link" id="signup-link">No</a> <a href="register" class="big-link" id="signup-link">No</a>

View file

@ -1,5 +1,7 @@
(ns youyesyet.routes.home (ns youyesyet.routes.home
(:require [noir.util.route :as route] (:require [clojure.walk :refer [keywordize-keys]]
[noir.response :as nresponse]
[noir.util.route :as route]
[youyesyet.layout :as layout] [youyesyet.layout :as layout]
[youyesyet.db.core :as db-core] [youyesyet.db.core :as db-core]
[compojure.core :refer [defroutes GET POST]] [compojure.core :refer [defroutes GET POST]]
@ -27,15 +29,16 @@
"This is very temporary. We're going to do authentication by oauth." "This is very temporary. We're going to do authentication by oauth."
[request] [request]
(let [params (keywordize-keys (:form-params request)) (let [params (keywordize-keys (:form-params request))
session (:session request)
username (:username params) username (:username params)
password (:password params) password (:password params)
redirect-to (or (:redirect-to params) "app")] redirect-to (or (:redirect-to params) "app")]
(if (if
(and (= username "test" (= password "test")) (and (= username "test") (= password "test"))
(do (do
(session/put! :user username) (assoc (response/found redirect-to) :session (assoc session :user username)))
(response/redirect redirect-to)) (layout/render "login.html" {:title "Please log in" :redirect-to redirect-to}))))
(layout/render "login.html" {:title "Please log in" :redirect-to redirect-to})))))
(defroutes home-routes (defroutes home-routes
(GET "/" [] (home-page)) (GET "/" [] (home-page))

View file

@ -11,15 +11,17 @@
[youyesyet.subscriptions] [youyesyet.subscriptions]
[youyesyet.ui-utils :as ui] [youyesyet.ui-utils :as ui]
[youyesyet.views.about :as about] [youyesyet.views.about :as about]
[youyesyet.views.electors :as electors]
[youyesyet.views.home :as home] [youyesyet.views.home :as home]
[youyesyet.views.map :as maps]) [youyesyet.views.issues :as issues]
[youyesyet.views.map :as maps]
[youyesyet.views.followup-request :as request])
(:import goog.History)) (:import goog.History))
(defn about-page [] (defn about-page []
(about/panel)) (about/panel))
(defn home-page [] (defn home-page []
(home/panel)) (home/panel))
@ -50,11 +52,14 @@
(secretary/set-config! :prefix "#") (secretary/set-config! :prefix "#")
(secretary/defroute "/" [] (secretary/defroute "/" []
(rf/dispatch [:set-active-page :home])) (rf/dispatch [:set-active-page :map]))
(secretary/defroute "/about" [] (secretary/defroute "/about" []
(rf/dispatch [:set-active-page :about])) (rf/dispatch [:set-active-page :about]))
(secretary/defroute "/issues" []
(rf/dispatch [:set-active-page :issues]))
(secretary/defroute "/map" [] (secretary/defroute "/map" []
(rf/dispatch [:set-active-page :map])) (rf/dispatch [:set-active-page :map]))

View file

@ -1,4 +1,33 @@
(ns youyesyet.db) (ns youyesyet.db)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;; 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
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; This is the constructor for the atom in which the state of the user interface is held.
;;; The atom gets updated by 'events' registered in handler.cljs, q.v.
;;;
;;; not wonderfully happy with 'db' as a name for this namespace; will probably change to
;;; 'client-state'.
(def default-db (def default-db
{:page :home}) {:page :home})

View file

@ -52,8 +52,6 @@
:src "img/threelines.png" :src "img/threelines.png"
:on-click #(swap! collapsed? not)}] :on-click #(swap! collapsed? not)}]
[:menu.nav {:id "nav-menu" :class (if @collapsed? "hidden" "shown")} [:menu.nav {:id "nav-menu" :class (if @collapsed? "hidden" "shown")}
(nav-link "#/" "Home" :home collapsed?) (nav-link "#/map" "Map" :map collapsed?)
(nav-link "#/library" "Library" :library collapsed?) (nav-link "#/issues" "Issues" :issues collapsed?)
(nav-link "#/register" "Register" :register collapsed?)
(nav-link "#/login" "Login" :login collapsed?)
(nav-link "#/about" "About" :about collapsed?)]])) (nav-link "#/about" "About" :about collapsed?)]]))

View file

@ -1,38 +0,0 @@
(ns youyesyet.views.followup-action
(:require [re-frame.core :refer [reg-sub]]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;; youyesyet.views.followup-action: followup-action 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 (eventually) provide the followup-action view.
;;; See https://github.com/simon-brooke/youyesyet/blob/master/doc/specification/userspec.md#followup-action-view
(defn panel
"Generate the followup-action panel."
[]
[])

View file

@ -1,38 +0,0 @@
(ns youyesyet.views.login
(:require [re-frame.core :refer [reg-sub]]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;; youyesyet.views.login: login 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 (eventually) provide the login view.
;;; See https://github.com/simon-brooke/youyesyet/blob/master/doc/specification/userspec.md#followup-requests-view
(defn panel
"Generate the login panel."
[]
[])

View file

@ -1,9 +1,11 @@
(ns youyesyet.views.login (ns youyesyet.views.issue
(:require [re-frame.core :refer [reg-sub]])) (:require [re-frame.core :refer [reg-sub]]
[youyesyet.ui-utils :as ui]
[youyesyet.views.issues :as issues]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ;;;;
;;;; youyesyet.views.login: login view for youyesyet. ;;;; youyesyet.views.issues: issues view for youyesyet.
;;;; ;;;;
;;;; This program is free software; you can redistribute it and/or ;;;; This program is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU General Public License ;;;; modify it under the terms of the GNU General Public License
@ -28,11 +30,4 @@
;;; The pattern from the re-com demo (https://github.com/Day8/re-com) is to have ;;; 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' ;;; 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. ;;; whose output is an enlive-style specification of the view to be redered.
;;; I propose to follow this pattern. This file will (eventually) provide the login view. ;;; I propose to follow this pattern. This file will (eventually) provide the single issue view.
;;; See https://github.com/simon-brooke/youyesyet/blob/master/doc/specification/userspec.md#logging-in
(defn panel
"Generate the login panel."
[]
[])

View file

@ -33,11 +33,6 @@
;;; See https://github.com/simon-brooke/youyesyet/blob/master/doc/specification/userspec.md#issues-view ;;; See https://github.com/simon-brooke/youyesyet/blob/master/doc/specification/userspec.md#issues-view
;;; The same panel, using re-frame, will display both the list of issues and the prompt
;;; text on a single issue. All the issues will be fetched once as a map at client load
;;; time
(def *issues* (def *issues*
;;; this is a dummy for the map fetched at load-time ;;; this is a dummy for the map fetched at load-time
{"Currency" "Lorem ipsum dolar sit amet" {"Currency" "Lorem ipsum dolar sit amet"
@ -60,5 +55,4 @@
(ui/back-link) (ui/back-link)
[:div {:id "issue-list"} [:div {:id "issue-list"}
] ]
(map (fn [k] (ui/big-link k k)) (keys (get-issues))) (map (fn [k] (ui/big-link k (str "#/issue/" k))) (keys (get-issues)))])
])

View file

@ -1,38 +0,0 @@
(ns youyesyet.views.signup
(:require [re-frame.core :refer [reg-sub]]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;; youyesyet.views.signup: signup 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 (eventually) provide the signup view.
;;; See https://github.com/simon-brooke/youyesyet/blob/master/doc/specification/userspec.md#creating-an-account
(defn panel
"Generate the signup panel."
[]
[])