Merge branch 'develop' of github.com:simon-brooke/youyesyet into develop
This commit is contained in:
commit
dcba862b27
|
@ -75,18 +75,26 @@ Note that:
|
|||
|
||||
The map view shows a map of the streets immediately around their current location, overlaid, on dwellings where canvas has already been done, with icons indicating the voting preference expressed, and with the dwellings where canvassing is still required marked with an icon indicating this:
|
||||
|
||||

|
||||

|
||||
|
||||
Selecting a building on the map leads to
|
||||
|
||||
1. On buildings with multiple flats, a schematic view of the flats in the building (I haven't yet really got a good idea how to do this; it may be just a list). Selecting a flat from this view leads to the *Electors View*;
|
||||
1. On buildings with multiple flats, the *Building View*;
|
||||
2. On buildings with only one dwelling, the *Electors View*.
|
||||
|
||||
## Building View
|
||||
|
||||
A list of dwellings in a building.
|
||||
|
||||

|
||||
|
||||
Selecting a flat from this view leads to the *Electors View*.
|
||||
|
||||
## Electors View
|
||||
|
||||
The *Electors View* shows a schematic of the registered electors in a dwelling:
|
||||
|
||||

|
||||

|
||||
|
||||
One figure is shown for each elector, labelled with their name. In the dummy pages I've shown gendered stick figures, because I believe that in many casesthis will help the canvasser identify the person who has answered the door; but this may be seen as excluding electors with non-binary gender, and, in any case, I believe we don't actually get gender data (other than salutation) in the electoral roll data. So this may have to be reconsidered.
|
||||
|
||||
|
@ -112,9 +120,18 @@ The *Issues View* is a simple list of issues:
|
|||
| Other |
|
||||
+------------------------------------------------+
|
||||
|
||||

|
||||
|
||||
|
||||
This list will not be hard-coded but will be dynamic; thus, if we find an issue we didn't predict is regularly coming up on the doorstep an *Administrator* can add it to the list.
|
||||
|
||||
Selecting the back button from the *Issues View* returns to the *Electors View*. Selecting any option from the Issues view leads to a single page giving top level points the canvasser can make to the elector on the doorstep, and a link to a *Followup Request* form. There is also a 'back' button allowing the user to return to the *Issues View*
|
||||
Selecting the back button from the *Issues View* returns to the *Electors View*. Selecting any option from the Issues view leads to the *Issue View*.
|
||||
|
||||
## Issue View
|
||||
|
||||
A single page giving top level points the canvasser can make to the elector on the doorstep, regarding the selected issue; and a link to a *Followup Request* form. There is also a 'back' button allowing the user to return to the *Issues View*.
|
||||
|
||||

|
||||
|
||||
## Followup Request form
|
||||
|
||||
|
@ -132,6 +149,8 @@ The *Followup Request* form is a simple form which allows the canvasser to recor
|
|||
| |
|
||||
+------------------------------------------------+
|
||||
|
||||

|
||||
|
||||
## How Street Canvassers will use the system
|
||||
|
||||
Street Canvassers will typically use the system by
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
BIN
dummies/building.png
Normal file
BIN
dummies/building.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
dummies/building.xcf
Normal file
BIN
dummies/building.xcf
Normal file
Binary file not shown.
BIN
dummies/followup.png
Normal file
BIN
dummies/followup.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
BIN
dummies/followup.xcf
Normal file
BIN
dummies/followup.xcf
Normal file
Binary file not shown.
BIN
dummies/issue.png
Normal file
BIN
dummies/issue.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
BIN
dummies/issue.xcf
Normal file
BIN
dummies/issue.xcf
Normal file
Binary file not shown.
BIN
dummies/issues.png
Normal file
BIN
dummies/issues.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
dummies/issues.xcf
Normal file
BIN
dummies/issues.xcf
Normal file
Binary file not shown.
|
@ -45,7 +45,6 @@ h1 {
|
|||
width: 100%;
|
||||
_position: absolute;
|
||||
_top: expression(document.documentElement.scrollTop);
|
||||
z-index: 149;
|
||||
background:rgba(7,27,51,0.8);
|
||||
}
|
||||
|
||||
|
@ -57,6 +56,7 @@ h1 {
|
|||
#nav-menu {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
z-index: 02110-1301;
|
||||
}
|
||||
|
||||
#nav menu li {
|
||||
|
@ -103,6 +103,7 @@ h1 {
|
|||
#nav:hover #nav-menu {
|
||||
display: block;
|
||||
list-style-type: none;
|
||||
z-index: 148;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
@ -141,7 +142,7 @@ h1 {
|
|||
margin: 0;
|
||||
padding: 0;
|
||||
position: fixed;
|
||||
z-index: 149;
|
||||
z-index: 600;
|
||||
color: silver;
|
||||
background:rgba(40,40,40,0.9);
|
||||
}
|
||||
|
@ -149,6 +150,7 @@ h1 {
|
|||
#nav:hover #nav-menu {
|
||||
display: block;
|
||||
list-style-type: none;
|
||||
z-index: 500;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ th {
|
|||
width: 30%;
|
||||
float: right;
|
||||
position: fixed;
|
||||
bottom: 3.5em;
|
||||
bottom: 2em;
|
||||
right: 0;
|
||||
z-index: 175;
|
||||
background: transparent;
|
||||
|
@ -399,6 +399,10 @@ th {
|
|||
padding-bottom: 2em;
|
||||
}
|
||||
|
||||
#issue-text {
|
||||
font-size: 200%;
|
||||
}
|
||||
|
||||
#main-container {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
|
|
60
resources/public/error/502.html
Normal file
60
resources/public/error/502.html
Normal file
|
@ -0,0 +1,60 @@
|
|||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- a page which can be served as static (by nginx) if Tomcat has crashed -->
|
||||
<!-- head: if you want entire custom head content, override this block. -->
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<meta name="referrer" content="same-origin">
|
||||
<link href="../css/yyy-common.css" rel="stylesheet" type="text/css" />
|
||||
<link href="../css/yyy-site.css" rel="stylesheet" type="text/css" />
|
||||
<link href="https://fonts.googleapis.com/css?family=Archivo+Black|Archivo+Narrow" rel="stylesheet"/>
|
||||
<title>Project Hope: 502 Bad Gateway</title>
|
||||
|
||||
|
||||
<!-- extra-head: put any additional markup to go into the head of your document into this block -->
|
||||
<!-- e.g. script tags, link tags -->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- whole-page: if you want an entire custom page layout, override this block. -->
|
||||
|
||||
<header>
|
||||
<h1>Sorry, we have a problem</h1>
|
||||
</header>
|
||||
|
||||
<div id="main-container" class="container">
|
||||
<h2><span class="text-danger">Error: 502 Bad Gateway</span></h2>
|
||||
<p>
|
||||
We are suffering an intermittent problem causing an occasional crash of
|
||||
the Project Hope canvassing application. We apologise for this, and are
|
||||
working on a permanent fix.
|
||||
</p>
|
||||
<p>
|
||||
The application will restart automatically
|
||||
within five minutes, please take a short break.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<br clear="both"/>
|
||||
</div>
|
||||
|
||||
<!-- foot: override this block if you don't want the standard footer -->
|
||||
<footer>
|
||||
<div id="credits">
|
||||
<div>
|
||||
<img height="16" width="16" alt="Clojure" src="/img/credits/luminus-logo.png"/>Built with <a href="http://www.luminusweb.net/">LuminusWeb</a> ||
|
||||
<img height="16" width="16" alt="Clojure" src="/img/credits/clojure-icon.gif"/> Powered by <a href="http://clojure.org">Clojure</a> ||
|
||||
<img height="16" width="16" alt="GitHub" src="/img/credits/github-logo-transparent.png"/>Find me/fork me on <a href="https://github.com/simon-brooke/youyesyet">Github</a> ||
|
||||
<img height="16" width="16" alt="Free Software Foundation" src="/img/credits/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>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
|
@ -85,3 +85,13 @@ WHERE roles.id = ln_canvassers_roles.role_id
|
|||
AND ln_canvassers_roles.canvasser_id = :id
|
||||
ORDER BY roles.name,
|
||||
roles.id
|
||||
|
||||
-- :name list-elector-intentions :? :*
|
||||
-- :doc short form of `list-intentions-by-elector`, returning far less data, for use in `youyesyet.routes.rest/get-local-data`, q.v.
|
||||
-- TODO: should be limited to visits in the past 24 hours, to prevent the app being
|
||||
-- used to harrass NO voters. See https://github.com/simon-brooke/youyesyet/issues/58
|
||||
SELECT intentions.id, intentions.option_id, visits.date
|
||||
FROM intentions, visits
|
||||
WHERE intentions.visit_id = visits.id
|
||||
AND intentions.elector_id = :id
|
||||
ORDER BY visits.date DESC
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<img id="nav-icon" src="{{servlet-context}}/img/threelines.png" alt="Menu"/>
|
||||
<menu id="nav-menu" class="nav">
|
||||
<li class=""><a href="{{servlet-context}}/home">Home</a></li>
|
||||
<li class=""><a href="{{servlet-context}}/library">Library</a></li>
|
||||
<li class=""><a href="https://library.projecthope.scot/">Library</a></li>
|
||||
{% if user %}
|
||||
<li class=""><a href="{{servlet-context}}/roles">Roles</a></li>
|
||||
<li class=""><a href="{{servlet-context}}/logout">Logout</a></li>
|
||||
|
@ -68,18 +68,31 @@
|
|||
<!-- content: put your main page content into this block -->
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div id="cookies">
|
||||
<div id="more-about-cookies">
|
||||
This website stores session information as a 'cookie' on your browser.
|
||||
This helps us show you the content you want to see. This cookie does
|
||||
not identify you, and cannot be read by other websites. It is deleted
|
||||
by your browser as soon as you leave this site. This website does not
|
||||
use any third party cookies, so your visit here cannot be tracked by
|
||||
other websites.
|
||||
</div>
|
||||
<div id="about-cookies">
|
||||
About cookies
|
||||
</div>
|
||||
</div>
|
||||
<br clear="both"/>
|
||||
</div>
|
||||
{% block foot %}
|
||||
<!-- foot: override this block if you don't want the standard footer -->
|
||||
<footer>
|
||||
<div id="credits">
|
||||
<div>
|
||||
<!-- div>
|
||||
<img src="{{servlet-context}}/img/credits/ric-logo.png" width="24" height="24"/>
|
||||
A project of the
|
||||
<a href="https://radical.scot/">Radical Independence Campaign</a> ||
|
||||
Version {{version}}
|
||||
</div>
|
||||
</div -->
|
||||
<div>
|
||||
<img height="16" width="16" alt="Clojure" src="{{servlet-context}}/img/credits/luminus-logo.png"/>Built with <a href="http://www.luminusweb.net/">LuminusWeb</a> ||
|
||||
<img height="16" width="16" alt="Clojure" src="{{servlet-context}}/img/credits/clojure-icon.gif"/> Powered by <a href="http://clojure.org">Clojure</a> ||
|
||||
|
|
|
@ -2,24 +2,12 @@
|
|||
{% block big-links %}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="col-lg-12">
|
||||
<div class="centering text-center">
|
||||
<div class="text-center">
|
||||
<h1><span class="text-danger">Error: {{status}}</span></h1>
|
||||
{% if status %}
|
||||
<h2>Error: {{status}}</h2>
|
||||
{% endif %}
|
||||
<hr>
|
||||
{% if title %}
|
||||
<h2 class="without-margin">{{title}}</h2>
|
||||
{% if error %}
|
||||
<p>{{error}}</p>
|
||||
{% endif %}
|
||||
{% if message %}
|
||||
<h4 class="text-danger">{{message}}</h4>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -1,4 +1 @@
|
|||
(ns ^{:doc "Field-level authorisation. Messy."
|
||||
:author "Simon Brooke"}
|
||||
youyesyet.authorisation
|
||||
(:require [youyesyet.env :refer [defaults]]))
|
||||
|
||||
|
|
|
@ -113,6 +113,16 @@
|
|||
returns a response map with the error page as the body
|
||||
and the status specified by the status key"
|
||||
[error-details]
|
||||
(log/debug "Showing error page: " error-details)
|
||||
{:status (:status error-details)
|
||||
:headers {"Content-Type" "text/html; charset=utf-8"}
|
||||
:body (render "error.html" {} error-details)})
|
||||
:body (parser/render-file
|
||||
"error.html"
|
||||
(assoc
|
||||
error-details
|
||||
:site-title (:site-title env)
|
||||
:title
|
||||
(str "Apologies, we have a problem: "
|
||||
(:title error-details))
|
||||
:error (:message error-details)
|
||||
:message nil))})
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
|
||||
(defn handle-logout
|
||||
[request]
|
||||
(let [r (response/found (str (:servlet-context request) "/home"))]
|
||||
(let [r (response/found "/home")]
|
||||
(assoc r :session (dissoc (:session r) :user))))
|
||||
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
(fn [e]
|
||||
(assoc e
|
||||
:intentions
|
||||
(db/list-intentions-by-elector db/*db* {:id (:id e)})))
|
||||
(db/list-elector-intentions db/*db* {:id (:id e)})))
|
||||
(db/list-electors-by-dwelling db/*db* {:id (:id d)}))))
|
||||
(db/list-dwellings-by-address db/*db* {:id (:id a)}))))
|
||||
addresses)))
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
:author "Simon Brooke"}
|
||||
youyesyet.canvasser-app.gis
|
||||
(:require [cljs.reader :refer [read-string]]
|
||||
[clojure.string :refer [lower-case]]
|
||||
[cemerick.url :refer (url url-encode)]
|
||||
[day8.re-frame.http-fx]
|
||||
[re-frame.core :refer [dispatch reg-event-db reg-event-fx subscribe]]
|
||||
|
@ -66,13 +67,14 @@
|
|||
(set
|
||||
(remove
|
||||
nil?
|
||||
(map
|
||||
:intention
|
||||
(map :option_id
|
||||
(mapcat
|
||||
:intentions
|
||||
(mapcat :electors
|
||||
(:dwellings address)))))]
|
||||
(:dwellings address))))))]
|
||||
(case (count intentions)
|
||||
0 "unknown-pin"
|
||||
1 (str (name (first intentions)) "-pin")
|
||||
1 (lower-case (str (name (first intentions)) "-pin"))
|
||||
"mixed-pin")))
|
||||
|
||||
|
||||
|
|
|
@ -51,6 +51,16 @@
|
|||
:anchor nil))
|
||||
|
||||
|
||||
(defn handle-forbidden
|
||||
"If response has status 403 (forbidden) redirect to the login page."
|
||||
[response & forms]
|
||||
(if
|
||||
(= (str (:status response)) "403")
|
||||
(do
|
||||
(js/console.log "Forbidden! redirecting")
|
||||
(set! (.-location js/document) "/login"))
|
||||
(apply 'do forms)))
|
||||
|
||||
(defn compose-packet
|
||||
[item]
|
||||
"Convert this `item` into a URI which can be sent as a GET call"
|
||||
|
@ -181,6 +191,7 @@
|
|||
;; TODO: why is this an `-fx`? Does it need to be?
|
||||
(fn
|
||||
[{db :db} [_ response]]
|
||||
(js/console.log (str ":process-locality: " response))
|
||||
(js/console.log (str "Updating locality data: " (count response) " addresses " ))
|
||||
(refresh-map-pins)
|
||||
{:db (assoc
|
||||
|
@ -194,12 +205,14 @@
|
|||
(fn
|
||||
[{db :db} [_ response]]
|
||||
;; TODO: signal something has failed? It doesn't matter very much, unless it keeps failing.
|
||||
(js/console.log "Failed to fetch locality data")
|
||||
(js/console.log (str "Failed to fetch locality data" response))
|
||||
;; loop to do it again
|
||||
(handle-forbidden
|
||||
response
|
||||
(dispatch [:dispatch-later [{:ms 60000 :dispatch [:fetch-locality]}]])
|
||||
{:db (assoc
|
||||
(remove-from-feedback db :fetch-locality)
|
||||
:error (cons :fetch-locality (:error db)))}))
|
||||
:error (cons :fetch-locality (:error db)))})))
|
||||
|
||||
|
||||
(reg-event-fx
|
||||
|
|
16
tomcat-restart.sh
Normal file
16
tomcat-restart.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
# There's a problem with YouYesYet which causes Tomcat to fall over
|
||||
# from time to time; it needs fixed. This is a temporary stopgap
|
||||
# simon, 20180918
|
||||
|
||||
wget -S https://www.projecthope.scot 2>&1 | grep 'HTTP/1.1 5'
|
||||
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
header=`wget -S https://www.projecthope.scot 2>&1 | grep 'HTTP/1.1 5'`
|
||||
timestamp=`date`
|
||||
echo "${timestamp} : ${header} : Restarting Tomcat"
|
||||
service tomcat8 restart
|
||||
fi
|
||||
|
Loading…
Reference in a new issue