From 9c3af4c936f1fd2da9be728a0874e4d455b778c1 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Mon, 9 Jul 2018 22:00:39 +0100 Subject: [PATCH] #17: progress, not complete. --- project.clj | 6 +- resources/sql/queries.auto.sql | 22 ++- resources/sql/queries.sql | 23 +++ resources/sql/youyesyet.postgres.sql | 64 +++++- .../templates/auto/application-index.html | 36 ++-- .../auto/form-addresses-Address.html | 123 ++++++++++-- .../auto/form-authorities-Authority.html | 100 +++++++++- .../auto/form-canvassers-Canvasser.html | 187 ++++++++++++++++-- .../auto/form-districts-District.html | 37 ++-- .../auto/form-dwellings-Dwelling.html | 59 ++++-- .../templates/auto/form-electors-Elector.html | 111 +++++++++-- .../templates/auto/form-events-Events.html | 125 ++++++++++-- .../form-followupactions-Followupaction.html | 115 +++++++++-- .../form-followupmethods-Followupmethod.html | 20 +- ...form-followuprequests-Followuprequest.html | 105 ++++++++-- .../templates/auto/form-genders-Gender.html | 20 +- .../auto/form-intentions-Intention.html | 82 +++++++- .../templates/auto/form-issues-Issue.html | 85 +++++++- .../templates/auto/form-options-Option.html | 20 +- resources/templates/auto/form-roles-Role.html | 59 ++++-- resources/templates/auto/form-teams-Team.html | 135 +++++++++++-- .../templates/auto/form-visits-Visit.html | 80 +++++++- .../auto/list-addresses-Addresses.html | 8 +- .../auto/list-authorities-Authorities.html | 6 +- .../auto/list-canvassers-Canvassers.html | 12 +- .../auto/list-districts-Districts.html | 6 +- .../auto/list-dwellings-Dwellings.html | 8 +- .../auto/list-electors-Electors.html | 10 +- .../templates/auto/list-events-Events.html | 6 +- .../list-followupactions-Followupactions.html | 10 +- .../list-followupmethods-Followupmethods.html | 6 +- ...ist-followuprequests-Followuprequests.html | 14 +- .../templates/auto/list-genders-Genders.html | 6 +- .../auto/list-intentions-Intentions.html | 12 +- .../templates/auto/list-issues-Issues.html | 6 +- .../templates/auto/list-options-Options.html | 6 +- .../templates/auto/list-roles-Roles.html | 6 +- .../templates/auto/list-teams-Teams.html | 8 +- .../templates/auto/list-visits-Visits.html | 10 +- resources/templates/base.html | 27 ++- resources/templates/issue-expert/list.html | 0 resources/templates/issue-expert/request.html | 55 ++++++ resources/templates/roles/canvasser.html | 9 + resources/templates/untitled.html | 0 src/clj/youyesyet/handler.clj | 8 +- src/clj/youyesyet/routes/auto.clj | 7 +- src/clj/youyesyet/routes/auto_json.clj | 20 +- src/clj/youyesyet/routes/issue_experts.clj | 68 +++++++ src/clj/youyesyet/routes/roles.clj | 31 +-- src/cljs/youyesyet/canvasser_app/core.cljs | 9 +- src/cljs/youyesyet/canvasser_app/gis.cljs | 139 +++++++++++++ .../youyesyet/canvasser_app/handlers.cljs | 117 ++--------- .../youyesyet/canvasser_app/views/map.cljs | 3 +- src/cljs/youyesyet/issue_expert_app/README.md | 5 + src/cljs/youyesyet/issue_expert_app/core.cljs | 0 .../issue_expert_app/views/list.cljs | 52 +++++ youyesyet.adl.xml | 38 ++-- youyesyet.canonical.adl.xml | 17 +- 58 files changed, 1896 insertions(+), 463 deletions(-) create mode 100644 resources/templates/issue-expert/list.html create mode 100644 resources/templates/issue-expert/request.html create mode 100644 resources/templates/roles/canvasser.html create mode 100644 resources/templates/untitled.html create mode 100644 src/clj/youyesyet/routes/issue_experts.clj create mode 100644 src/cljs/youyesyet/canvasser_app/gis.cljs create mode 100644 src/cljs/youyesyet/issue_expert_app/README.md create mode 100644 src/cljs/youyesyet/issue_expert_app/core.cljs create mode 100644 src/cljs/youyesyet/issue_expert_app/views/list.cljs diff --git a/project.clj b/project.clj index 6ae71ee..f253f46 100644 --- a/project.clj +++ b/project.clj @@ -33,7 +33,7 @@ [org.webjars/bootstrap "4.0.0-alpha.6-1"] [org.webjars/font-awesome "4.7.0"] [org.webjars.bower/tether "1.4.0"] - [re-frame "0.9.2"] + [re-frame "0.10.5"] [reagent "0.6.1"] [reagent-utils "0.2.1"] [ring-middleware-format "0.7.2"] @@ -136,10 +136,10 @@ [com.cemerick/piggieback "0.2.2-SNAPSHOT"] [directory-naming/naming-java "0.8"] [doo "0.1.7"] - [figwheel-sidecar "0.5.9"]] + [figwheel-sidecar "0.5.15"]] :plugins [[com.jakemccrary/lein-test-refresh "0.18.1"] [lein-doo "0.1.7"] - [lein-figwheel "0.5.9"] + [lein-figwheel "0.5.15"] [org.clojure/clojurescript "1.9.495"]] :cljsbuild {:builds diff --git a/resources/sql/queries.auto.sql b/resources/sql/queries.auto.sql index 4797930..2009302 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-07-07T08:09:48.253Z +-- autogenerated by adl.to-hugsql-queries at 2018-07-09T20:55:32.719Z -- -- See [Application Description -- Language](https://github.com/simon-brooke/adl). @@ -504,6 +504,19 @@ ORDER BY lv_canvassers.username, lv_canvassers.email, lv_canvassers.id +-- :name list-canvassers-by-issue :? :* +-- :doc links all existing canvasser records related to a given issue +SELECT * +FROM canvassers, ln_expertise_canvassers_issues +WHERE canvassers.id = ln_expertise_canvassers_issues.canvasser_id + AND ln_expertise_canvassers_issues.issue_id = :id +ORDER BY canvassers.username, + canvassers.fullname, + canvassers.address_id, + canvassers.phone, + canvassers.email, + canvassers.id + -- :name list-canvassers-by-role :? :* -- :doc links all existing canvasser records related to a given role SELECT * @@ -728,6 +741,13 @@ SELECT DISTINCT * FROM lv_issues --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") +-- :name list-issues-by-canvasser :? :* +-- :doc links all existing issue records related to a given canvasser +SELECT * +FROM issues, ln_experts_issues_canvassers +WHERE issues.id = ln_experts_issues_canvassers.issue_id + AND ln_experts_issues_canvassers.canvasser_id = :id + -- :name list-options :? :* -- :doc lists all existing option records SELECT DISTINCT * FROM lv_options diff --git a/resources/sql/queries.sql b/resources/sql/queries.sql index 9735513..a50d78f 100644 --- a/resources/sql/queries.sql +++ b/resources/sql/queries.sql @@ -36,4 +36,27 @@ FROM addresses WHERE locality = :locality +-- :name list-open-requests :? :* +-- :doc lists all existing followuprequest records which have not been closed and which the :expert has expertise to answer. +SELECT DISTINCT request.*, + electors.name ||', '|| electors.gender AS elector_id_expanded, + addresses.address ||', '|| addresses.postcode ||', '|| visits.date AS visit_id_expanded, + request.issue_id as issue_id_expanded, + request.method_id AS method_id_expanded, + visits.date +FROM followuprequests as request, + ln_experts_issues_canvassers as expertise, + canvassers as experts, + electors, + addresses, + visits +where not exists (select * from followupactions as action + where action.request_id = request.id + and action.closed = true) +and request.elector_id = electors.id +and request.visit_id = visits.id +and visits.address_id = addresses.id +and request.issue_id = expertise.issue_id +and expertise.canvasser_id = :expert +ORDER BY visits.date desc diff --git a/resources/sql/youyesyet.postgres.sql b/resources/sql/youyesyet.postgres.sql index 3143ff6..f092acb 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 20180707T080949.294Z +-- (https://github.com/simon-brooke/adl) at 20180709T205533.789Z -- -- A web-app intended to be used by canvassers -- campaigning for a 'Yes' vote in the second independence @@ -915,6 +915,38 @@ ALTER TABLE visits ADD CONSTRAINT ri_visits_canvassers_canvasser_id REFERENCES canvassers(id) ON DELETE NO ACTION ; +------------------------------------------------------------------------ +-- link table joining canvassers with issues +------------------------------------------------------------------------ +CREATE TABLE ln_expertise_canvassers_issues +( + canvasser_id INTEGER, + issue_id VARCHAR(32) +); +GRANT SELECT ON ln_expertise_canvassers_issues TO admin, + analysts, + canvassers, + issueeditors, + issueexperts, + teamorganisers ; +GRANT INSERT ON ln_expertise_canvassers_issues TO admin, + canvassers, + teamorganisers ; +GRANT UPDATE ON ln_expertise_canvassers_issues TO admin, + canvassers, + teamorganisers ; +GRANT DELETE ON ln_expertise_canvassers_issues TO admin ; + +ALTER TABLE ln_expertise_canvassers_issues ADD CONSTRAINT ri_ln_expertise_canvassers_issues_canvassers_canvasser_id + FOREIGN KEY( canvasser_id ) + REFERENCES canvassers(id) + ON DELETE NO ACTION ; + +ALTER TABLE ln_expertise_canvassers_issues ADD CONSTRAINT ri_ln_expertise_canvassers_issues_issues_issue_id + FOREIGN KEY( issue_id ) + REFERENCES issues(id) + ON DELETE NO ACTION ; + ------------------------------------------------------------------------ -- link table joining canvassers with roles ------------------------------------------------------------------------ @@ -977,6 +1009,36 @@ ALTER TABLE ln_teams_events_teams ADD CONSTRAINT ri_ln_teams_events_teams_teams_ REFERENCES teams(id) ON DELETE NO ACTION ; +------------------------------------------------------------------------ +-- link table joining issues with canvassers +------------------------------------------------------------------------ +CREATE TABLE ln_experts_issues_canvassers +( + issue_id VARCHAR(32), + canvasser_id INTEGER +); +GRANT SELECT ON ln_experts_issues_canvassers TO admin, + analysts, + canvassers, + issueeditors, + issueexperts, + teamorganisers ; +GRANT INSERT ON ln_experts_issues_canvassers TO admin, + issueeditors ; +GRANT UPDATE ON ln_experts_issues_canvassers TO admin, + issueeditors ; +GRANT DELETE ON ln_experts_issues_canvassers TO admin ; + +ALTER TABLE ln_experts_issues_canvassers ADD CONSTRAINT ri_ln_experts_issues_canvassers_canvassers_canvasser_id + FOREIGN KEY( canvasser_id ) + REFERENCES canvassers(id) + ON DELETE NO ACTION ; + +ALTER TABLE ln_experts_issues_canvassers ADD CONSTRAINT ri_ln_experts_issues_canvassers_issues_issue_id + FOREIGN KEY( issue_id ) + REFERENCES issues(id) + ON DELETE NO ACTION ; + ------------------------------------------------------------------------ -- link table joining roles with canvassers ------------------------------------------------------------------------ diff --git a/resources/templates/auto/application-index.html b/resources/templates/auto/application-index.html index 2c5e2ca..4f7b672 100644 --- a/resources/templates/auto/application-index.html +++ b/resources/templates/auto/application-index.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - @@ -7,7 +7,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
- + Address
@@ -22,7 +22,7 @@ Addresses of all buildings which contain {% endifmemberof %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
- + Authority
@@ -37,7 +37,7 @@ Authorities which may authenticate canvassers to {% endifmemberof %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %}
- + Canvasser
@@ -52,7 +52,7 @@ Primary users of the system: those actually {% endifmemberof %} {% ifmemberof public admin canvassers teamorganisers issueexperts analysts issueeditors %}
- + District
@@ -68,7 +68,7 @@ Electoral districts: TODO: Shape (polygon) {% endifmemberof %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
- + Dwelling
@@ -87,7 +87,7 @@ All dwellings within addresses in the system; a {% endifmemberof %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
- + Elector
@@ -103,7 +103,7 @@ All electors known to the system; electors are {% endifmemberof %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
- + Event
@@ -120,7 +120,7 @@ Event {% endifmemberof %} {% ifmemberof issueexperts canvassers analysts issueeditors admin %}
- + Followupaction
@@ -135,7 +135,7 @@ Actions taken on followup {% endifmemberof %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
- + Followupmethod
@@ -146,7 +146,7 @@ Followupmethod {% endifmemberof %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
- + Followuprequest
@@ -161,7 +161,7 @@ Requests for a followup with an issue {% endifmemberof %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
- + Gender
@@ -176,7 +176,7 @@ All genders which may be assigned to {% endifmemberof %} {% ifmemberof canvassers analysts admin %}
- + Intention
@@ -191,7 +191,7 @@ Intentions of electors to vote for options {% endifmemberof %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
- + Issue
@@ -206,7 +206,7 @@ Issues believed to be of interest to electors, {% endifmemberof %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
- + Option
@@ -221,7 +221,7 @@ Options in the election or referendum being {% endifmemberof %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
- + Role
@@ -237,7 +237,7 @@ A role (essentially, the same as a group, but {% endifmemberof %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers admin %}
- + Team
@@ -248,7 +248,7 @@ Team {% endifmemberof %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers %}
- + Visit
diff --git a/resources/templates/auto/form-addresses-Address.html b/resources/templates/auto/form-addresses-Address.html index 7a5b0f6..34336c2 100644 --- a/resources/templates/auto/form-addresses-Address.html +++ b/resources/templates/auto/form-addresses-Address.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - @@ -10,28 +10,12 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} -

- -{% ifmemberof admin %} - -{% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} - -{{record.id}} - -{% else %} - -You are not permitted to view id of addresses - -{% endifmemberof %} -{% endifmemberof %} -

+

+{% if {{record.address}} %} {% ifmemberof admin %} {% else %} @@ -45,11 +29,27 @@ You are not permitted to view address of addresses {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.address}} + +{% else %} + +You are not permitted to view address of addresses + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.postcode}} %} {% ifmemberof admin %} {% else %} @@ -63,11 +63,27 @@ You are not permitted to view postcode of addresses {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.postcode}} + +{% else %} + +You are not permitted to view postcode of addresses + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.phone}} %} {% ifmemberof admin %} {% else %} @@ -81,11 +97,27 @@ You are not permitted to view phone of addresses {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.phone}} + +{% else %} + +You are not permitted to view phone of addresses + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.district_id}} %} {% ifmemberof admin %} @@ -105,11 +137,33 @@ You are not permitted to view district_id of addresses {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + + +
+ +
+{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.district_id}} + +{% else %} + +You are not permitted to view district_id of addresses + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.latitude}} %} {% ifmemberof admin %} {% else %} @@ -123,11 +177,27 @@ You are not permitted to view latitude of addresses {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.latitude}} + +{% else %} + +You are not permitted to view latitude of addresses + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.longitude}} %} {% ifmemberof admin %} {% else %} @@ -141,6 +211,21 @@ You are not permitted to view longitude of addresses {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.longitude}} + +{% else %} + +You are not permitted to view longitude of addresses + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

{% ifmemberof admin %}

diff --git a/resources/templates/auto/form-authorities-Authority.html b/resources/templates/auto/form-authorities-Authority.html index 23f5b30..5e537e5 100644 --- a/resources/templates/auto/form-authorities-Authority.html +++ b/resources/templates/auto/form-authorities-Authority.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - @@ -14,8 +14,9 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> +{% if {{record.id}} %} {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -27,11 +28,27 @@ You are not permitted to view id of authorities {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.id}} + +{% else %} + +You are not permitted to view id of authorities + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.request-token-uri}} %} {% ifmemberof admin %} {% else %} @@ -45,11 +62,27 @@ You are not permitted to view request_token_uri of authorities {% endifmemberof %} {% endifmemberof %} +{% else %} +{% 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 %} +{% endif %}

+{% if {{record.access-token-uri}} %} {% ifmemberof admin %} {% else %} @@ -63,11 +96,27 @@ You are not permitted to view access_token_uri of authorities {% endifmemberof %} {% endifmemberof %} +{% else %} +{% 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 %} +{% endif %}

+{% if {{record.authorize-uri}} %} {% ifmemberof admin %} {% else %} @@ -81,11 +130,27 @@ You are not permitted to view authorize_uri of authorities {% endifmemberof %} {% endifmemberof %} +{% else %} +{% 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 %} +{% endif %}

+{% if {{record.consumer-key}} %} {% ifmemberof admin %} {% else %} @@ -99,11 +164,27 @@ You are not permitted to view consumer_key of authorities {% endifmemberof %} {% endifmemberof %} +{% else %} +{% 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 %} +{% endif %}

+{% if {{record.consumer-secret}} %} {% ifmemberof admin %} {% else %} @@ -117,6 +198,21 @@ You are not permitted to view consumer_secret of authorities {% endifmemberof %} {% endifmemberof %} +{% else %} +{% 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 %} +{% endif %}

{% ifmemberof admin %}

diff --git a/resources/templates/auto/form-canvassers-Canvasser.html b/resources/templates/auto/form-canvassers-Canvasser.html index f439443..e8d85ff 100644 --- a/resources/templates/auto/form-canvassers-Canvasser.html +++ b/resources/templates/auto/form-canvassers-Canvasser.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - @@ -11,28 +11,12 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->

{% csrf-field %} -

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

+

+{% if {{record.username}} %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% else %} @@ -46,11 +30,27 @@ You are not permitted to view username of canvassers {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.username}} + +{% else %} + +You are not permitted to view username of canvassers + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.fullname}} %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% else %} @@ -64,11 +64,27 @@ You are not permitted to view fullname of canvassers {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.fullname}} + +{% else %} + +You are not permitted to view fullname of canvassers + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.elector_id}} %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} @@ -88,11 +104,33 @@ You are not permitted to view elector_id of canvassers {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} + + +
+ +
+{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.elector_id}} + +{% else %} + +You are not permitted to view elector_id of canvassers + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.address_id}} %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} @@ -112,11 +150,33 @@ You are not permitted to view address_id of canvassers {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} + + +
+ +
+{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.address_id}} + +{% else %} + +You are not permitted to view address_id of canvassers + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.phone}} %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% else %} @@ -130,11 +190,27 @@ You are not permitted to view phone of canvassers {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.phone}} + +{% else %} + +You are not permitted to view phone of canvassers + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.email}} %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% else %} @@ -148,11 +224,27 @@ You are not permitted to view email of canvassers {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.email}} + +{% else %} + +You are not permitted to view email of canvassers + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.authority_id}} %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} @@ -172,11 +264,33 @@ You are not permitted to view authority_id of canvassers {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} + + +
+ +
+{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.authority_id}} + +{% else %} + +You are not permitted to view authority_id of canvassers + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.authorised}} %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% else %} @@ -190,11 +304,27 @@ You are not permitted to view authorised of canvassers {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.authorised}} + +{% else %} + +You are not permitted to view authorised of canvassers + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.roles}} %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} +{% for r in roles %}{% endfor %} + + +{% else %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.roles}} + +{% else %} + +You are not permitted to view roles of canvassers + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %}

diff --git a/resources/templates/auto/form-districts-District.html b/resources/templates/auto/form-districts-District.html index ba48163..d9f1549 100644 --- a/resources/templates/auto/form-districts-District.html +++ b/resources/templates/auto/form-districts-District.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - @@ -10,28 +10,12 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->

{% csrf-field %} -

- -{% ifmemberof admin %} - -{% else %} -{% ifmemberof public admin canvassers teamorganisers issueexperts analysts issueeditors %} - -{{record.id}} - -{% else %} - -You are not permitted to view id of districts - -{% endifmemberof %} -{% endifmemberof %} -

+

+{% if {{record.name}} %} {% ifmemberof admin %} {% else %} @@ -45,6 +29,21 @@ You are not permitted to view name of districts {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof public admin canvassers teamorganisers issueexperts analysts issueeditors %} + +{{record.name}} + +{% else %} + +You are not permitted to view name of districts + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

{% ifmemberof admin %}

diff --git a/resources/templates/auto/form-dwellings-Dwelling.html b/resources/templates/auto/form-dwellings-Dwelling.html index 68b7d2d..bb1f2cd 100644 --- a/resources/templates/auto/form-dwellings-Dwelling.html +++ b/resources/templates/auto/form-dwellings-Dwelling.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - @@ -10,28 +10,12 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->

{% csrf-field %} -

- -{% ifmemberof admin %} - -{% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} - -{{record.id}} - -{% else %} - -You are not permitted to view id of dwellings - -{% endifmemberof %} -{% endifmemberof %} -

+

+{% if {{record.address_id}} %} {% ifmemberof admin %} @@ -51,11 +35,33 @@ You are not permitted to view address_id of dwellings {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + + +
+ +
+{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.address_id}} + +{% else %} + +You are not permitted to view address_id of dwellings + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.sub-address}} %} {% ifmemberof admin %} {% else %} @@ -69,6 +75,21 @@ You are not permitted to view sub_address of dwellings {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.sub_address}} + +{% else %} + +You are not permitted to view sub_address of dwellings + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

{% ifmemberof admin %}

diff --git a/resources/templates/auto/form-electors-Elector.html b/resources/templates/auto/form-electors-Elector.html index bcf433d..33a6f7d 100644 --- a/resources/templates/auto/form-electors-Elector.html +++ b/resources/templates/auto/form-electors-Elector.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - @@ -10,28 +10,12 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->

{% csrf-field %} -

- -{% ifmemberof admin %} - -{% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} - -{{record.id}} - -{% else %} - -You are not permitted to view id of electors - -{% endifmemberof %} -{% endifmemberof %} -

+

+{% if {{record.name}} %} {% ifmemberof admin %} {% else %} @@ -45,11 +29,27 @@ You are not permitted to view name of electors {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.name}} + +{% else %} + +You are not permitted to view name of electors + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.dwelling_id}} %} {% ifmemberof admin %} @@ -69,11 +69,33 @@ You are not permitted to view dwelling_id of electors {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + + +
+ +
+{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.dwelling_id}} + +{% else %} + +You are not permitted to view dwelling_id of electors + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.phone}} %} {% ifmemberof admin %} {% else %} @@ -87,11 +109,27 @@ You are not permitted to view phone of electors {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.phone}} + +{% else %} + +You are not permitted to view phone of electors + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.email}} %} {% ifmemberof admin %} {% else %} @@ -105,11 +143,27 @@ You are not permitted to view email of electors {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.email}} + +{% else %} + +You are not permitted to view email of electors + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.gender}} %} {% ifmemberof admin %} +{% for r in genders %}{% endfor %} + + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.gender}} + +{% else %} + +You are not permitted to view gender of electors + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

{% ifmemberof admin %}

diff --git a/resources/templates/auto/form-events-Events.html b/resources/templates/auto/form-events-Events.html index d4162a8..186b51d 100644 --- a/resources/templates/auto/form-events-Events.html +++ b/resources/templates/auto/form-events-Events.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - @@ -11,28 +11,12 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->

{% csrf-field %} -

- -{% ifmemberof teamorganisers admin %} - -{% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} - -{{record.id}} - -{% else %} - -You are not permitted to view id of events - -{% endifmemberof %} -{% endifmemberof %} -

+

+{% if {{record.name}} %} {% ifmemberof teamorganisers admin %} {% else %} @@ -46,11 +30,27 @@ You are not permitted to view name of events {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof teamorganisers admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.name}} + +{% else %} + +You are not permitted to view name of events + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.teams}} %} {% ifmemberof teamorganisers admin %} @@ -70,11 +70,33 @@ You are not permitted to view teams of events {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof teamorganisers admin %} + + +
+ +
+{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.teams}} + +{% else %} + +You are not permitted to view teams of events + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.date}} %} {% ifmemberof teamorganisers admin %} {% else %} @@ -88,11 +110,27 @@ You are not permitted to view date of events {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof teamorganisers admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.date}} + +{% else %} + +You are not permitted to view date of events + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.time}} %} {% ifmemberof teamorganisers admin %} {% else %} @@ -106,11 +144,27 @@ You are not permitted to view time of events {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof teamorganisers admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.time}} + +{% else %} + +You are not permitted to view time of events + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.decription}} %} {% ifmemberof teamorganisers admin %} +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.decription}} + +{% else %} + +You are not permitted to view decription of events + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.cancelled}} %} {% ifmemberof teamorganisers admin %} {% else %} @@ -144,6 +216,21 @@ You are not permitted to view cancelled of events {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof teamorganisers admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.cancelled}} + +{% else %} + +You are not permitted to view cancelled of events + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

{% ifmemberof teamorganisers admin %}

diff --git a/resources/templates/auto/form-followupactions-Followupaction.html b/resources/templates/auto/form-followupactions-Followupaction.html index c118a99..0da845b 100644 --- a/resources/templates/auto/form-followupactions-Followupaction.html +++ b/resources/templates/auto/form-followupactions-Followupaction.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - @@ -11,28 +11,12 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->

{% csrf-field %} -

- -{% ifmemberof admin %} - -{% else %} -{% ifmemberof issueexperts canvassers analysts issueeditors admin %} - -{{record.id}} - -{% else %} - -You are not permitted to view id of followupactions - -{% endifmemberof %} -{% endifmemberof %} -

+

+{% if {{record.request_id}} %} {% ifmemberof admin %} @@ -52,11 +36,33 @@ You are not permitted to view request_id of followupactions {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + + +
+ +
+{% else %} +{% ifmemberof issueexperts canvassers analysts issueeditors admin %} + +{{record.request_id}} + +{% else %} + +You are not permitted to view request_id of followupactions + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.actor}} %} {% ifmemberof admin %} @@ -76,11 +82,33 @@ You are not permitted to view actor of followupactions {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + + +
+ +
+{% else %} +{% ifmemberof issueexperts canvassers analysts issueeditors admin %} + +{{record.actor}} + +{% else %} + +You are not permitted to view actor of followupactions + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.date}} %} {% ifmemberof admin %} {% else %} @@ -94,11 +122,27 @@ You are not permitted to view date of followupactions {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof issueexperts canvassers analysts issueeditors admin %} + +{{record.date}} + +{% else %} + +You are not permitted to view date of followupactions + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.notes}} %} {% ifmemberof admin %} +{% else %} +{% ifmemberof issueexperts canvassers analysts issueeditors admin %} + +{{record.notes}} + +{% else %} + +You are not permitted to view notes of followupactions + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.closed}} %} {% ifmemberof admin %} {% else %} @@ -132,6 +194,21 @@ You are not permitted to view closed of followupactions {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof issueexperts canvassers analysts issueeditors admin %} + +{{record.closed}} + +{% else %} + +You are not permitted to view closed of followupactions + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

{% ifmemberof admin %}

diff --git a/resources/templates/auto/form-followupmethods-Followupmethod.html b/resources/templates/auto/form-followupmethods-Followupmethod.html index 43c7f50..95cb462 100644 --- a/resources/templates/auto/form-followupmethods-Followupmethod.html +++ b/resources/templates/auto/form-followupmethods-Followupmethod.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - @@ -14,8 +14,9 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> +{% if {{record.id}} %} {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -27,6 +28,21 @@ You are not permitted to view id of followupmethods {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.id}} + +{% else %} + +You are not permitted to view id of followupmethods + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

{% ifmemberof admin %}

diff --git a/resources/templates/auto/form-followuprequests-Followuprequest.html b/resources/templates/auto/form-followuprequests-Followuprequest.html index 0570e73..3498ba8 100644 --- a/resources/templates/auto/form-followuprequests-Followuprequest.html +++ b/resources/templates/auto/form-followuprequests-Followuprequest.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - @@ -10,28 +10,12 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->

{% csrf-field %} -

- -{% ifmemberof admin %} - -{% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} - -{{record.id}} - -{% else %} - -You are not permitted to view id of followuprequests - -{% endifmemberof %} -{% endifmemberof %} -

+

+{% if {{record.elector_id}} %} {% ifmemberof admin %} @@ -51,11 +35,33 @@ You are not permitted to view elector_id of followuprequests {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + + +
+ +
+{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.elector_id}} + +{% else %} + +You are not permitted to view elector_id of followuprequests + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.visit_id}} %} {% ifmemberof admin %} @@ -75,11 +81,33 @@ You are not permitted to view visit_id of followuprequests {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + + +
+ +
+{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.visit_id}} + +{% else %} + +You are not permitted to view visit_id of followuprequests + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.issue_id}} %} {% ifmemberof admin %} +{% for r in issues %}{% endfor %} + + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.issue_id}} + +{% else %} + +You are not permitted to view issue_id of followuprequests + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.method_id}} %} {% ifmemberof admin %} +{% for r in followupmethods %}{% endfor %} + + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.method_id}} + +{% else %} + +You are not permitted to view method_id of followuprequests + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

{% ifmemberof admin %}

diff --git a/resources/templates/auto/form-genders-Gender.html b/resources/templates/auto/form-genders-Gender.html index 052dd48..54b3900 100644 --- a/resources/templates/auto/form-genders-Gender.html +++ b/resources/templates/auto/form-genders-Gender.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - @@ -14,8 +14,9 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> +{% if {{record.id}} %} {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -27,6 +28,21 @@ You are not permitted to view id of genders {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.id}} + +{% else %} + +You are not permitted to view id of genders + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

{% ifmemberof admin %}

diff --git a/resources/templates/auto/form-intentions-Intention.html b/resources/templates/auto/form-intentions-Intention.html index 537528f..a9a93e8 100644 --- a/resources/templates/auto/form-intentions-Intention.html +++ b/resources/templates/auto/form-intentions-Intention.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - @@ -14,6 +14,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> +{% if {{record.visit_id}} %} {% ifmemberof admin %} @@ -33,11 +34,33 @@ You are not permitted to view visit_id of intentions {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + + +
+ +
+{% else %} +{% ifmemberof canvassers analysts admin %} + +{{record.visit_id}} + +{% else %} + +You are not permitted to view visit_id of intentions + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.elector_id}} %} {% ifmemberof admin %} @@ -57,11 +80,33 @@ You are not permitted to view elector_id of intentions {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + + +
+ +
+{% else %} +{% ifmemberof canvassers analysts admin %} + +{{record.elector_id}} + +{% else %} + +You are not permitted to view elector_id of intentions + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.option_id}} %} {% ifmemberof admin %} +{% for r in options %}{% endfor %} + + +{% else %} +{% ifmemberof canvassers analysts admin %} + +{{record.option_id}} + +{% else %} + +You are not permitted to view option_id of intentions + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.locality}} %} {% ifmemberof admin %} {% else %} @@ -97,6 +162,21 @@ You are not permitted to view locality of intentions {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof admin %} + +{% else %} +{% ifmemberof canvassers analysts admin %} + +{{record.locality}} + +{% else %} + +You are not permitted to view locality of intentions + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

{% ifmemberof admin %}

diff --git a/resources/templates/auto/form-issues-Issue.html b/resources/templates/auto/form-issues-Issue.html index a4238f2..dbd7e03 100644 --- a/resources/templates/auto/form-issues-Issue.html +++ b/resources/templates/auto/form-issues-Issue.html @@ -1,5 +1,5 @@ {% extends "base.html" %} - @@ -15,8 +15,9 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> +{% if {{record.id}} %} {% ifmemberof issueeditors admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -28,11 +29,27 @@ You are not permitted to view id of issues {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof issueeditors admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.id}} + +{% else %} + +You are not permitted to view id of issues + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.url}} %} {% ifmemberof issueeditors admin %} {% else %} @@ -46,11 +63,27 @@ You are not permitted to view url of issues {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof issueeditors admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.url}} + +{% else %} + +You are not permitted to view url of issues + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.current}} %} {% ifmemberof issueeditors admin %} {% else %} @@ -64,11 +97,27 @@ You are not permitted to view current of issues {% endifmemberof %} {% endifmemberof %} +{% else %} +{% ifmemberof issueeditors admin %} + +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.current}} + +{% else %} + +You are not permitted to view current of issues + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

+{% if {{record.brief}} %} {% ifmemberof issueeditors admin %} +{% else %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} + +{{record.brief}} + +{% else %} + +You are not permitted to view brief of issues + +{% endifmemberof %} +{% endifmemberof %} +{% endif %}

{% ifmemberof issueeditors admin %}

@@ -107,6 +173,21 @@ To delete this issues record {% endblock %} {% block extra-tail %} + +{% endblock %} diff --git a/resources/templates/roles/canvasser.html b/resources/templates/roles/canvasser.html new file mode 100644 index 0000000..a16ad90 --- /dev/null +++ b/resources/templates/roles/canvasser.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} +{% block big-links %} +

+ +{% endblock %} diff --git a/resources/templates/untitled.html b/resources/templates/untitled.html new file mode 100644 index 0000000..e69de29 diff --git a/src/clj/youyesyet/handler.clj b/src/clj/youyesyet/handler.clj index 644c4ef..76cdc1c 100644 --- a/src/clj/youyesyet/handler.clj +++ b/src/clj/youyesyet/handler.clj @@ -10,10 +10,11 @@ [youyesyet.layout :refer [error-page]] [youyesyet.middleware :as middleware] [youyesyet.routes.home :refer [home-routes]] - [youyesyet.routes.oauth :refer [oauth-routes]] - [youyesyet.routes.auto-json :refer [auto-rest-routes]] [youyesyet.routes.auto :refer [auto-selmer-routes]] + [youyesyet.routes.auto-json :refer [auto-rest-routes]] + [youyesyet.routes.issue-experts :refer [issue-expert-routes]] [youyesyet.routes.rest :refer [rest-routes]] + [youyesyet.routes.oauth :refer [oauth-routes]] [youyesyet.routes.roles :refer [roles-routes]] [youyesyet.routes.services :refer [service-routes]] [youyesyet.env :refer [defaults]])) @@ -72,6 +73,9 @@ (-> #'roles-routes (wrap-routes middleware/wrap-csrf) (wrap-routes middleware/wrap-formats)) + (-> #'issue-expert-routes + (wrap-routes middleware/wrap-csrf) + (wrap-routes middleware/wrap-formats)) (-> #'auto-rest-routes (wrap-routes middleware/wrap-csrf) (wrap-routes middleware/wrap-formats)) diff --git a/src/clj/youyesyet/routes/auto.clj b/src/clj/youyesyet/routes/auto.clj index e3cf4e8..a7617e6 100644 --- a/src/clj/youyesyet/routes/auto.clj +++ b/src/clj/youyesyet/routes/auto.clj @@ -1,6 +1,6 @@ (ns youyesyet.routes.auto - "User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180707T080949.557Z" + "User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180709T205534.030Z" (:require [adl-support.core :as support] [clojure.java.io :as io] @@ -176,7 +176,8 @@ {:electors (db/list-electors db/*db*)} {:addresses (db/list-addresses db/*db*)} {:authorities (db/list-authorities db/*db*)} - {:roles (db/list-roles db/*db*)})))))) + {:roles (db/list-roles db/*db*)} + {:issues (db/list-issues db/*db*)})))))) (defn list-districts-Districts @@ -689,7 +690,7 @@ (empty? (remove nil? (vals p))) [] (db/get-issue db/*db* p))}) - (list)))))) + (list {:canvassers (db/list-canvassers db/*db*)})))))) (defn list-options-Options diff --git a/src/clj/youyesyet/routes/auto_json.clj b/src/clj/youyesyet/routes/auto_json.clj index 2515348..a9ca15f 100644 --- a/src/clj/youyesyet/routes/auto_json.clj +++ b/src/clj/youyesyet/routes/auto_json.clj @@ -1,6 +1,6 @@ (ns youyesyet.routes.auto-json - "JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180707T080948.404Z" + "JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180709T205532.861Z" (:require [adl-support.core :as support] [clojure.core.memoize :as memo] @@ -675,6 +675,11 @@ [{:keys [params]}] (do (db/list-canvassers-by-elector params))) +(defn + list-canvassers-by-issue + [{:keys [params]}] + (do (db/list-canvassers-by-issue params))) + (defn list-canvassers-by-role [{:keys [params]}] @@ -879,6 +884,11 @@ :ttl/threshold 1000000)) +(defn + list-issues-by-canvasser + [{:keys [params]}] + (do (db/list-issues-by-canvasser params))) + (def list-options (memo/ttl @@ -1587,6 +1597,10 @@ "/json/auto/list-canvassers-by-elector" request (route/restricted (list-canvassers-by-elector request))) + (GET + "/json/auto/list-canvassers-by-issue" + request + (route/restricted (list-canvassers-by-issue request))) (GET "/json/auto/list-canvassers-by-role" request @@ -1683,6 +1697,10 @@ "/json/auto/list-issues" request (route/restricted (list-issues request))) + (GET + "/json/auto/list-issues-by-canvasser" + request + (route/restricted (list-issues-by-canvasser request))) (GET "/json/auto/list-options" request diff --git a/src/clj/youyesyet/routes/issue_experts.clj b/src/clj/youyesyet/routes/issue_experts.clj new file mode 100644 index 0000000..f157133 --- /dev/null +++ b/src/clj/youyesyet/routes/issue_experts.clj @@ -0,0 +1,68 @@ +(ns ^{:doc "Routes/pages available to issue experts." + :author "Simon Brooke"} youyesyet.routes.issue-experts + (:require [adl-support.utils :refer [safe-name]] + [clojure.java.io :as io] + [clojure.string :as s] + [clojure.tools.logging :as log] + [clojure.walk :refer [keywordize-keys]] + [markdown.core :refer [md-to-html-string]] + [noir.util.route :as route] + [ring.util.http-response :as response] + [youyesyet.config :refer [env]] + [youyesyet.db.core :as db] + [youyesyet.layout :as layout] + [youyesyet.oauth :as oauth] + [compojure.core :refer [defroutes GET POST]] + )) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; +;;;; youyesyet.routes.home: routes and pages for issue experts. +;;;; +;;;; 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 +;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defn list-page [request] + (layout/render + "auto/list-followuprequests-Followuprequests.html" + (:session request) + (let [user (:user (:session request))] + {:title "Open requests" + :user user + :records (db/list-open-requests db/*db* {:expert (:id user)})}))) + + +(defn followup-request-page [request] + (layout/render + "issue-expert/request.html" + (:session request) + {:title "Open requests" + :user (:user (:session request)) + :request (db/get-followuprequest + db/*db* + {:id (:id (keywordize-keys (:params request)))})})) + + +(defroutes issue-expert-routes + (GET "/issue-expert/list" request + (route/restricted (list-page request))) + (GET "/issue-expert/followup-request" request + (route/restricted (followup-request-page request))) + (POST "/issue-expert/followup-request" request + (route/restricted (followup-request-page request)))) diff --git a/src/clj/youyesyet/routes/roles.clj b/src/clj/youyesyet/routes/roles.clj index 62d89f7..3945f8d 100644 --- a/src/clj/youyesyet/routes/roles.clj +++ b/src/clj/youyesyet/routes/roles.clj @@ -1,6 +1,7 @@ (ns ^{:doc "Routes/pages available to authenticated users in specific roles." :author "Simon Brooke"} youyesyet.routes.roles - (:require [adl-support.utils :refer [safe-name]] + (:require [adl-support.core :as support] + [adl-support.utils :refer [safe-name]] [clojure.tools.logging :as log] [clojure.walk :refer [keywordize-keys]] [compojure.core :refer [defroutes GET POST]] @@ -8,6 +9,7 @@ [ring.util.http-response :as response] [youyesyet.config :refer [env]] [youyesyet.db.core :as db-core] + [youyesyet.routes.issue-experts :as expert] [youyesyet.layout :as layout] [youyesyet.oauth :as oauth] [youyesyet.routes.auto :as auto])) @@ -34,7 +36,10 @@ (defn admins-page [request] - (response/found "/admin")) + (layout/render + (support/resolve-template "application-index.html") + (:session request) + {:title "Administrative menu"})) (defn analysts-page @@ -42,7 +47,10 @@ some other geographical information system; so there isn't a need to put anything sophisticated here." [request] - (response/found "/admin")) + (layout/render + (support/resolve-template "application-index.html") + (:session request) + {:title "Administrative menu"})) (defn canvassers-page @@ -50,22 +58,17 @@ (layout/render "roles/canvasser.html" request {})) -(defn issue-experts-page - [request] - (layout/render "roles/issue-experts.html" request {})) - - (defn team-organisers-page [request] (layout/render "roles/team-orgenisers.html" request {})) (defroutes roles-routes - (GET "/roles/admins" [request] (route/restricted (admins-page request))) - (GET "/roles/analysts" [request] (route/restricted (analysts-page request))) - (GET "/roles/canvassers" [request] (route/restricted (canvassers-page request))) - (GET "/roles/issue_editors" [request] (route/restricted (auto/list-issues-Issues request))) - (GET "/roles/issue_experts" [request] (route/restricted (issue-experts-page request))) - (GET "/roles/team_organisers" [request] (route/restricted (auto/list-teams-Teams request))) + (GET "/roles/admin" request (route/restricted (admins-page request))) + (GET "/roles/analysts" request (route/restricted (analysts-page request))) + (GET "/roles/canvassers" request (route/restricted (canvassers-page request))) + (GET "/roles/issue_editors" request (route/restricted (auto/list-issues-Issues request))) + (GET "/roles/issue_experts" request (route/restricted (expert/list-page request))) + (GET "/roles/team_organisers" request (route/restricted (auto/list-teams-Teams request))) (GET "/roles" request (route/restricted (roles-page request)))) diff --git a/src/cljs/youyesyet/canvasser_app/core.cljs b/src/cljs/youyesyet/canvasser_app/core.cljs index 355bdba..4044f05 100644 --- a/src/cljs/youyesyet/canvasser_app/core.cljs +++ b/src/cljs/youyesyet/canvasser_app/core.cljs @@ -10,6 +10,7 @@ [re-frame.core :as rf] [secretary.core :as secretary] [youyesyet.canvasser-app.ajax :refer [load-interceptors!]] + [youyesyet.canvasser-app.gis :refer [get-current-location]] [youyesyet.canvasser-app.handlers :as h] [youyesyet.canvasser-app.subscriptions] [youyesyet.canvasser-app.ui-utils :as ui] @@ -74,14 +75,18 @@ (defn issue-page [] (issue/panel)) +(defn issue-experts-page [] + (expert/panel)) + (defn map-page [] (maps/panel)) (def pages {:about #'about-page :building #'building-page - :elector #'elector-page :dwelling #'dwelling-page + :elector #'elector-page + :expert #'expert :followup #'followup-page :gdpr #'gdpr-page :issues #'issues-page @@ -191,7 +196,7 @@ (defn init! [] (rf/dispatch-sync [:initialize-db]) - (h/get-current-location) + (get-current-location) (rf/dispatch [:fetch-locality]) (rf/dispatch [:fetch-options]) (rf/dispatch [:fetch-issues]) diff --git a/src/cljs/youyesyet/canvasser_app/gis.cljs b/src/cljs/youyesyet/canvasser_app/gis.cljs new file mode 100644 index 0000000..bca4390 --- /dev/null +++ b/src/cljs/youyesyet/canvasser_app/gis.cljs @@ -0,0 +1,139 @@ +(ns ^{:doc "Canvasser app map stuff." + :author "Simon Brooke"} + youyesyet.canvasser-app.gis + (:require [cljs.reader :refer [read-string]] + [cemerick.url :refer (url url-encode)] + [day8.re-frame.http-fx] + [re-frame.core :refer [dispatch reg-event-db reg-event-fx subscribe]] + [ajax.core :refer [GET]] + [ajax.json :refer [json-request-format json-response-format]] + [youyesyet.canvasser-app.state :as db] + )) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; +;;;; youyesyet.canvasser-app.gis: stuff to do with maps. +;;;; +;;;; 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 +;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; map stuff. If we do this in canvasser-app.views.map we get circular +;; references, so do it here. + +(defn get-current-location [] + "Get the current location from the device." + (try + (if (.-geolocation js/navigator) + (.getCurrentPosition + (.-geolocation js/navigator) + (fn [position] + (js/console.log (str "Current location is: " + (.-latitude (.-coords position)) ", " + (.-longitude (.-coords position)))) + (dispatch [:set-latitude (.-latitude (.-coords position))]) + (dispatch [:set-longitude (.-longitude (.-coords position))]))) + (js/console.log "Geolocation not available")) + (catch js/Object any + (js/console.log "Exception while trying to access location: " + any)))) + + +(defn pin-image + "select the name of a suitable pin image for this address" + [address] + (let [intentions + (set + (remove + nil? + (map + :intention + (mapcat :electors + (:dwellings address)))))] + (case (count intentions) + 0 "unknown-pin" + 1 (str (name (first intentions)) "-pin") + "mixed-pin"))) + + +(defn map-pin-click-handler + "On clicking on the pin, navigate to the electors at the address. + This way of doing it adds an antry in the browser location history, + so back links work." + [id] + (js/console.log (str "Click handler for address #" id)) + (let [view @(subscribe [:view]) + centre (.getCenter view)] + (dispatch [:set-zoom (.getZoom view)]) + (dispatch [:set-latitude (.-lat centre)]) + (dispatch [:set-longitude (.-lng centre)])) + (set! window.location.href (str "#building/" id))) + + +(defn add-map-pin + "Add a map-pin at this address in this map view" + [address view] + (let [lat (:latitude address) + lng (:longitude address) + pin (.icon js/L + (clj->js + {:iconAnchor [16 41] + :iconSize [32 42] + :iconUrl (str "img/map-pins/" (pin-image address) ".png") + :riseOnHover true + :shadowAnchor [16 23] + :shadowSize [57 24] + :shadowUrl "img/map-pins/shadow_pin.png"})) + marker (.marker js/L + (.latLng js/L lat lng) + (clj->js {:icon pin + :title (:address address)}))] + (.on (.addTo marker view) "click" (fn [_] (map-pin-click-handler (str (:id address))))) + marker)) + + +(defn map-remove-pins + "Remove all pins from this map `view`. Side-effecty; liable to be problematic." + [view] + + (if + view + (.eachLayer + view + (fn [layer] + (try + (if + (instance? js/L.Marker layer) + (.removeLayer view layer)) + (catch js/Object any (js/console.log (str "Failed to remove pin '" layer "' from map: " any))))))) + view) + + +(defn refresh-map-pins + "Refresh the map pins on this map. Side-effecty; liable to be problematic." + [] + (let [view (map-remove-pins @(subscribe [:view])) + addresses @(subscribe [:addresses])] + (if + view + (do + (js/console.log (str "Adding " (count addresses) " pins")) + (doall (map #(add-map-pin % view) addresses))) + (js/console.log "View is not yet ready")) + view)) + + diff --git a/src/cljs/youyesyet/canvasser_app/handlers.cljs b/src/cljs/youyesyet/canvasser_app/handlers.cljs index 0f2bcf8..ed92dd3 100644 --- a/src/cljs/youyesyet/canvasser_app/handlers.cljs +++ b/src/cljs/youyesyet/canvasser_app/handlers.cljs @@ -7,12 +7,13 @@ [re-frame.core :refer [dispatch reg-event-db reg-event-fx subscribe]] [ajax.core :refer [GET]] [ajax.json :refer [json-request-format json-response-format]] + [youyesyet.canvasser-app.gis :refer [refresh-map-pins get-current-location]] [youyesyet.canvasser-app.state :as db] )) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; -;;;; youyesyet.handlers: handlers for events. +;;;; youyesyet.canvasser-app.handlers: event handlers. ;;;; ;;;; This program is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU General Public License @@ -101,113 +102,12 @@ (:electors state) "'"))))) -;; map stuff. If we do this in canvasser-app.views.map we get circular -;; references, so do it here. -(defn pin-image - "select the name of a suitable pin image for this address" - [address] - (let [intentions - (set - (remove - nil? - (map - :intention - (mapcat :electors - (:dwellings address)))))] - (case (count intentions) - 0 "unknown-pin" - 1 (str (name (first intentions)) "-pin") - "mixed-pin"))) - - -(defn map-pin-click-handler - "On clicking on the pin, navigate to the electors at the address. - This way of doing it adds an antry in the browser location history, - so back links work." - [id] - (js/console.log (str "Click handler for address #" id)) - (let [view @(subscribe [:view]) - centre (.getCenter view)] - (dispatch [:set-zoom (.getZoom view)]) - (dispatch [:set-latitude (.-lat centre)]) - (dispatch [:set-longitude (.-lng centre)])) - (set! window.location.href (str "#building/" id))) - - -(defn add-map-pin - "Add a map-pin at this address in this map view" - [address view] - (let [lat (:latitude address) - lng (:longitude address) - pin (.icon js/L - (clj->js - {:iconAnchor [16 41] - :iconSize [32 42] - :iconUrl (str "img/map-pins/" (pin-image address) ".png") - :riseOnHover true - :shadowAnchor [16 23] - :shadowSize [57 24] - :shadowUrl "img/map-pins/shadow_pin.png"})) - marker (.marker js/L - (.latLng js/L lat lng) - (clj->js {:icon pin - :title (:address address)}))] - (.on (.addTo marker view) "click" (fn [_] (map-pin-click-handler (str (:id address))))) - marker)) - - -(defn map-remove-pins - "Remove all pins from this map `view`. Side-effecty; liable to be problematic." - [view] - - (if - view - (.eachLayer - view - (fn [layer] - (try - (if - (instance? js/L.Marker layer) - (.removeLayer view layer)) - (catch js/Object any (js/console.log (str "Failed to remove pin '" layer "' from map: " any))))))) - view) - - -(defn refresh-map-pins - "Refresh the map pins on this map. Side-effecty; liable to be problematic." - [] - (let [view (map-remove-pins @(subscribe [:view])) - addresses @(subscribe [:addresses])] - (if - view - (do - (js/console.log (str "Adding " (count addresses) " pins")) - (doall (map #(add-map-pin % view) addresses))) - (js/console.log "View is not yet ready")) - view)) - - (reg-event-db :initialize-db (fn [_ _] db/default-db)) -(defn get-current-location [] - "Get the current location from the device." - (try - (if (.-geolocation js/navigator) - (.getCurrentPosition - (.-geolocation js/navigator) - (fn [position] - (js/console.log "Current location is: " + position) - (dispatch [:set-latitude (.-latitude (.-coords position))]) - (dispatch [:set-longitude (.-longitude (.-coords position))]))) - (js/console.log "Geolocation not available")) - (catch js/Object any - (js/console.log "Exception while trying to access location: " + any)))) - - ;; (reg-event-fx ;; :feedback ;; (fn [x y] @@ -254,11 +154,21 @@ :db (add-to-feedback db :fetch-locality)})) +(reg-event-db + :get-current-location + (fn [db _] + (js/console.log "Updating current location") + (assoc db :froboz (get-current-location)))) + + (reg-event-db :process-locality (fn [db [_ response]] (js/console.log "Updating locality data") + ;; loop to do it again + (dispatch [:dispatch-later [{:ms 5000 :dispatch [:fetch-locality]} + {:ms 1000 :dispatch [:get-current-location]}]]) (assoc (remove-from-feedback db :fetch-locality) (refresh-map-pins) @@ -270,6 +180,9 @@ (fn [db _] ;; TODO: signal something has failed? It doesn't matter very much, unless it keeps failing. (js/console.log "Failed to fetch locality data") + ;; loop to do it again + (dispatch [:dispatch-later [{:ms 60000 :dispatch [:fetch-locality]} + {:ms 1000 :dispatch [:get-current-location]}]]) (assoc (remove-from-feedback db :fetch-locality) :error (cons :fetch-locality (:error db))))) diff --git a/src/cljs/youyesyet/canvasser_app/views/map.cljs b/src/cljs/youyesyet/canvasser_app/views/map.cljs index 094427d..5aa8c40 100644 --- a/src/cljs/youyesyet/canvasser_app/views/map.cljs +++ b/src/cljs/youyesyet/canvasser_app/views/map.cljs @@ -3,7 +3,7 @@ youyesyet.canvasser-app.views.map (:require [re-frame.core :refer [reg-sub subscribe dispatch dispatch-sync]] [reagent.core :as reagent] - [youyesyet.canvasser-app.handlers :refer [get-current-location refresh-map-pins]])) + [youyesyet.canvasser-app.gis :refer [refresh-map-pins get-current-location]])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; @@ -28,7 +28,6 @@ ;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;;; 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. diff --git a/src/cljs/youyesyet/issue_expert_app/README.md b/src/cljs/youyesyet/issue_expert_app/README.md new file mode 100644 index 0000000..15db07c --- /dev/null +++ b/src/cljs/youyesyet/issue_expert_app/README.md @@ -0,0 +1,5 @@ +# Issue Expert app + +The Issue Expert app is essentially a whole different app. I think it needs to be an app because it needs a much more slick UI than an old CRUD web system, but it's designed for use on desktop systems with large screens. + +It comprises two views: a list of open followup requests, and a view to handle an individual request. The work flow is, pick a request from the list, obtain an exclusive lock on it, diff --git a/src/cljs/youyesyet/issue_expert_app/core.cljs b/src/cljs/youyesyet/issue_expert_app/core.cljs new file mode 100644 index 0000000..e69de29 diff --git a/src/cljs/youyesyet/issue_expert_app/views/list.cljs b/src/cljs/youyesyet/issue_expert_app/views/list.cljs new file mode 100644 index 0000000..eddaf8c --- /dev/null +++ b/src/cljs/youyesyet/issue_expert_app/views/list.cljs @@ -0,0 +1,52 @@ +(ns ^{:doc "Issue Expert app list panel." + :author "Simon Brooke"} + youyesyet.canvasser-app.views.issues + (:require [re-frame.core :refer [reg-sub subscribe]] + [youyesyet.canvasser-app.ui-utils :as ui])) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;; +;;;; youyesyet.canvasser-app.views.issues: working view for issue experts 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 provide the issues view. + + +;;; TODO: This is, in essence, an enturely different app. It really ought to be +;;; in a separate project. But to get it working quickly, it's here for now. + +;;; Simple list of the issues of the day. +(defn panel + "Generate the list panel." + [] + (let [issues @(subscribe [:issues])] + (if issues + [:div + [:h1 "Issues"] + [:div.container {:id "main-container"} + (ui/back-link) + [:div {:id "issue-list"} + (map (fn [i] (ui/big-link (:id i) :target (str "#issue/" (:id i)))) issues)]]] + (ui/error-panel "No issues loaded")))) diff --git a/youyesyet.adl.xml b/youyesyet.adl.xml index 23b74dc..a284309 100644 --- a/youyesyet.adl.xml +++ b/youyesyet.adl.xml @@ -408,7 +408,7 @@ version="0.1.1"> the system. + size="32" distinct="all" immutable="true"> @@ -471,6 +471,7 @@ version="0.1.1"> + @@ -512,7 +513,7 @@ version="0.1.1"> Intentions of electors to vote for options elicited in visits. - @@ -577,9 +578,7 @@ version="0.1.1"> - + Primary users of the system: those actually @@ -635,6 +634,10 @@ version="0.1.1"> farkey="role_id"> + + Only relevant to issue experts. + + But only their own record @@ -716,16 +719,14 @@ version="0.1.1"> - + Requests for a followup with an issue expert + column="id" distinct="system" immutable="true"> @@ -787,9 +788,7 @@ version="0.1.1"> - + A role (essentially, the same as a group, but application layer rather than database layer) of which a user @@ -833,9 +832,7 @@ version="0.1.1"> - + + An event to which a team or teams are invited. Typically created by the team organiser(s). May be a training event, a social event or a canvassing session. - + @@ -1020,16 +1018,14 @@ version="0.1.1"> - + Actions taken on followup requests. + column="id" distinct="system" immutable="true"> @@ -1112,7 +1108,7 @@ version="0.1.1"> canvassed on + size="32" distinct="all" immutable="true"> diff --git a/youyesyet.canonical.adl.xml b/youyesyet.canonical.adl.xml index e69504c..57e96b4 100644 --- a/youyesyet.canonical.adl.xml +++ b/youyesyet.canonical.adl.xml @@ -391,7 +391,7 @@ Authorities which may authenticate canvassers to the system. - + @@ -450,6 +450,7 @@ + @@ -492,7 +493,7 @@ Intentions of electors to vote for options elicited in visits. - + @@ -600,6 +601,10 @@ + + Only relevant to issue experts. + + But only their own record @@ -688,7 +693,7 @@ Requests for a followup with an issue expert - + @@ -913,7 +918,7 @@ May be a training event, a social event or a canvassing session. - + @@ -982,7 +987,7 @@ Actions taken on followup requests. - + @@ -1058,7 +1063,7 @@ Options in the election or referendum being canvassed on - +