#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

@ -51,5 +51,10 @@
<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>
</footer>
<script type="text/javascript">
var context = "{{servlet-context}}";
var csrfToken = "{{csrf-token}}";
</script>
</body>
</html>

View file

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

View file

@ -4,7 +4,7 @@
<a href="javascript:history.back()" id="back-link">Back</a>
</div>
<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 class="big-link-container">
<a href="register" class="big-link" id="signup-link">No</a>

View file

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

View file

@ -11,15 +11,17 @@
[youyesyet.subscriptions]
[youyesyet.ui-utils :as ui]
[youyesyet.views.about :as about]
[youyesyet.views.electors :as electors]
[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))
(defn about-page []
(about/panel))
(defn home-page []
(home/panel))
@ -50,11 +52,14 @@
(secretary/set-config! :prefix "#")
(secretary/defroute "/" []
(rf/dispatch [:set-active-page :home]))
(rf/dispatch [:set-active-page :map]))
(secretary/defroute "/about" []
(rf/dispatch [:set-active-page :about]))
(secretary/defroute "/issues" []
(rf/dispatch [:set-active-page :issues]))
(secretary/defroute "/map" []
(rf/dispatch [:set-active-page :map]))

View file

@ -1,4 +1,33 @@
(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
{:page :home})

View file

@ -52,8 +52,6 @@
:src "img/threelines.png"
:on-click #(swap! collapsed? not)}]
[:menu.nav {:id "nav-menu" :class (if @collapsed? "hidden" "shown")}
(nav-link "#/" "Home" :home collapsed?)
(nav-link "#/library" "Library" :library collapsed?)
(nav-link "#/register" "Register" :register collapsed?)
(nav-link "#/login" "Login" :login collapsed?)
(nav-link "#/map" "Map" :map collapsed?)
(nav-link "#/issues" "Issues" :issues 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
(:require [re-frame.core :refer [reg-sub]]))
(ns youyesyet.views.issue
(: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
;;;; 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
;;; 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#logging-in
(defn panel
"Generate the login panel."
[]
[])
;;; I propose to follow this pattern. This file will (eventually) provide the single issue view.

View file

@ -33,11 +33,6 @@
;;; 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*
;;; this is a dummy for the map fetched at load-time
{"Currency" "Lorem ipsum dolar sit amet"
@ -60,5 +55,4 @@
(ui/back-link)
[: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."
[]
[])