diff --git a/env/prod/resources/config.edn b/env/prod/resources/config.edn index b48cfbd..eeaa8d9 100644 --- a/env/prod/resources/config.edn +++ b/env/prod/resources/config.edn @@ -1,2 +1,4 @@ {:production true - :port 3000} + :port 3000 + :site-title "Project Hope" + :site-logo "img/ProjectHopeLogo.png"} diff --git a/project.clj b/project.clj index 7ffe7db..6ae71ee 100644 --- a/project.clj +++ b/project.clj @@ -80,7 +80,9 @@ [datatables.net-dt "1.10.19"] [jquery "3.3.1"] [leaflet "0.7.3"] ;; old version works, new ["1.3.1"] doesn't - [signature_pad "2.3.2"]] + [selectize "0.12.5"] + [signature_pad "2.3.2"] + [simplemde "1.11.2"]] :root "resources/public/js/lib"} :uberwar diff --git a/resources/public/css/yyy-common.css b/resources/public/css/yyy-common.css index 65fde48..4e739b0 100644 --- a/resources/public/css/yyy-common.css +++ b/resources/public/css/yyy-common.css @@ -104,7 +104,7 @@ input, select { padding: 0.25em 1.25em; } -input.action { +input.action, input.action-safe { color: white; background-color: rgb( 50, 109, 177); font-size: 125%; @@ -113,6 +113,7 @@ input.action { input.action-dangerous { color: white; background-color: red; + font-size: 125%; } input.required:after { @@ -254,6 +255,10 @@ th { border: thin solid silver; } +.editor-toolbar { + background-color: silver; +} + .error { width: 100%; background-color: red; diff --git a/resources/public/img/ProjectHopeLogo4.png b/resources/public/img/ProjectHopeLogo4.png new file mode 100644 index 0000000..7b82d8b Binary files /dev/null and b/resources/public/img/ProjectHopeLogo4.png differ diff --git a/resources/sql/queries.auto.sql b/resources/sql/queries.auto.sql index dc3d591..dc97b4a 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-03T23:08:18.480Z +-- autogenerated by adl.to-hugsql-queries at 2018-07-05T10:14:16.954Z -- -- See [Application Description -- Language](https://github.com/simon-brooke/adl). @@ -753,7 +753,7 @@ ORDER BY lv_visits.address_id, lv_visits.date, lv_visits.id --- :name search-strings-address :? :1 +-- :name search-strings-addresses :? :1 -- :doc selects existing address records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_addresses WHERE false @@ -771,7 +771,7 @@ ORDER BY lv_addresses.address, --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-authority :? :1 +-- :name search-strings-authorities :? :1 -- :doc selects existing authority records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_authorities WHERE false @@ -784,7 +784,7 @@ WHERE false --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-canvasser :? :1 +-- :name search-strings-canvassers :? :1 -- :doc selects existing canvasser records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_canvassers WHERE false @@ -806,7 +806,7 @@ ORDER BY lv_canvassers.username, --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-district :? :1 +-- :name search-strings-districts :? :1 -- :doc selects existing district records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_districts WHERE false @@ -817,7 +817,7 @@ ORDER BY lv_districts.name, --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-dwelling :? :1 +-- :name search-strings-dwellings :? :1 -- :doc selects existing dwelling records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_dwellings WHERE false @@ -830,7 +830,7 @@ ORDER BY lv_dwellings.address_id, --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-elector :? :1 +-- :name search-strings-electors :? :1 -- :doc selects existing elector records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_electors WHERE false @@ -848,7 +848,7 @@ ORDER BY lv_electors.name, --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-followupaction :? :1 +-- :name search-strings-followupactions :? :1 -- :doc selects existing followupaction records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_followupactions WHERE false @@ -864,7 +864,7 @@ ORDER BY lv_followupactions.date, --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-followupmethod :? :1 +-- :name search-strings-followupmethods :? :1 -- :doc selects existing followupmethod records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_followupmethods WHERE false @@ -872,7 +872,7 @@ WHERE false --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-followuprequest :? :1 +-- :name search-strings-followuprequests :? :1 -- :doc selects existing followuprequest records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_followuprequests WHERE false @@ -888,7 +888,7 @@ ORDER BY lv_followuprequests.elector_id, --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-gender :? :1 +-- :name search-strings-genders :? :1 -- :doc selects existing gender records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_genders WHERE false @@ -896,7 +896,7 @@ WHERE false --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-intention :? :1 +-- :name search-strings-intentions :? :1 -- :doc selects existing intention records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_intentions WHERE false @@ -908,7 +908,7 @@ WHERE false --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-issue :? :1 +-- :name search-strings-issues :? :1 -- :doc selects existing issue records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_issues WHERE false @@ -919,7 +919,7 @@ WHERE false --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-option :? :1 +-- :name search-strings-options :? :1 -- :doc selects existing option records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_options WHERE false @@ -927,7 +927,7 @@ WHERE false --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-role :? :1 +-- :name search-strings-roles :? :1 -- :doc selects existing role records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_roles WHERE false @@ -938,7 +938,7 @@ ORDER BY lv_roles.name, --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-team :? :1 +-- :name search-strings-teams :? :1 -- :doc selects existing team records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_teams WHERE false @@ -952,7 +952,7 @@ ORDER BY lv_teams.name, --~ (if (:offset params) "OFFSET :offset ") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --- :name search-strings-visit :? :1 +-- :name search-strings-visits :? :1 -- :doc selects existing visit records having any string field matching the parameter of the same name by substring match SELECT DISTINCT * FROM lv_visits WHERE false @@ -1035,6 +1035,12 @@ SET request_id = :request_id, closed = :closed WHERE followupactions.id = :id +-- :name update-followupmethod! :! :n +-- :doc updates an existing followupmethod record +UPDATE followupmethods +SET id = :id +WHERE followupmethods.id = :id + -- :name update-followuprequest! :! :n -- :doc updates an existing followuprequest record UPDATE followuprequests @@ -1044,6 +1050,12 @@ SET elector_id = :elector_id, method_id = :method_id WHERE followuprequests.id = :id +-- :name update-gender! :! :n +-- :doc updates an existing gender record +UPDATE genders +SET id = :id +WHERE genders.id = :id + -- :name update-intention! :! :n -- :doc updates an existing intention record UPDATE intentions @@ -1062,6 +1074,12 @@ SET url = :url, id = :id WHERE issues.id = :id +-- :name update-option! :! :n +-- :doc updates an existing option record +UPDATE options +SET id = :id +WHERE options.id = :id + -- :name update-role! :! :n -- :doc updates an existing role record UPDATE roles diff --git a/resources/sql/youyesyet.postgres.sql b/resources/sql/youyesyet.postgres.sql index 6871331..3cfd37b 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 20180703T230819.494Z +-- (https://github.com/simon-brooke/adl) at 20180705T101417.868Z -- -- -- A web-app intended to be used by canvassers campaigning for a diff --git a/resources/templates/auto/application-index.html b/resources/templates/auto/application-index.html index 63d842b..d821ad8 100644 --- a/resources/templates/auto/application-index.html +++ b/resources/templates/auto/application-index.html @@ -1,55 +1,74 @@ {% extends "base.html" %} - {% block content %}
+{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
Address
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}

Addresses of all buildings which contain dwellings.

+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
Authority
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}

Authorities which may authenticate canvassers to the system.

+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %}
Canvasser
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %}

Primary users of the system: those actually interviewing electors.

+{% endifmemberof %} +{% ifmemberof public admin canvassers teamorganisers issueexperts analysts issueeditors %}
District
+{% endifmemberof %} +{% ifmemberof public admin canvassers teamorganisers issueexperts analysts issueeditors %}

Electoral districts: TODO: Shape (polygon) information will need to be added, for use in maps.

+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
Dwelling
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}

All dwellings within addresses in the system; a dwelling is a @@ -60,110 +79,155 @@ All dwellings within addresses in the system; a dwelling is a

+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
Elector
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}

All electors known to the system; electors are people believed to be entitled to vote in the current campaign.

+{% endifmemberof %} +{% ifmemberof issueexperts canvassers analysts issueeditors admin %}
Followupaction
+{% endifmemberof %} +{% ifmemberof issueexperts canvassers analysts issueeditors admin %}

Actions taken on followup requests.

+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
Followupmethod
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
Followuprequest
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}

Requests for a followup with an issue expert

+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
Gender
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}

All genders which may be assigned to electors.

+{% endifmemberof %} +{% ifmemberof canvassers analysts admin %}
Intention
+{% endifmemberof %} +{% ifmemberof canvassers analysts admin %}

Intentions of electors to vote for options elicited in visits.

+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
Issue
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}

Issues believed to be of interest to electors, about which they may have questions.

+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
Option
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}

Options in the election or referendum being canvassed on

+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
Role
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}

A role (essentially, the same as a group, but application layer rather than database layer) of which a user may be a member.

+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers admin %}
Team
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers admin %}
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers %}
Visit
+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers %}

All visits made by canvassers to dwellings in which opinions were recorded.

+{% endifmemberof %}
{% endblock %} diff --git a/resources/templates/auto/form-addresses-Address.html b/resources/templates/auto/form-addresses-Address.html index e29ac70..a9ce785 100644 --- a/resources/templates/auto/form-addresses-Address.html +++ b/resources/templates/auto/form-addresses-Address.html @@ -1,8 +1,11 @@ {% extends "base.html" %} - +{% block extra-head %} + +{% endblock %} {% block content %}
@@ -12,7 +15,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> id {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -30,7 +33,7 @@ You are not permitted to view id of addresses address {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -48,7 +51,7 @@ You are not permitted to view address of addresses postcode {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -66,7 +69,7 @@ You are not permitted to view postcode of addresses phone {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -84,12 +87,13 @@ You are not permitted to view phone of addresses district_id {% ifmemberof admin %} -
- - +
+ -
+
{% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -138,19 +142,43 @@ You are not permitted to view longitude of addresses {% endifmemberof %} {% endifmemberof %}

+{% ifmemberof admin %}

+{% endifmemberof %} +{% ifmemberof admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-authorities-Authority.html b/resources/templates/auto/form-authorities-Authority.html index a6d40b6..3dfce8f 100644 --- a/resources/templates/auto/form-authorities-Authority.html +++ b/resources/templates/auto/form-authorities-Authority.html @@ -1,8 +1,11 @@ {% extends "base.html" %} - +{% block extra-head %} + +{% endblock %} {% block content %}
@@ -12,7 +15,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> id {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -26,108 +29,117 @@ You are not permitted to view id of authorities {% endifmemberof %}

-

-

-

-

-

+{% ifmemberof admin %}

+{% endifmemberof %} +{% ifmemberof admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-canvassers-Canvasser.html b/resources/templates/auto/form-canvassers-Canvasser.html index dd5961b..e2f68e9 100644 --- a/resources/templates/auto/form-canvassers-Canvasser.html +++ b/resources/templates/auto/form-canvassers-Canvasser.html @@ -1,8 +1,11 @@ {% extends "base.html" %} - +{% block extra-head %} + +{% endblock %} {% block content %}
@@ -12,7 +15,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> id {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} - + {% else %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -30,7 +33,7 @@ You are not permitted to view id of canvassers username {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} - + {% else %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -48,7 +51,7 @@ You are not permitted to view username of canvassers fullname {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} - + {% else %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -66,12 +69,13 @@ You are not permitted to view fullname of canvassers elector_id {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} -
- - +
+ -
+
{% else %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -89,12 +93,13 @@ You are not permitted to view elector_id of canvassers address_id {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} -
- - +
+ -
+
{% else %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -112,7 +117,7 @@ You are not permitted to view address_id of canvassers phone {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} - + {% else %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -130,7 +135,7 @@ You are not permitted to view phone of canvassers email {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} - + {% else %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -148,12 +153,13 @@ You are not permitted to view email of canvassers authority_id {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} -
- - +
+ -
+
{% else %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -189,11 +195,11 @@ You are not permitted to view authorised of canvassers roles {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} -
+ -
+
{% else %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -206,19 +212,43 @@ You are not permitted to view roles of canvassers {% endifmemberof %} {% endifmemberof %}

+{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %}

+{% endifmemberof %} +{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-districts-District.html b/resources/templates/auto/form-districts-District.html index d58b19f..3ad3790 100644 --- a/resources/templates/auto/form-districts-District.html +++ b/resources/templates/auto/form-districts-District.html @@ -1,8 +1,11 @@ {% extends "base.html" %} - +{% block extra-head %} + +{% endblock %} {% block content %}
@@ -11,10 +14,10 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> -{% ifmemberof admin admin %} - +{% ifmemberof admin %} + {% else %} -{% ifmemberof public admin canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof public admin canvassers teamorganisers issueexperts analysts issueeditors %} {{record.id}} @@ -29,10 +32,10 @@ You are not permitted to view id of districts -{% ifmemberof admin admin %} - +{% ifmemberof admin %} + {% else %} -{% ifmemberof public admin canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof public admin canvassers teamorganisers issueexperts analysts issueeditors %} {{record.name}} @@ -43,19 +46,28 @@ You are not permitted to view name of districts {% endifmemberof %} {% endifmemberof %}

+{% ifmemberof admin %}

+{% endifmemberof %} +{% ifmemberof admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-dwellings-Dwelling.html b/resources/templates/auto/form-dwellings-Dwelling.html index 528cf25..c254954 100644 --- a/resources/templates/auto/form-dwellings-Dwelling.html +++ b/resources/templates/auto/form-dwellings-Dwelling.html @@ -1,8 +1,11 @@ {% extends "base.html" %} - +{% block extra-head %} + +{% endblock %} {% block content %}
@@ -12,7 +15,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> id {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -30,12 +33,13 @@ You are not permitted to view id of dwellings address_id {% ifmemberof admin %} -
- - +
+ -
+
{% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -49,36 +53,60 @@ You are not permitted to view address_id of dwellings {% endifmemberof %}

-

+{% ifmemberof admin %}

+{% endifmemberof %} +{% ifmemberof admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-electors-Elector.html b/resources/templates/auto/form-electors-Elector.html index 0ed2cc5..0814a6c 100644 --- a/resources/templates/auto/form-electors-Elector.html +++ b/resources/templates/auto/form-electors-Elector.html @@ -1,8 +1,11 @@ {% extends "base.html" %} - +{% block extra-head %} + +{% endblock %} {% block content %}
@@ -12,7 +15,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> id {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -30,7 +33,7 @@ You are not permitted to view id of electors name {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -48,12 +51,13 @@ You are not permitted to view name of electors dwelling_id {% ifmemberof admin %} -
- - +
+ -
+
{% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -71,7 +75,7 @@ You are not permitted to view dwelling_id of electors phone {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -89,7 +93,7 @@ You are not permitted to view phone of electors email {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -107,11 +111,11 @@ You are not permitted to view email of electors gender {% ifmemberof admin %} -
+ -
+
{% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -124,19 +128,43 @@ You are not permitted to view gender of electors {% endifmemberof %} {% endifmemberof %}

+{% ifmemberof admin %}

+{% endifmemberof %} +{% ifmemberof admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-followupactions-Followupaction.html b/resources/templates/auto/form-followupactions-Followupaction.html index 6f47cb4..005a321 100644 --- a/resources/templates/auto/form-followupactions-Followupaction.html +++ b/resources/templates/auto/form-followupactions-Followupaction.html @@ -1,8 +1,12 @@ {% extends "base.html" %} - +{% block extra-head %} +{% script "js/lib/node_modules/simplemde/dist/simplemde.min.js" %} + {% style "js/lib/node_modules/simplemde/dist/simplemde.min.css" %} +{% endblock %} {% block content %}
@@ -12,7 +16,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> id {% ifmemberof admin %} - + {% else %} {% ifmemberof issueexperts canvassers analysts issueeditors admin %} @@ -30,12 +34,13 @@ You are not permitted to view id of followupactions request_id {% ifmemberof admin %} -
- - +
+ -
+
{% else %} {% ifmemberof issueexperts canvassers analysts issueeditors admin %} @@ -53,12 +58,13 @@ You are not permitted to view request_id of followupactions actor {% ifmemberof admin %} -
- - +
+ -
+
{% else %} {% ifmemberof issueexperts canvassers analysts issueeditors admin %} @@ -76,7 +82,7 @@ You are not permitted to view actor of followupactions date {% ifmemberof admin %} - + {% else %} {% ifmemberof issueexperts canvassers analysts issueeditors admin %} @@ -94,7 +100,9 @@ You are not permitted to view date of followupactions notes {% ifmemberof admin %} - + {% else %} {% ifmemberof issueexperts canvassers analysts issueeditors admin %} @@ -125,19 +133,61 @@ You are not permitted to view closed of followupactions {% endifmemberof %} {% endifmemberof %}

+{% ifmemberof admin %}

+{% endifmemberof %} +{% ifmemberof admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-followupmethods-Followupmethod.html b/resources/templates/auto/form-followupmethods-Followupmethod.html index ced5877..7ced8e2 100644 --- a/resources/templates/auto/form-followupmethods-Followupmethod.html +++ b/resources/templates/auto/form-followupmethods-Followupmethod.html @@ -1,8 +1,11 @@ {% extends "base.html" %} - +{% block extra-head %} + +{% endblock %} {% block content %}
@@ -12,7 +15,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> id {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -25,19 +28,28 @@ You are not permitted to view id of followupmethods {% endifmemberof %} {% endifmemberof %}

+{% ifmemberof admin %}

+{% endifmemberof %} +{% ifmemberof admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-followuprequests-Followuprequest.html b/resources/templates/auto/form-followuprequests-Followuprequest.html index 417bf02..2ab297d 100644 --- a/resources/templates/auto/form-followuprequests-Followuprequest.html +++ b/resources/templates/auto/form-followuprequests-Followuprequest.html @@ -1,8 +1,11 @@ {% extends "base.html" %} - +{% block extra-head %} + +{% endblock %} {% block content %}
@@ -12,7 +15,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> id {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -30,12 +33,13 @@ You are not permitted to view id of followuprequests elector_id {% ifmemberof admin %} -
- - +
+ -
+
{% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -53,12 +57,13 @@ You are not permitted to view elector_id of followuprequests visit_id {% ifmemberof admin %} -
- - +
+ -
+
{% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -76,11 +81,11 @@ You are not permitted to view visit_id of followuprequests issue_id {% ifmemberof admin %} -
+ -
+
{% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -98,11 +103,11 @@ You are not permitted to view issue_id of followuprequests method_id {% ifmemberof admin %} -
+ -
+
{% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -115,19 +120,43 @@ You are not permitted to view method_id of followuprequests {% endifmemberof %} {% endifmemberof %}

+{% ifmemberof admin %}

+{% endifmemberof %} +{% ifmemberof admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-genders-Gender.html b/resources/templates/auto/form-genders-Gender.html index a232471..a5a60ce 100644 --- a/resources/templates/auto/form-genders-Gender.html +++ b/resources/templates/auto/form-genders-Gender.html @@ -1,8 +1,11 @@ {% extends "base.html" %} - +{% block extra-head %} + +{% endblock %} {% block content %}
@@ -12,7 +15,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> id {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -25,19 +28,28 @@ You are not permitted to view id of genders {% endifmemberof %} {% endifmemberof %}

+{% ifmemberof admin %}

+{% endifmemberof %} +{% ifmemberof admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-intentions-Intention.html b/resources/templates/auto/form-intentions-Intention.html index 06887e0..15fde2f 100644 --- a/resources/templates/auto/form-intentions-Intention.html +++ b/resources/templates/auto/form-intentions-Intention.html @@ -1,8 +1,11 @@ {% extends "base.html" %} - +{% block extra-head %} + +{% endblock %} {% block content %}
@@ -12,12 +15,13 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> visit_id {% ifmemberof admin %} -
- - +
+ -
+ {% else %} {% ifmemberof canvassers analysts admin %} @@ -35,12 +39,13 @@ You are not permitted to view visit_id of intentions elector_id {% ifmemberof admin %} -
- - +
+ -
+
{% else %} {% ifmemberof canvassers analysts admin %} @@ -58,11 +63,11 @@ You are not permitted to view elector_id of intentions option_id {% ifmemberof admin %} -
+ -
+
{% else %} {% ifmemberof canvassers analysts admin %} @@ -93,19 +98,43 @@ You are not permitted to view locality of intentions {% endifmemberof %} {% endifmemberof %}

+{% ifmemberof admin %}

+{% endifmemberof %} +{% ifmemberof admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-issues-Issue.html b/resources/templates/auto/form-issues-Issue.html index eebc4f2..ec86dc3 100644 --- a/resources/templates/auto/form-issues-Issue.html +++ b/resources/templates/auto/form-issues-Issue.html @@ -1,8 +1,12 @@ {% extends "base.html" %} - +{% block extra-head %} +{% script "js/lib/node_modules/simplemde/dist/simplemde.min.js" %} + {% style "js/lib/node_modules/simplemde/dist/simplemde.min.css" %} +{% endblock %} {% block content %}
@@ -12,7 +16,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> id {% ifmemberof issueeditors admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -30,7 +34,7 @@ You are not permitted to view id of issues url {% ifmemberof issueeditors admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -66,7 +70,9 @@ You are not permitted to view current of issues brief {% ifmemberof issueeditors admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -79,19 +85,46 @@ You are not permitted to view brief of issues {% endifmemberof %} {% endifmemberof %}

+{% ifmemberof issueeditors admin %}

+{% endifmemberof %} +{% ifmemberof issueeditors admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-options-Option.html b/resources/templates/auto/form-options-Option.html index 2e3382a..aa168b2 100644 --- a/resources/templates/auto/form-options-Option.html +++ b/resources/templates/auto/form-options-Option.html @@ -1,8 +1,11 @@ {% extends "base.html" %} - +{% block extra-head %} + +{% endblock %} {% block content %}
@@ -12,7 +15,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> id {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -25,19 +28,28 @@ You are not permitted to view id of options {% endifmemberof %} {% endifmemberof %}

+{% ifmemberof admin %}

+{% endifmemberof %} +{% ifmemberof admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-roles-Role.html b/resources/templates/auto/form-roles-Role.html index be6c211..ff7e440 100644 --- a/resources/templates/auto/form-roles-Role.html +++ b/resources/templates/auto/form-roles-Role.html @@ -1,8 +1,11 @@ {% extends "base.html" %} - +{% block extra-head %} + +{% endblock %} {% block content %}
@@ -12,7 +15,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> id {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -30,7 +33,7 @@ You are not permitted to view id of roles name {% ifmemberof admin %} - + {% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -48,12 +51,13 @@ You are not permitted to view name of roles members {% ifmemberof admin %} -
- - +
+ -
+
{% else %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} @@ -66,19 +70,43 @@ You are not permitted to view members of roles {% endifmemberof %} {% endifmemberof %}

+{% ifmemberof admin %}

+{% endifmemberof %} +{% ifmemberof admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-teams-Team.html b/resources/templates/auto/form-teams-Team.html index b56d6a7..dcf6f7c 100644 --- a/resources/templates/auto/form-teams-Team.html +++ b/resources/templates/auto/form-teams-Team.html @@ -1,8 +1,11 @@ {% extends "base.html" %} - +{% block extra-head %} + +{% endblock %} {% block content %}
@@ -12,9 +15,9 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> id {% ifmemberof teamorganisers admin teamorganisers admin %} - + {% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers admin %} {{record.id}} @@ -30,9 +33,9 @@ You are not permitted to view id of teams name {% ifmemberof teamorganisers admin teamorganisers admin %} - + {% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers admin %} {{record.name}} @@ -48,14 +51,15 @@ You are not permitted to view name of teams district_id {% ifmemberof teamorganisers admin teamorganisers admin %} -
- - +
+ -
+ {% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers admin %} {{record.district_id}} @@ -73,7 +77,7 @@ latitude {% ifmemberof teamorganisers admin teamorganisers admin %} {% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers admin %} {{record.latitude}} @@ -89,14 +93,15 @@ You are not permitted to view latitude of teams members {% ifmemberof teamorganisers admin teamorganisers admin %} -
- - +
+ -
+ {% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers admin %} {{record.members}} @@ -112,14 +117,15 @@ You are not permitted to view members of teams organisers {% ifmemberof teamorganisers admin teamorganisers admin %} -
- - +
+ -
+ {% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers admin %} {{record.organisers}} @@ -137,7 +143,7 @@ longitude {% ifmemberof teamorganisers admin teamorganisers admin %} {% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin teamorganisers admin %} {{record.longitude}} @@ -148,19 +154,43 @@ You are not permitted to view longitude of teams {% endifmemberof %} {% endifmemberof %}

+{% ifmemberof teamorganisers admin teamorganisers admin %}

+{% endifmemberof %} +{% ifmemberof teamorganisers admin teamorganisers admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/form-visits-Visit.html b/resources/templates/auto/form-visits-Visit.html index e5e7fc8..b818009 100644 --- a/resources/templates/auto/form-visits-Visit.html +++ b/resources/templates/auto/form-visits-Visit.html @@ -1,8 +1,11 @@ {% extends "base.html" %} - +{% block extra-head %} + +{% endblock %} {% block content %}
@@ -11,10 +14,10 @@ See [Application Description Language](https://github.com/simon-brooke/adl).--> -{% ifmemberof admin admin %} - +{% ifmemberof admin %} + {% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers %} {{record.id}} @@ -29,15 +32,16 @@ You are not permitted to view id of visits -{% ifmemberof admin admin %} -
- - +
+ -
+ {% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers %} {{record.address_id}} @@ -52,15 +56,16 @@ You are not permitted to view address_id of visits -{% ifmemberof admin admin %} -
- - +
+ -
+ {% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers %} {{record.canvasser_id}} @@ -75,10 +80,10 @@ You are not permitted to view canvasser_id of visits -{% ifmemberof admin admin %} - +{% ifmemberof admin %} + {% else %} -{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers issueexperts analysts issueeditors admin %} +{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers %} {{record.date}} @@ -89,19 +94,43 @@ You are not permitted to view date of visits {% endifmemberof %} {% endifmemberof %}

+{% ifmemberof admin %}

+{% endifmemberof %} +{% ifmemberof admin %}

+{% endifmemberof %}
{% endblock %} +{% block extra-tail %} + + +{% endblock %} diff --git a/resources/templates/auto/list-addresses-Addresses.html b/resources/templates/auto/list-addresses-Addresses.html index 35c7ad6..cab8e08 100644 --- a/resources/templates/auto/list-addresses-Addresses.html +++ b/resources/templates/auto/list-addresses-Addresses.html @@ -1,15 +1,46 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + @@ -34,6 +65,9 @@ latitude + @@ -96,15 +130,30 @@ View {% endfor %} - - - -
longitude +  +
@@ -58,7 +92,7 @@ longitude - +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-addresses-Addresses'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-authorities-Authorities.html b/resources/templates/auto/list-authorities-Authorities.html index 9fff93f..d4dd91b 100644 --- a/resources/templates/auto/list-authorities-Authorities.html +++ b/resources/templates/auto/list-authorities-Authorities.html @@ -1,15 +1,46 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + @@ -25,6 +56,9 @@ access-token-uri + @@ -67,15 +101,30 @@ View {% endfor %} - - - -
authorize-uri +  +
@@ -40,7 +74,7 @@ authorize-uri - +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-authorities-Authorities'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-canvassers-Canvassers.html b/resources/templates/auto/list-canvassers-Canvassers.html index b6ae6d1..8982723 100644 --- a/resources/templates/auto/list-canvassers-Canvassers.html +++ b/resources/templates/auto/list-canvassers-Canvassers.html @@ -1,15 +1,46 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + @@ -40,6 +71,9 @@ authority_id + @@ -118,15 +152,30 @@ View {% endfor %} - - - -
authorised +  +
@@ -70,7 +104,7 @@ authorised - +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-canvassers-Canvassers'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-districts-Districts.html b/resources/templates/auto/list-districts-Districts.html index 2263933..59cb3fe 100644 --- a/resources/templates/auto/list-districts-Districts.html +++ b/resources/templates/auto/list-districts-Districts.html @@ -1,15 +1,46 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + @@ -19,6 +50,9 @@ id + @@ -49,15 +83,30 @@ View {% endfor %} - - - -
name +  +
@@ -28,7 +62,7 @@ name - +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-districts-Districts'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-dwellings-Dwellings.html b/resources/templates/auto/list-dwellings-Dwellings.html index 4cc5d1d..473c656 100644 --- a/resources/templates/auto/list-dwellings-Dwellings.html +++ b/resources/templates/auto/list-dwellings-Dwellings.html @@ -1,15 +1,46 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + @@ -22,6 +53,9 @@ address_id + @@ -60,15 +94,30 @@ View {% endfor %} - - - -
sub-address +  +
@@ -34,7 +68,7 @@ sub-address - +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-dwellings-Dwellings'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-electors-Electors.html b/resources/templates/auto/list-electors-Electors.html index 10777ff..55366fe 100644 --- a/resources/templates/auto/list-electors-Electors.html +++ b/resources/templates/auto/list-electors-Electors.html @@ -1,15 +1,46 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + @@ -31,6 +62,9 @@ email + @@ -89,15 +123,30 @@ View {% endfor %} - - - -
gender +  +
@@ -52,7 +86,7 @@ gender - +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-electors-Electors'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-followupactions-Followupactions.html b/resources/templates/auto/list-followupactions-Followupactions.html index 797e9fe..e96ed1d 100644 --- a/resources/templates/auto/list-followupactions-Followupactions.html +++ b/resources/templates/auto/list-followupactions-Followupactions.html @@ -1,15 +1,46 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + @@ -31,6 +62,9 @@ notes + @@ -89,15 +123,30 @@ View {% endfor %} - - - -
closed +  +
@@ -52,7 +86,7 @@ closed - +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-followupactions-Followupactions'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-followupmethods-Followupmethods.html b/resources/templates/auto/list-followupmethods-Followupmethods.html index 292c50c..e27df9b 100644 --- a/resources/templates/auto/list-followupmethods-Followupmethods.html +++ b/resources/templates/auto/list-followupmethods-Followupmethods.html @@ -1,28 +1,62 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + + @@ -40,15 +74,30 @@ View {% endfor %} - - - -
id +  +
- +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-followupmethods-Followupmethods'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-followuprequests-Followuprequests.html b/resources/templates/auto/list-followuprequests-Followuprequests.html index d2efd40..3809e40 100644 --- a/resources/templates/auto/list-followuprequests-Followuprequests.html +++ b/resources/templates/auto/list-followuprequests-Followuprequests.html @@ -1,15 +1,46 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + @@ -28,6 +59,9 @@ issue_id + @@ -84,15 +118,30 @@ View {% endfor %} - - - -
method_id +  +
@@ -46,7 +80,7 @@ method_id - +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-followuprequests-Followuprequests'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-genders-Genders.html b/resources/templates/auto/list-genders-Genders.html index db02a22..9294b2f 100644 --- a/resources/templates/auto/list-genders-Genders.html +++ b/resources/templates/auto/list-genders-Genders.html @@ -1,28 +1,62 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + + @@ -40,15 +74,30 @@ View {% endfor %} - - - -
id +  +
- +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-genders-Genders'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-intentions-Intentions.html b/resources/templates/auto/list-intentions-Intentions.html index eba312e..8918d29 100644 --- a/resources/templates/auto/list-intentions-Intentions.html +++ b/resources/templates/auto/list-intentions-Intentions.html @@ -1,15 +1,46 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + @@ -25,6 +56,9 @@ option_id + @@ -73,15 +107,30 @@ View {% endfor %} - - - -
locality +  +
@@ -40,7 +74,7 @@ locality - +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-intentions-Intentions'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-issues-Issues.html b/resources/templates/auto/list-issues-Issues.html index 661c9d4..3b409a8 100644 --- a/resources/templates/auto/list-issues-Issues.html +++ b/resources/templates/auto/list-issues-Issues.html @@ -1,15 +1,46 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof issueeditors admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + @@ -25,6 +56,9 @@ current + @@ -67,15 +101,30 @@ View {% endfor %} - - - -
brief +  +
@@ -40,7 +74,7 @@ brief - +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-issues-Issues'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-options-Options.html b/resources/templates/auto/list-options-Options.html index 35a5e64..36a0ee9 100644 --- a/resources/templates/auto/list-options-Options.html +++ b/resources/templates/auto/list-options-Options.html @@ -1,28 +1,62 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + + @@ -40,15 +74,30 @@ View {% endfor %} - - - -
id +  +
- +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-options-Options'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-roles-Roles.html b/resources/templates/auto/list-roles-Roles.html index f573b01..a2310d2 100644 --- a/resources/templates/auto/list-roles-Roles.html +++ b/resources/templates/auto/list-roles-Roles.html @@ -1,15 +1,46 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + @@ -19,6 +50,9 @@ id + @@ -49,15 +83,30 @@ View {% endfor %} - - - -
name +  +
@@ -28,7 +62,7 @@ name - +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-roles-Roles'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-teams-Teams.html b/resources/templates/auto/list-teams-Teams.html index 5c2ec09..b561259 100644 --- a/resources/templates/auto/list-teams-Teams.html +++ b/resources/templates/auto/list-teams-Teams.html @@ -1,15 +1,46 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof teamorganisers admin teamorganisers admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + @@ -28,6 +59,9 @@ latitude + @@ -78,15 +112,30 @@ View {% endfor %} - - - -
longitude +  +
@@ -46,7 +80,7 @@ longitude - +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-teams-Teams'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/auto/list-visits-Visits.html b/resources/templates/auto/list-visits-Visits.html index 45a6a01..d0c6d3d 100644 --- a/resources/templates/auto/list-visits-Visits.html +++ b/resources/templates/auto/list-visits-Visits.html @@ -1,15 +1,46 @@ {% extends "base.html" %} - -{% block content %} -
+{% block back-links %} +
+ +
+ +{% endblock %} +{% block big-links %} +
+{% ifmemberof admin %} + +{% endifmemberof %} +
+ +{% endblock %} +{% block content %} + +{% csrf-field %} + + @@ -25,6 +56,9 @@ canvasser_id + @@ -71,15 +105,30 @@ View {% endfor %} - - - -
date +  +
@@ -40,7 +74,7 @@ date - +
{% endblock %} +{% block extra-script %} + + var form = document.getElementById('list-visits-Visits'); + var ow = document.getElementById('offset'); + var lw = document.getElementById('limit'); + form.addEventListener('submit', function() { + ow.value='0'; + }); + + {% ifunequal params.offset "0" %} + document.getElementById('prev-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)-parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); + {% endifunequal %} + + document.getElementById('next-selector').addEventListener('click', function () { + ow.value=(parseInt(ow.value)+parseInt(lw.value)); + console.log('Updated offset to ' + ow.value); + form.submit(); + }); +{% endblock %} diff --git a/resources/templates/base.html b/resources/templates/base.html index 420a7a7..28be249 100644 --- a/resources/templates/base.html +++ b/resources/templates/base.html @@ -9,6 +9,7 @@ + {% script "js/lib/node_modules/jquery/dist/jquery.min.js" %} {{site-title}}: {{title}} {% endblock %} {% block extra-head %} @@ -37,6 +38,16 @@

{{title}}

+ {% if message|not-empty %} +
+ {{ message }} +
+ {% endif %} + {% if error|not-empty %} +
+ {{ error }} +
+ {% endif %} {% endblock %}
diff --git a/resources/templates/home.html b/resources/templates/home.html index 59a851f..fa0dd1c 100644 --- a/resources/templates/home.html +++ b/resources/templates/home.html @@ -1,19 +1,47 @@ {% extends "base.html" %} {% block big-links %} - - + + {% endblock %} {% block content %} +

Alpha test code

- Although addresses in the database mostly are real, all personal data in the database - is randomly generated and does not represent real people. + This is a voter intention information system intended to be used by the 'Yes' side in the next independence referendum. + Design documentation is here.

+ +

Although addresses in the database mostly are real, all personal data in the database + is randomly generated and does not represent real people.

+ +

+ The Canvasser app +

+ +

Because the canvasser app now loads data from the database and uses your current location, and the database currently only holds + data for the Castle Douglas area, you're unlikely to see any actual data in the app. A dummy of the app in which you can see + data is here. +

+

+ The app currently works on the Chrome browser, and on Android phones. I don't yet know whether it works on iPhones. It does not at + present work with Firefox. +

+ +

+ The Admin system +

+ +

'Save' and 'Delete' buttons on administrative pages do not work; this is intentional at this stage. + I want you to be able to see what different roles in the project can see, without actually being able + to mess up the database.

+ +

If you encounter problems, please submit a report here. + General feedback on usability is also appreciated.

{% endblock %} diff --git a/src/clj/youyesyet/routes/auto.clj b/src/clj/youyesyet/routes/auto.clj index d20c677..c52eeb4 100644 --- a/src/clj/youyesyet/routes/auto.clj +++ b/src/clj/youyesyet/routes/auto.clj @@ -1,9 +1,11 @@ (ns youyesyet.routes.auto - "User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180703T230819.733Z" + "User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180705T101418.070Z" (:require [adl-support.core :as support] [clojure.java.io :as io] + [clojure.set :refer [subset?]] + [clojure.tools.logging :as log] [compojure.core :refer [defroutes GET POST]] [hugsql.core :as hugsql] [noir.response :as nresponse] @@ -29,13 +31,13 @@ (l/render (support/resolve-template "list-addresses-Addresses.html") (:session r) - {:title "Addresses", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-address db/*db* p) - (db/list-addresses db/*db* {}))}))) + (merge + {:title "Addresses", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-addresses db/*db* p) + (db/list-addresses db/*db* {}))})))) (defn form-addresses-Address @@ -45,11 +47,30 @@ (l/render (support/resolve-template "form-addresses-Address.html") (:session r) - {:title "Address", - :params p, - :record - (if (empty? (remove nil? (vals p))) [] (db/get-address db/*db* p)), - :districts (db/list-districts db/*db*)}))) + (merge + {:title "Address", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do + (db/update-address! db/*db* p) + {:message "Updated record"}) + (do (db/create-address! db/*db* p) {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-address db/*db* p))}) + (list {:districts (db/list-districts db/*db*)})))))) (defn list-authorities-Authorities @@ -59,13 +80,13 @@ (l/render (support/resolve-template "list-authorities-Authorities.html") (:session r) - {:title "Authorities", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-authority db/*db* p) - (db/list-authorities db/*db* {}))}))) + (merge + {:title "Authorities", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-authorities db/*db* p) + (db/list-authorities db/*db* {}))})))) (defn form-authorities-Authority @@ -75,13 +96,32 @@ (l/render (support/resolve-template "form-authorities-Authority.html") (:session r) - {:title "Authority", - :params p, - :record - (if - (empty? (remove nil? (vals p))) - [] - (db/get-authority db/*db* p))}))) + (merge + {:title "Authority", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do + (db/update-authority! db/*db* p) + {:message "Updated record"}) + (do + (db/create-authority! db/*db* p) + {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-authority db/*db* p))}) + (list)))))) (defn list-canvassers-Canvassers @@ -91,13 +131,13 @@ (l/render (support/resolve-template "list-canvassers-Canvassers.html") (:session r) - {:title "Canvassers", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-canvasser db/*db* p) - (db/list-canvassers db/*db* {}))}))) + (merge + {:title "Canvassers", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-canvassers db/*db* p) + (db/list-canvassers db/*db* {}))})))) (defn form-canvassers-Canvasser @@ -107,17 +147,36 @@ (l/render (support/resolve-template "form-canvassers-Canvasser.html") (:session r) - {:title "Canvasser", - :params p, - :record - (if - (empty? (remove nil? (vals p))) - [] - (db/get-canvasser db/*db* p)), - :electors (db/list-electors db/*db*), - :addresses (db/list-addresses db/*db*), - :authorities (db/list-authorities db/*db*), - :roles (db/list-roles db/*db*)}))) + (merge + {:title "Canvasser", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do + (db/update-canvasser! db/*db* p) + {:message "Updated record"}) + (do + (db/create-canvasser! db/*db* p) + {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-canvasser db/*db* p))}) + (list + {:electors (db/list-electors db/*db*)} + {:addresses (db/list-addresses db/*db*)} + {:authorities (db/list-authorities db/*db*)} + {:roles (db/list-roles db/*db*)})))))) (defn list-districts-Districts @@ -127,13 +186,13 @@ (l/render (support/resolve-template "list-districts-Districts.html") (:session r) - {:title "Districts", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-district db/*db* p) - (db/list-districts db/*db* {}))}))) + (merge + {:title "Districts", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-districts db/*db* p) + (db/list-districts db/*db* {}))})))) (defn form-districts-District @@ -143,13 +202,32 @@ (l/render (support/resolve-template "form-districts-District.html") (:session r) - {:title "District", - :params p, - :record - (if - (empty? (remove nil? (vals p))) - [] - (db/get-district db/*db* p))}))) + (merge + {:title "District", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do + (db/update-district! db/*db* p) + {:message "Updated record"}) + (do + (db/create-district! db/*db* p) + {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-district db/*db* p))}) + (list)))))) (defn list-dwellings-Dwellings @@ -159,13 +237,13 @@ (l/render (support/resolve-template "list-dwellings-Dwellings.html") (:session r) - {:title "Dwellings", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-dwelling db/*db* p) - (db/list-dwellings db/*db* {}))}))) + (merge + {:title "Dwellings", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-dwellings db/*db* p) + (db/list-dwellings db/*db* {}))})))) (defn form-dwellings-Dwelling @@ -175,14 +253,32 @@ (l/render (support/resolve-template "form-dwellings-Dwelling.html") (:session r) - {:title "Dwelling", - :params p, - :record - (if - (empty? (remove nil? (vals p))) - [] - (db/get-dwelling db/*db* p)), - :addresses (db/list-addresses db/*db*)}))) + (merge + {:title "Dwelling", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do + (db/update-dwelling! db/*db* p) + {:message "Updated record"}) + (do + (db/create-dwelling! db/*db* p) + {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-dwelling db/*db* p))}) + (list {:addresses (db/list-addresses db/*db*)})))))) (defn list-electors-Electors @@ -192,13 +288,13 @@ (l/render (support/resolve-template "list-electors-Electors.html") (:session r) - {:title "Electors", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-elector db/*db* p) - (db/list-electors db/*db* {}))}))) + (merge + {:title "Electors", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-electors db/*db* p) + (db/list-electors db/*db* {}))})))) (defn form-electors-Elector @@ -208,12 +304,32 @@ (l/render (support/resolve-template "form-electors-Elector.html") (:session r) - {:title "Elector", - :params p, - :record - (if (empty? (remove nil? (vals p))) [] (db/get-elector db/*db* p)), - :dwellings (db/list-dwellings db/*db*), - :genders (db/list-genders db/*db*)}))) + (merge + {:title "Elector", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do + (db/update-elector! db/*db* p) + {:message "Updated record"}) + (do (db/create-elector! db/*db* p) {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-elector db/*db* p))}) + (list + {:dwellings (db/list-dwellings db/*db*)} + {:genders (db/list-genders db/*db*)})))))) (defn list-followupactions-Followupactions @@ -224,13 +340,13 @@ (support/resolve-template "list-followupactions-Followupactions.html") (:session r) - {:title "Followupactions", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-followupaction db/*db* p) - (db/list-followupactions db/*db* {}))}))) + (merge + {:title "Followupactions", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-followupactions db/*db* p) + (db/list-followupactions db/*db* {}))})))) (defn form-followupactions-Followupaction @@ -241,15 +357,34 @@ (support/resolve-template "form-followupactions-Followupaction.html") (:session r) - {:title "Followupaction", - :params p, - :record - (if - (empty? (remove nil? (vals p))) - [] - (db/get-followupaction db/*db* p)), - :followuprequests (db/list-followuprequests db/*db*), - :canvassers (db/list-canvassers db/*db*)}))) + (merge + {:title "Followupaction", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do + (db/update-followupaction! db/*db* p) + {:message "Updated record"}) + (do + (db/create-followupaction! db/*db* p) + {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-followupaction db/*db* p))}) + (list + {:followuprequests (db/list-followuprequests db/*db*)} + {:canvassers (db/list-canvassers db/*db*)})))))) (defn list-followupmethods-Followupmethods @@ -260,13 +395,13 @@ (support/resolve-template "list-followupmethods-Followupmethods.html") (:session r) - {:title "Followupmethods", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-followupmethod db/*db* p) - (db/list-followupmethods db/*db* {}))}))) + (merge + {:title "Followupmethods", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-followupmethods db/*db* p) + (db/list-followupmethods db/*db* {}))})))) (defn form-followupmethods-Followupmethod @@ -277,13 +412,32 @@ (support/resolve-template "form-followupmethods-Followupmethod.html") (:session r) - {:title "Followupmethod", - :params p, - :record - (if - (empty? (remove nil? (vals p))) - [] - (db/get-followupmethod db/*db* p))}))) + (merge + {:title "Followupmethod", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do + (db/update-followupmethod! db/*db* p) + {:message "Updated record"}) + (do + (db/create-followupmethod! db/*db* p) + {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-followupmethod db/*db* p))}) + (list)))))) (defn list-followuprequests-Followuprequests @@ -294,13 +448,13 @@ (support/resolve-template "list-followuprequests-Followuprequests.html") (:session r) - {:title "Followuprequests", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-followuprequest db/*db* p) - (db/list-followuprequests db/*db* {}))}))) + (merge + {:title "Followuprequests", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-followuprequests db/*db* p) + (db/list-followuprequests db/*db* {}))})))) (defn form-followuprequests-Followuprequest @@ -311,17 +465,36 @@ (support/resolve-template "form-followuprequests-Followuprequest.html") (:session r) - {:title "Followuprequest", - :params p, - :record - (if - (empty? (remove nil? (vals p))) - [] - (db/get-followuprequest db/*db* p)), - :electors (db/list-electors db/*db*), - :visits (db/list-visits db/*db*), - :issues (db/list-issues db/*db*), - :followupmethods (db/list-followupmethods db/*db*)}))) + (merge + {:title "Followuprequest", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do + (db/update-followuprequest! db/*db* p) + {:message "Updated record"}) + (do + (db/create-followuprequest! db/*db* p) + {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-followuprequest db/*db* p))}) + (list + {:electors (db/list-electors db/*db*)} + {:visits (db/list-visits db/*db*)} + {:issues (db/list-issues db/*db*)} + {:followupmethods (db/list-followupmethods db/*db*)})))))) (defn list-genders-Genders @@ -331,13 +504,13 @@ (l/render (support/resolve-template "list-genders-Genders.html") (:session r) - {:title "Genders", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-gender db/*db* p) - (db/list-genders db/*db* {}))}))) + (merge + {:title "Genders", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-genders db/*db* p) + (db/list-genders db/*db* {}))})))) (defn form-genders-Gender @@ -347,13 +520,28 @@ (l/render (support/resolve-template "form-genders-Gender.html") (:session r) - {:title "Gender", - :params p, - :record - (if - (empty? (remove nil? (vals p))) - [] - (db/get-gender db/*db* p))}))) + (merge + {:title "Gender", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do (db/update-gender! db/*db* p) {:message "Updated record"}) + (do (db/create-gender! db/*db* p) {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-gender db/*db* p))}) + (list)))))) (defn list-intentions-Intentions @@ -363,13 +551,13 @@ (l/render (support/resolve-template "list-intentions-Intentions.html") (:session r) - {:title "Intentions", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-intention db/*db* p) - (db/list-intentions db/*db* {}))}))) + (merge + {:title "Intentions", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-intentions db/*db* p) + (db/list-intentions db/*db* {}))})))) (defn form-intentions-Intention @@ -379,16 +567,35 @@ (l/render (support/resolve-template "form-intentions-Intention.html") (:session r) - {:title "Intention", - :params p, - :record - (if - (empty? (remove nil? (vals p))) - [] - (db/get-intention db/*db* p)), - :visits (db/list-visits db/*db*), - :electors (db/list-electors db/*db*), - :options (db/list-options db/*db*)}))) + (merge + {:title "Intention", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"Id"} (map name (keys p))) + (do + (db/update-intention! db/*db* p) + {:message "Updated record"}) + (do + (db/create-intention! db/*db* p) + {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-intention db/*db* p))}) + (list + {:visits (db/list-visits db/*db*)} + {:electors (db/list-electors db/*db*)} + {:options (db/list-options db/*db*)})))))) (defn list-issues-Issues @@ -398,13 +605,13 @@ (l/render (support/resolve-template "list-issues-Issues.html") (:session r) - {:title "Issues", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-issue db/*db* p) - (db/list-issues db/*db* {}))}))) + (merge + {:title "Issues", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-issues db/*db* p) + (db/list-issues db/*db* {}))})))) (defn form-issues-Issue @@ -414,10 +621,28 @@ (l/render (support/resolve-template "form-issues-Issue.html") (:session r) - {:title "Issue", - :params p, - :record - (if (empty? (remove nil? (vals p))) [] (db/get-issue db/*db* p))}))) + (merge + {:title "Issue", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do (db/update-issue! db/*db* p) {:message "Updated record"}) + (do (db/create-issue! db/*db* p) {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-issue db/*db* p))}) + (list)))))) (defn list-options-Options @@ -427,13 +652,13 @@ (l/render (support/resolve-template "list-options-Options.html") (:session r) - {:title "Options", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-option db/*db* p) - (db/list-options db/*db* {}))}))) + (merge + {:title "Options", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-options db/*db* p) + (db/list-options db/*db* {}))})))) (defn form-options-Option @@ -443,13 +668,28 @@ (l/render (support/resolve-template "form-options-Option.html") (:session r) - {:title "Option", - :params p, - :record - (if - (empty? (remove nil? (vals p))) - [] - (db/get-option db/*db* p))}))) + (merge + {:title "Option", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do (db/update-option! db/*db* p) {:message "Updated record"}) + (do (db/create-option! db/*db* p) {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-option db/*db* p))}) + (list)))))) (defn list-roles-Roles @@ -459,13 +699,13 @@ (l/render (support/resolve-template "list-roles-Roles.html") (:session r) - {:title "Roles", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-role db/*db* p) - (db/list-roles db/*db* {}))}))) + (merge + {:title "Roles", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-roles db/*db* p) + (db/list-roles db/*db* {}))})))) (defn form-roles-Role @@ -475,11 +715,28 @@ (l/render (support/resolve-template "form-roles-Role.html") (:session r) - {:title "Role", - :params p, - :record - (if (empty? (remove nil? (vals p))) [] (db/get-role db/*db* p)), - :canvassers (db/list-canvassers db/*db*)}))) + (merge + {:title "Role", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do (db/update-role! db/*db* p) {:message "Updated record"}) + (do (db/create-role! db/*db* p) {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-role db/*db* p))}) + (list {:canvassers (db/list-canvassers db/*db*)})))))) (defn list-teams-Teams @@ -489,13 +746,13 @@ (l/render (support/resolve-template "list-teams-Teams.html") (:session r) - {:title "Teams", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-team db/*db* p) - (db/list-teams db/*db* {}))}))) + (merge + {:title "Teams", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-teams db/*db* p) + (db/list-teams db/*db* {}))})))) (defn form-teams-Team @@ -505,12 +762,31 @@ (l/render (support/resolve-template "form-teams-Team.html") (:session r) - {:title "Team", - :params p, - :record - (if (empty? (remove nil? (vals p))) [] (db/get-team db/*db* p)), - :districts (db/list-districts db/*db*), - :canvassers (db/list-canvassers db/*db*)}))) + (merge + {:title "Team", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do (db/update-team! db/*db* p) {:message "Updated record"}) + (do (db/create-team! db/*db* p) {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-team db/*db* p))}) + (list + {:districts (db/list-districts db/*db*)} + {:canvassers (db/list-canvassers db/*db*)} + {:canvassers (db/list-canvassers db/*db*)})))))) (defn list-visits-Visits @@ -520,13 +796,13 @@ (l/render (support/resolve-template "list-visits-Visits.html") (:session r) - {:title "Visits", - :params p, - :records - (if - (not (empty? (remove nil? (vals p)))) - (db/search-strings-visit db/*db* p) - (db/list-visits db/*db* {}))}))) + (merge + {:title "Visits", :params p} + {:records + (if + (not (empty? (remove nil? (vals p)))) + (db/search-strings-visits db/*db* p) + (db/list-visits db/*db* {}))})))) (defn form-visits-Visit @@ -536,12 +812,30 @@ (l/render (support/resolve-template "form-visits-Visit.html") (:session r) - {:title "Visit", - :params p, - :record - (if (empty? (remove nil? (vals p))) [] (db/get-visit db/*db* p)), - :addresses (db/list-addresses db/*db*), - :canvassers (db/list-canvassers db/*db*)}))) + (merge + {:title "Visit", :params p} + (reduce + merge + (merge + (cond + (:save-button p) + (try + (if + (some #{"id"} (map name (keys p))) + (do (db/update-visit! db/*db* p) {:message "Updated record"}) + (do (db/create-visit! db/*db* p) {:message "Saved record"})) + (catch + java.lang.Exception + any__2078__auto__ + {:error (.getMessage any__2078__auto__)}))) + {:record + (if + (empty? (remove nil? (vals p))) + [] + (db/get-visit db/*db* p))}) + (list + {:addresses (db/list-addresses db/*db*)} + {:canvassers (db/list-canvassers db/*db*)})))))) (defn raw-resolve-handler diff --git a/src/clj/youyesyet/routes/auto_json.clj b/src/clj/youyesyet/routes/auto_json.clj index 713c2bf..707e1b7 100644 --- a/src/clj/youyesyet/routes/auto_json.clj +++ b/src/clj/youyesyet/routes/auto_json.clj @@ -1,10 +1,11 @@ (ns youyesyet.routes.auto-json - "JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180703T230818.649Z" + "JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180705T101417.082Z" (:require [adl-support.core :as support] - [clojure.java.io :as io] [clojure.core.memoize :as memo] + [clojure.java.io :as io] + [clojure.tools.logging :as log] [compojure.core :refer [defroutes GET POST]] [hugsql.core :as hugsql] [noir.response :as nresponse] @@ -945,13 +946,13 @@ (do (db/list-visits-by-canvasser params))) (def - search-strings-address + search-strings-addresses (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-address + (db/search-strings-addresses db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) @@ -959,13 +960,13 @@ 1000000000)) (def - search-strings-authority + search-strings-authorities (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-authority + (db/search-strings-authorities db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) @@ -973,13 +974,13 @@ 10000000000)) (def - search-strings-canvasser + search-strings-canvassers (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-canvasser + (db/search-strings-canvassers db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) @@ -987,13 +988,13 @@ 10000000)) (def - search-strings-district + search-strings-districts (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-district + (db/search-strings-districts db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) @@ -1001,13 +1002,13 @@ 10000000000)) (def - search-strings-dwelling + search-strings-dwellings (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-dwelling + (db/search-strings-dwellings db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) @@ -1015,13 +1016,13 @@ 1000000000)) (def - search-strings-elector + search-strings-electors (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-elector + (db/search-strings-electors db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) @@ -1029,24 +1030,24 @@ 100000000)) (defn - search-strings-followupaction + search-strings-followupactions "Auto-generated method to select all records from the `followupactions` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(:request_id :actor :date :notes :closed :id)`." [{:keys [params form-params]}] (let [result - (db/search-strings-followupaction + (db/search-strings-followupactions db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) (def - search-strings-followupmethod + search-strings-followupmethods (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-followupmethod + (db/search-strings-followupmethods db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) @@ -1054,13 +1055,13 @@ 10000000000)) (def - search-strings-followuprequest + search-strings-followuprequests (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-followuprequest + (db/search-strings-followuprequests db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) @@ -1068,13 +1069,13 @@ 100000)) (def - search-strings-gender + search-strings-genders (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-gender + (db/search-strings-genders db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) @@ -1082,13 +1083,13 @@ 1000000000)) (def - search-strings-intention + search-strings-intentions (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-intention + (db/search-strings-intentions db/*db* (support/massage-params params form-params #{"Id"}))] (response/ok result))) @@ -1096,13 +1097,13 @@ 100000)) (def - search-strings-issue + search-strings-issues (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-issue + (db/search-strings-issues db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) @@ -1110,13 +1111,13 @@ 1000000)) (def - search-strings-option + search-strings-options (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-option + (db/search-strings-options db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) @@ -1124,13 +1125,13 @@ 10000000000)) (def - search-strings-role + search-strings-roles (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-role + (db/search-strings-roles db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) @@ -1138,13 +1139,13 @@ 10000000000)) (def - search-strings-team + search-strings-teams (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-team + (db/search-strings-teams db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) @@ -1152,13 +1153,13 @@ 10000000)) (def - search-strings-visit + search-strings-visits (memo/ttl (fn [{:keys [params form-params]}] (let [result - (db/search-strings-visit + (db/search-strings-visits db/*db* (support/massage-params params form-params #{"id"}))] (response/ok result))) @@ -1242,6 +1243,17 @@ (support/massage-params params form-params #{"id"}))] (response/found "/"))) +(defn + update-followupmethod! + "Auto-generated method to update one record in the `followupmethods` table. Expects the following key(s) to be present in `params`: `(:id)`." + [{:keys [params form-params]}] + (let + [result + (db/update-followupmethod! + db/*db* + (support/massage-params params form-params #{"id"}))] + (response/found "/"))) + (defn update-followuprequest! "Auto-generated method to update one record in the `followuprequests` table. Expects the following key(s) to be present in `params`: `(:elector_id :id :issue_id :method_id :visit_id)`." @@ -1253,6 +1265,17 @@ (support/massage-params params form-params #{"id"}))] (response/found "/"))) +(defn + update-gender! + "Auto-generated method to update one record in the `genders` table. Expects the following key(s) to be present in `params`: `(:id)`." + [{:keys [params form-params]}] + (let + [result + (db/update-gender! + db/*db* + (support/massage-params params form-params #{"id"}))] + (response/found "/"))) + (defn update-intention! "Auto-generated method to update one record in the `intentions` table. Expects the following key(s) to be present in `params`: `(:Id :elector_id :locality :option_id :visit_id)`." @@ -1275,6 +1298,17 @@ (support/massage-params params form-params #{"id"}))] (response/found "/"))) +(defn + update-option! + "Auto-generated method to update one record in the `options` table. Expects the following key(s) to be present in `params`: `(:id)`." + [{:keys [params form-params]}] + (let + [result + (db/update-option! + db/*db* + (support/massage-params params form-params #{"id"}))] + (response/found "/"))) + (defn update-role! "Auto-generated method to update one record in the `roles` table. Expects the following key(s) to be present in `params`: `(:id :name)`." @@ -1663,69 +1697,69 @@ request (route/restricted (list-visits-by-canvasser request))) (GET - "/json/auto/search-strings-address" + "/json/auto/search-strings-addresses" request - (route/restricted (search-strings-address request))) + (route/restricted (search-strings-addresses request))) (GET - "/json/auto/search-strings-authority" + "/json/auto/search-strings-authorities" request - (route/restricted (search-strings-authority request))) + (route/restricted (search-strings-authorities request))) (GET - "/json/auto/search-strings-canvasser" + "/json/auto/search-strings-canvassers" request - (route/restricted (search-strings-canvasser request))) + (route/restricted (search-strings-canvassers request))) (GET - "/json/auto/search-strings-district" + "/json/auto/search-strings-districts" request - (route/restricted (search-strings-district request))) + (route/restricted (search-strings-districts request))) (GET - "/json/auto/search-strings-dwelling" + "/json/auto/search-strings-dwellings" request - (route/restricted (search-strings-dwelling request))) + (route/restricted (search-strings-dwellings request))) (GET - "/json/auto/search-strings-elector" + "/json/auto/search-strings-electors" request - (route/restricted (search-strings-elector request))) + (route/restricted (search-strings-electors request))) (GET - "/json/auto/search-strings-followupaction" + "/json/auto/search-strings-followupactions" request - (route/restricted (search-strings-followupaction request))) + (route/restricted (search-strings-followupactions request))) (GET - "/json/auto/search-strings-followupmethod" + "/json/auto/search-strings-followupmethods" request - (route/restricted (search-strings-followupmethod request))) + (route/restricted (search-strings-followupmethods request))) (GET - "/json/auto/search-strings-followuprequest" + "/json/auto/search-strings-followuprequests" request - (route/restricted (search-strings-followuprequest request))) + (route/restricted (search-strings-followuprequests request))) (GET - "/json/auto/search-strings-gender" + "/json/auto/search-strings-genders" request - (route/restricted (search-strings-gender request))) + (route/restricted (search-strings-genders request))) (GET - "/json/auto/search-strings-intention" + "/json/auto/search-strings-intentions" request - (route/restricted (search-strings-intention request))) + (route/restricted (search-strings-intentions request))) (GET - "/json/auto/search-strings-issue" + "/json/auto/search-strings-issues" request - (route/restricted (search-strings-issue request))) + (route/restricted (search-strings-issues request))) (GET - "/json/auto/search-strings-option" + "/json/auto/search-strings-options" request - (route/restricted (search-strings-option request))) + (route/restricted (search-strings-options request))) (GET - "/json/auto/search-strings-role" + "/json/auto/search-strings-roles" request - (route/restricted (search-strings-role request))) + (route/restricted (search-strings-roles request))) (GET - "/json/auto/search-strings-team" + "/json/auto/search-strings-teams" request - (route/restricted (search-strings-team request))) + (route/restricted (search-strings-teams request))) (GET - "/json/auto/search-strings-visit" + "/json/auto/search-strings-visits" request - (route/restricted (search-strings-visit request))) + (route/restricted (search-strings-visits request))) (POST "/json/auto/update-address" request @@ -1754,10 +1788,18 @@ "/json/auto/update-followupaction" request (route/restricted (update-followupaction! request))) + (POST + "/json/auto/update-followupmethod" + request + (route/restricted (update-followupmethod! request))) (POST "/json/auto/update-followuprequest" request (route/restricted (update-followuprequest! request))) + (POST + "/json/auto/update-gender" + request + (route/restricted (update-gender! request))) (POST "/json/auto/update-intention" request @@ -1766,6 +1808,10 @@ "/json/auto/update-issue" request (route/restricted (update-issue! request))) + (POST + "/json/auto/update-option" + request + (route/restricted (update-option! request))) (POST "/json/auto/update-role" request