diff --git a/env/dev/clj/youyesyet/dev_middleware.clj b/env/dev/clj/youyesyet/dev_middleware.clj
index e3881c8..23fd9db 100644
--- a/env/dev/clj/youyesyet/dev_middleware.clj
+++ b/env/dev/clj/youyesyet/dev_middleware.clj
@@ -1,6 +1,6 @@
(ns youyesyet.dev-middleware
(:require
-;; [ring.middleware.reload :refer [wrap-reload]]
+;; [ring.middleware.reload :refer [wrap-reload]] ;; this fails with a self referential dependency, which I haven't tracked down.
[selmer.middleware :refer [wrap-error-page]]
[prone.middleware :refer [wrap-exceptions]]
))
diff --git a/resources/public/img/authorities/GitHub.png b/resources/public/img/authorities/GitHub.png
new file mode 100644
index 0000000..f69f657
Binary files /dev/null and b/resources/public/img/authorities/GitHub.png differ
diff --git a/resources/public/img/authorities/GitHub.xcf b/resources/public/img/authorities/GitHub.xcf
new file mode 100644
index 0000000..936861d
Binary files /dev/null and b/resources/public/img/authorities/GitHub.xcf differ
diff --git a/resources/public/img/authorities/Twitter.jpg b/resources/public/img/authorities/Twitter.jpg
new file mode 100644
index 0000000..93e24cc
Binary files /dev/null and b/resources/public/img/authorities/Twitter.jpg differ
diff --git a/resources/public/img/authorities/Twitter.png b/resources/public/img/authorities/Twitter.png
new file mode 100644
index 0000000..ee1a7a1
Binary files /dev/null and b/resources/public/img/authorities/Twitter.png differ
diff --git a/resources/public/img/authorities/Twitter.xcf b/resources/public/img/authorities/Twitter.xcf
new file mode 100644
index 0000000..cad1df4
Binary files /dev/null and b/resources/public/img/authorities/Twitter.xcf differ
diff --git a/resources/sql/queries.auto.sql b/resources/sql/queries.auto.sql
index 0f482c4..3e66e95 100644
--- a/resources/sql/queries.auto.sql
+++ b/resources/sql/queries.auto.sql
@@ -1,7 +1,7 @@
------------------------------------------------------------------------
-- File queries.sql
--
--- autogenerated by adl.to-hugsql-queries at 2018-06-29T10:10:58.177Z
+-- autogenerated by adl.to-hugsql-queries at 2018-06-29T14:15:37.324Z
--
-- See [Application Description
-- Language](https://github.com/simon-brooke/adl).
@@ -27,8 +27,18 @@ returning id
-- :name create-authority! :! :n
-- :doc creates a new authority record
-INSERT INTO authorities (id)
-VALUES (:id)
+INSERT INTO authorities (request_token_uri,
+ access_token_uri,
+ authorize_uri,
+ consumer_key,
+ consumer_secret,
+ id)
+VALUES (:request_token_uri,
+ :access_token_uri,
+ :authorize_uri,
+ :consumer_key,
+ :consumer_secret,
+ :id)
returning id
-- :name create-canvasser! :! :n
@@ -121,10 +131,12 @@ returning id
-- :doc creates a new intention record
INSERT INTO intentions (visit_id,
elector_id,
- option_id)
+ option_id,
+ locality)
VALUES (:visit_id,
:elector_id,
- :option_id)
+ :option_id,
+ :locality)
returning Id
-- :name create-issue! :! :n
@@ -747,6 +759,11 @@ ORDER BY lv_addresses.address,
-- :doc selects existing authority records having any string field matching the parameter of the same name by substring match
SELECT * FROM lv_authorities
WHERE false
+ --~ (if (:request-token-uri params) "OR request_token_uri LIKE '%:request-token-uri%'")
+ --~ (if (:access-token-uri params) "OR access_token_uri LIKE '%:access-token-uri%'")
+ --~ (if (:authorize-uri params) "OR authorize_uri LIKE '%:authorize-uri%'")
+ --~ (if (:consumer-key params) "OR consumer_key LIKE '%:consumer-key%'")
+ --~ (if (:consumer-secret params) "OR consumer_secret LIKE '%:consumer-secret%'")
--~ (if (:id params) "OR id LIKE '%:id%'")
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
@@ -868,6 +885,7 @@ WHERE false
--~ (if (:visit_id params) "OR visit_id = :visit_id")
--~ (if (:elector_id params) "OR elector_id = :elector_id")
--~ (if (:option_id params) "OR option_id = :option_id")
+ --~ (if (:locality params) "OR locality = :locality")
--~ (if (:Id params) "OR Id = :Id")
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
@@ -941,6 +959,17 @@ SET address = :address,
locality = :locality
WHERE addresses.id = :id
+-- :name update-authority! :! :n
+-- :doc updates an existing authority record
+UPDATE authorities
+SET request_token_uri = :request-token-uri,
+ access_token_uri = :access-token-uri,
+ authorize_uri = :authorize-uri,
+ consumer_key = :consumer-key,
+ consumer_secret = :consumer-secret,
+ id = :id
+WHERE authorities.id = :id
+
-- :name update-canvasser! :! :n
-- :doc updates an existing canvasser record
UPDATE canvassers
@@ -1001,7 +1030,8 @@ WHERE followuprequests.id = :id
UPDATE intentions
SET visit_id = :visit_id,
elector_id = :elector_id,
- option_id = :option_id
+ option_id = :option_id,
+ locality = :locality
WHERE intentions.Id = :Id
-- :name update-issue! :! :n
diff --git a/resources/sql/youyesyet.postgres.sql b/resources/sql/youyesyet.postgres.sql
index 1bc4b7d..2dbb0c6 100644
--- a/resources/sql/youyesyet.postgres.sql
+++ b/resources/sql/youyesyet.postgres.sql
@@ -5,7 +5,7 @@
--
-- auto-generated by [Application Description Language framework]
--
--- (https://github.com/simon-brooke/adl) at 20180629T101059.126Z
+-- (https://github.com/simon-brooke/adl) at 20180629T141538.194Z
--
--
-- A web-app intended to be used by canvassers campaigning for a
@@ -99,7 +99,12 @@ GRANT DELETE ON addresses TO admin ;
------------------------------------------------------------------------
CREATE TABLE authorities
(
- id VARCHAR(32) NOT NULL PRIMARY KEY
+ id VARCHAR(32) NOT NULL PRIMARY KEY,
+ request_token_uri VARCHAR(256) NOT NULL,
+ access_token_uri VARCHAR(256) NOT NULL,
+ authorize_uri VARCHAR(256) NOT NULL,
+ consumer_key VARCHAR(32) DEFAULT 'youyesyet' NOT NULL,
+ consumer_secret VARCHAR(256) NOT NULL
);
GRANT SELECT ON authorities TO admin,
analysts,
@@ -167,8 +172,15 @@ GRANT DELETE ON districts TO admin ;
------------------------------------------------------------------------
-- primary table dwellings for entity dwellings
--
--- All dwellings within addresses in the system; a dwelling is a house,
--- flat or appartment in which electors live.
+-- All dwellings within addresses in the system; a dwelling is a
+-- house, flat or appartment in which electors live. Every address
+-- should have
+-- at least one dwelling; essentially, an address maps onto a
+-- street door and
+-- dwellings map onto what's behind that door. So a tenement or a
+-- block of flats
+-- would be one address with many dwellings.
+--
------------------------------------------------------------------------
CREATE TABLE dwellings
(
@@ -298,14 +310,15 @@ GRANT DELETE ON genders TO admin ;
------------------------------------------------------------------------
-- primary table intentions for entity intentions
--
--- Link table.
+-- Intentions of electors to vote for options elicited in visits.
------------------------------------------------------------------------
CREATE TABLE intentions
(
Id SERIAL NOT NULL PRIMARY KEY,
visit_id INTEGER NOT NULL,
- elector_id INTEGER NOT NULL,
- option_id VARCHAR(32) NOT NULL
+ elector_id INTEGER,
+ option_id VARCHAR(32) NOT NULL,
+ locality INTEGER NOT NULL
);
GRANT SELECT ON intentions TO admin,
analysts,
@@ -455,7 +468,12 @@ GRANT SELECT ON lv_addresses TO admin,
-- cetera
------------------------------------------------------------------------
CREATE VIEW lv_authorities AS
-SELECT authorities.id
+SELECT authorities.request_token_uri,
+ authorities.access_token_uri,
+ authorities.authorize_uri,
+ authorities.consumer_key,
+ authorities.consumer_secret,
+ authorities.id
FROM authorities
;
GRANT SELECT ON lv_authorities TO admin,
@@ -641,6 +659,7 @@ SELECT addresses.address ||', '|| addresses.postcode ||', '|| visits.date AS vis
intentions.elector_id,
options.id AS option_id_expanded,
intentions.option_id,
+ intentions.locality,
intentions.Id
FROM visits, intentions, addresses, genders, electors, options
WHERE intentions.visit_id = visits.id
diff --git a/resources/templates/auto/application-index.html b/resources/templates/auto/application-index.html
index 1edf694..517fd53 100644
--- a/resources/templates/auto/application-index.html
+++ b/resources/templates/auto/application-index.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
{% block head %}
@@ -49,7 +49,12 @@ Dwelling
-All dwellings within addresses in the system; a dwelling is a house, flat or appartment in which electors live.
+All dwellings within addresses in the system; a dwelling is a
+ house, flat or appartment in which electors live. Every address should have
+ at least one dwelling; essentially, an address maps onto a street door and
+ dwellings map onto what's behind that door. So a tenement or a block of flats
+ would be one address with many dwellings.
+
@@ -99,7 +104,7 @@ Intention
-Link table.
+Intentions of electors to vote for options elicited in visits.
diff --git a/resources/templates/auto/form-addresses-Address.html b/resources/templates/auto/form-addresses-Address.html
index a6d8011..e3dc979 100644
--- a/resources/templates/auto/form-addresses-Address.html
+++ b/resources/templates/auto/form-addresses-Address.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
{% block head %}
diff --git a/resources/templates/auto/form-authorities-Authority.html b/resources/templates/auto/form-authorities-Authority.html
index 6b4756b..8e6a888 100644
--- a/resources/templates/auto/form-authorities-Authority.html
+++ b/resources/templates/auto/form-authorities-Authority.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
{% block head %}
@@ -42,6 +42,96 @@ You are not permitted to view id of authorities
{% endifmemberof %}
{% endifmemberof %}
+