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 %}

+

+ +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.request-token-uri}} + +{% else %} + +You are not permitted to view request-token-uri of authorities + +{% endifmemberof %} +{% endifmemberof %} +

+

+ +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.access-token-uri}} + +{% else %} + +You are not permitted to view access-token-uri of authorities + +{% endifmemberof %} +{% endifmemberof %} +

+

+ +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.authorize-uri}} + +{% else %} + +You are not permitted to view authorize-uri of authorities + +{% endifmemberof %} +{% endifmemberof %} +

+

+ +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.consumer-key}} + +{% else %} + +You are not permitted to view consumer-key of authorities + +{% endifmemberof %} +{% endifmemberof %} +

+

+ +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.consumer-secret}} + +{% else %} + +You are not permitted to view consumer-secret of authorities + +{% endifmemberof %} +{% endifmemberof %} +

+

+ +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers analysts admin %} + +{{record.locality}} + +{% else %} + +You are not permitted to view locality of intentions + +{% endifmemberof %} +{% endifmemberof %} +

{% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} {{record.district_id}} @@ -87,10 +87,10 @@ You are not permitted to view district_id of teams -{% ifmemberof teamorganisers admin %} +{% ifmemberof teamorganisers admin teamorganisers admin %} {% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} {{record.latitude}} @@ -105,7 +105,7 @@ You are not permitted to view latitude of teams -{% ifmemberof teamorganisers admin %} +{% ifmemberof teamorganisers admin teamorganisers admin %}
{% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} {{record.members}} @@ -128,7 +128,7 @@ You are not permitted to view members of teams -{% ifmemberof teamorganisers admin %} +{% ifmemberof teamorganisers admin teamorganisers admin %}
{% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} {{record.organisers}} @@ -151,10 +151,10 @@ You are not permitted to view organisers of teams -{% ifmemberof teamorganisers admin %} +{% ifmemberof teamorganisers admin teamorganisers admin %} {% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} {{record.longitude}} diff --git a/resources/templates/auto/form-visits-Visit.html b/resources/templates/auto/form-visits-Visit.html index e07cca1..65e51ea 100644 --- a/resources/templates/auto/form-visits-Visit.html +++ b/resources/templates/auto/form-visits-Visit.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-addresses-Addresses.html b/resources/templates/auto/list-addresses-Addresses.html index 829be5b..96da5ee 100644 --- a/resources/templates/auto/list-addresses-Addresses.html +++ b/resources/templates/auto/list-addresses-Addresses.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-authorities-Authorities.html b/resources/templates/auto/list-authorities-Authorities.html index d20fe9d..35d09f1 100644 --- a/resources/templates/auto/list-authorities-Authorities.html +++ b/resources/templates/auto/list-authorities-Authorities.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} @@ -33,12 +33,30 @@ Add a new Authority id + +request-token-uri + + +access-token-uri + + +authorize-uri + + + + + + + + + + @@ -50,6 +68,15 @@ id {{ record.id }} +{{ record.request_token_uri }} + + +{{ record.access_token_uri }} + + +{{ record.authorize_uri }} + + View diff --git a/resources/templates/auto/list-canvassers-Canvassers.html b/resources/templates/auto/list-canvassers-Canvassers.html index c9719e0..c37423a 100644 --- a/resources/templates/auto/list-canvassers-Canvassers.html +++ b/resources/templates/auto/list-canvassers-Canvassers.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-districts-Districts.html b/resources/templates/auto/list-districts-Districts.html index 982e2d4..1ae5e72 100644 --- a/resources/templates/auto/list-districts-Districts.html +++ b/resources/templates/auto/list-districts-Districts.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-dwellings-Dwellings.html b/resources/templates/auto/list-dwellings-Dwellings.html index 4d633ca..22a42e9 100644 --- a/resources/templates/auto/list-dwellings-Dwellings.html +++ b/resources/templates/auto/list-dwellings-Dwellings.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} @@ -48,7 +48,7 @@ sub-address - + @@ -67,7 +67,7 @@ sub-address -{{ record.sub-address }} +{{ record.sub_address }} diff --git a/resources/templates/auto/list-electors-Electors.html b/resources/templates/auto/list-electors-Electors.html index 383fce7..103b700 100644 --- a/resources/templates/auto/list-electors-Electors.html +++ b/resources/templates/auto/list-electors-Electors.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-followupactions-Followupactions.html b/resources/templates/auto/list-followupactions-Followupactions.html index 26697ec..a4c3dca 100644 --- a/resources/templates/auto/list-followupactions-Followupactions.html +++ b/resources/templates/auto/list-followupactions-Followupactions.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-followupmethods-Followupmethods.html b/resources/templates/auto/list-followupmethods-Followupmethods.html index 74c7b37..457d6f5 100644 --- a/resources/templates/auto/list-followupmethods-Followupmethods.html +++ b/resources/templates/auto/list-followupmethods-Followupmethods.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-followuprequests-Followuprequests.html b/resources/templates/auto/list-followuprequests-Followuprequests.html index 55a4b48..c81c924 100644 --- a/resources/templates/auto/list-followuprequests-Followuprequests.html +++ b/resources/templates/auto/list-followuprequests-Followuprequests.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-genders-Genders.html b/resources/templates/auto/list-genders-Genders.html index 8ce6cc1..64da2fe 100644 --- a/resources/templates/auto/list-genders-Genders.html +++ b/resources/templates/auto/list-genders-Genders.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-intentions-Intentions.html b/resources/templates/auto/list-intentions-Intentions.html index c90c0c9..8fc6118 100644 --- a/resources/templates/auto/list-intentions-Intentions.html +++ b/resources/templates/auto/list-intentions-Intentions.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} @@ -39,6 +39,9 @@ elector_id option_id + +locality + @@ -51,6 +54,9 @@ option_id + + + @@ -74,6 +80,9 @@ option_id +{{ record.locality }} + + View diff --git a/resources/templates/auto/list-issues-Issues.html b/resources/templates/auto/list-issues-Issues.html index 622cbae..1c08c80 100644 --- a/resources/templates/auto/list-issues-Issues.html +++ b/resources/templates/auto/list-issues-Issues.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-options-Options.html b/resources/templates/auto/list-options-Options.html index bb735be..fd49da7 100644 --- a/resources/templates/auto/list-options-Options.html +++ b/resources/templates/auto/list-options-Options.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-roles-Roles.html b/resources/templates/auto/list-roles-Roles.html index 76cdc21..af780fe 100644 --- a/resources/templates/auto/list-roles-Roles.html +++ b/resources/templates/auto/list-roles-Roles.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-teams-Teams.html b/resources/templates/auto/list-teams-Teams.html index 613cff7..089ef34 100644 --- a/resources/templates/auto/list-teams-Teams.html +++ b/resources/templates/auto/list-teams-Teams.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/auto/list-visits-Visits.html b/resources/templates/auto/list-visits-Visits.html index f37ba72..93fe01b 100644 --- a/resources/templates/auto/list-visits-Visits.html +++ b/resources/templates/auto/list-visits-Visits.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - {% block head %} diff --git a/resources/templates/base-authenticated.html b/resources/templates/base-authenticated.html index 22af08a..4fd1834 100644 --- a/resources/templates/base-authenticated.html +++ b/resources/templates/base-authenticated.html @@ -16,12 +16,12 @@