From 3a49e50a5152e50a7a1694a483d35ce6c4616f7b Mon Sep 17 00:00:00 2001
From: Simon Brooke
Date: Tue, 3 Jul 2018 19:50:19 +0100
Subject: [PATCH] Now actually pulling data from server, but some regressions.
The map isn't rendering, and there's something wrong with options. But a lot is working.
---
project.clj | 4 +-
.../img/gender/{female.png => Female.png} | Bin
.../public/img/gender/{male.png => Male.png} | Bin
.../img/gender/{fluid.png => Non-binary.png} | Bin
.../img/gender/{unknown.png => Unknown.png} | Bin
.../{no-selected.png => No-selected.png} | Bin
.../{no-unselected.png => No-unselected.png} | Bin
.../{yes-selected.png => Yes-selected.png} | Bin
...{yes-unselected.png => Yes-unselected.png} | Bin
resources/sql/queries.auto.sql | 62 +-
resources/sql/youyesyet.postgres.sql | 6 +-
.../templates/auto/application-index.html | 2 +-
.../auto/form-addresses-Address.html | 2 +-
.../auto/form-authorities-Authority.html | 2 +-
.../auto/form-canvassers-Canvasser.html | 2 +-
.../auto/form-districts-District.html | 2 +-
.../auto/form-dwellings-Dwelling.html | 2 +-
.../templates/auto/form-electors-Elector.html | 2 +-
.../form-followupactions-Followupaction.html | 2 +-
.../form-followupmethods-Followupmethod.html | 2 +-
...form-followuprequests-Followuprequest.html | 2 +-
.../templates/auto/form-genders-Gender.html | 2 +-
.../auto/form-intentions-Intention.html | 2 +-
.../templates/auto/form-issues-Issue.html | 20 +-
.../templates/auto/form-options-Option.html | 2 +-
resources/templates/auto/form-roles-Role.html | 2 +-
resources/templates/auto/form-teams-Team.html | 2 +-
.../templates/auto/form-visits-Visit.html | 2 +-
.../auto/list-addresses-Addresses.html | 70 +-
.../auto/list-authorities-Authorities.html | 70 +-
.../auto/list-canvassers-Canvassers.html | 70 +-
.../auto/list-districts-Districts.html | 70 +-
.../auto/list-dwellings-Dwellings.html | 70 +-
.../auto/list-electors-Electors.html | 70 +-
.../list-followupactions-Followupactions.html | 70 +-
.../list-followupmethods-Followupmethods.html | 70 +-
...ist-followuprequests-Followuprequests.html | 70 +-
.../templates/auto/list-genders-Genders.html | 70 +-
.../auto/list-intentions-Intentions.html | 70 +-
.../templates/auto/list-issues-Issues.html | 79 +-
.../templates/auto/list-options-Options.html | 70 +-
.../templates/auto/list-roles-Roles.html | 70 +-
.../templates/auto/list-teams-Teams.html | 70 +-
.../templates/auto/list-visits-Visits.html | 70 +-
src/clj/youyesyet/handler.clj | 2 +
src/clj/youyesyet/routes/auto.clj | 1088 ++++--------
src/clj/youyesyet/routes/auto_json.clj | 1468 +++--------------
src/clj/youyesyet/routes/rest.clj | 10 +-
src/cljc/youyesyet/utils.cljc | 10 +-
src/cljs/youyesyet/canvasser_app/core.cljs | 9 +-
.../youyesyet/canvasser_app/handlers.cljs | 323 +++-
src/cljs/youyesyet/canvasser_app/state.cljs | 145 +-
.../youyesyet/canvasser_app/ui_utils.cljs | 3 +-
.../canvasser_app/views/dwelling.cljs | 6 +-
.../canvasser_app/views/elector.cljs | 2 +-
.../youyesyet/canvasser_app/views/issue.cljs | 7 +-
.../youyesyet/canvasser_app/views/issues.cljs | 2 +-
.../youyesyet/canvasser_app/views/map.cljs | 94 +-
youyesyet.canonical.adl.xml | 7 +-
59 files changed, 1263 insertions(+), 3166 deletions(-)
rename resources/public/img/gender/{female.png => Female.png} (100%)
rename resources/public/img/gender/{male.png => Male.png} (100%)
rename resources/public/img/gender/{fluid.png => Non-binary.png} (100%)
rename resources/public/img/gender/{unknown.png => Unknown.png} (100%)
rename resources/public/img/option/{no-selected.png => No-selected.png} (100%)
rename resources/public/img/option/{no-unselected.png => No-unselected.png} (100%)
rename resources/public/img/option/{yes-selected.png => Yes-selected.png} (100%)
rename resources/public/img/option/{yes-unselected.png => Yes-unselected.png} (100%)
diff --git a/project.clj b/project.clj
index 8f52343..7ffe7db 100644
--- a/project.clj
+++ b/project.clj
@@ -8,10 +8,12 @@
[ch.qos.logback/logback-classic "1.2.2"]
[clj-oauth "1.5.5"]
[cljsjs/react-leaflet "0.12.3-4"]
- [cljs-ajax "0.5.8"]
+ [cljs-ajax "0.7.3"]
+ [com.cemerick/url "0.1.1"]
[compojure "1.5.2"]
[conman "0.6.3"]
[cprop "0.1.10"]
+ [day8.re-frame/http-fx "0.1.6"]
[korma "0.4.3"]
[lib-noir "0.9.9" :exclusions [org.clojure/tools.reader]]
[luminus/ring-ttl-session "0.3.1"]
diff --git a/resources/public/img/gender/female.png b/resources/public/img/gender/Female.png
similarity index 100%
rename from resources/public/img/gender/female.png
rename to resources/public/img/gender/Female.png
diff --git a/resources/public/img/gender/male.png b/resources/public/img/gender/Male.png
similarity index 100%
rename from resources/public/img/gender/male.png
rename to resources/public/img/gender/Male.png
diff --git a/resources/public/img/gender/fluid.png b/resources/public/img/gender/Non-binary.png
similarity index 100%
rename from resources/public/img/gender/fluid.png
rename to resources/public/img/gender/Non-binary.png
diff --git a/resources/public/img/gender/unknown.png b/resources/public/img/gender/Unknown.png
similarity index 100%
rename from resources/public/img/gender/unknown.png
rename to resources/public/img/gender/Unknown.png
diff --git a/resources/public/img/option/no-selected.png b/resources/public/img/option/No-selected.png
similarity index 100%
rename from resources/public/img/option/no-selected.png
rename to resources/public/img/option/No-selected.png
diff --git a/resources/public/img/option/no-unselected.png b/resources/public/img/option/No-unselected.png
similarity index 100%
rename from resources/public/img/option/no-unselected.png
rename to resources/public/img/option/No-unselected.png
diff --git a/resources/public/img/option/yes-selected.png b/resources/public/img/option/Yes-selected.png
similarity index 100%
rename from resources/public/img/option/yes-selected.png
rename to resources/public/img/option/Yes-selected.png
diff --git a/resources/public/img/option/yes-unselected.png b/resources/public/img/option/Yes-unselected.png
similarity index 100%
rename from resources/public/img/option/yes-unselected.png
rename to resources/public/img/option/Yes-unselected.png
diff --git a/resources/sql/queries.auto.sql b/resources/sql/queries.auto.sql
index 5d024dc..dab35b5 100644
--- a/resources/sql/queries.auto.sql
+++ b/resources/sql/queries.auto.sql
@@ -1,10 +1,10 @@
------------------------------------------------------------------------
--- File queries.sql
---
--- autogenerated by adl.to-hugsql-queries at 2018-07-01T22:15:28.111Z
---
--- See [Application Description
--- Language](https://github.com/simon-brooke/adl).
+-- File queries.sql
+--
+-- autogenerated by adl.to-hugsql-queries at 2018-07-03T12:23:50.486Z
+--
+-- See [Application Description
+-- Language](https://github.com/simon-brooke/adl).
------------------------------------------------------------------------
-- :name create-address! :! :n
@@ -143,9 +143,11 @@ returning Id
-- :doc creates a new issue record
INSERT INTO issues (url,
current,
+ brief,
id)
VALUES (:url,
:current,
+ :brief,
:id)
returning id
@@ -405,7 +407,7 @@ ORDER BY lv_addresses.address,
-- :name list-addresses-by-district :? :*
-- :doc lists all existing address records related to a given district
-SELECT *
+SELECT *
FROM lv_addresses, addresses
WHERE lv_addresses.id = addresses.id
AND addresses.district_id = :id
@@ -433,7 +435,7 @@ ORDER BY lv_canvassers.username,
-- :name list-canvassers-by-address :? :*
-- :doc lists all existing canvasser records related to a given address
-SELECT *
+SELECT *
FROM lv_canvassers, canvassers
WHERE lv_canvassers.id = canvassers.id
AND canvassers.address_id = :id
@@ -446,7 +448,7 @@ ORDER BY lv_canvassers.username,
-- :name list-canvassers-by-authority :? :*
-- :doc lists all existing canvasser records related to a given authority
-SELECT *
+SELECT *
FROM lv_canvassers, canvassers
WHERE lv_canvassers.id = canvassers.id
AND canvassers.authority_id = :id
@@ -459,7 +461,7 @@ ORDER BY lv_canvassers.username,
-- :name list-canvassers-by-elector :? :*
-- :doc lists all existing canvasser records related to a given elector
-SELECT *
+SELECT *
FROM lv_canvassers, canvassers
WHERE lv_canvassers.id = canvassers.id
AND canvassers.elector_id = :id
@@ -472,7 +474,7 @@ ORDER BY lv_canvassers.username,
-- :name list-canvassers-by-role :? :*
-- :doc links all existing canvasser records related to a given role
-SELECT *
+SELECT *
FROM canvassers, ln_canvassers_roles
WHERE canvassers.id = ln_canvassers_roles.canvasser_id
AND ln_canvassers_roles.role_id = :id
@@ -502,7 +504,7 @@ ORDER BY lv_dwellings.address_id,
-- :name list-dwellings-by-address :? :*
-- :doc lists all existing dwelling records related to a given address
-SELECT *
+SELECT *
FROM lv_dwellings, dwellings
WHERE lv_dwellings.id = dwellings.id
AND dwellings.address_id = :id
@@ -523,7 +525,7 @@ ORDER BY lv_electors.name,
-- :name list-electors-by-dwelling :? :*
-- :doc lists all existing elector records related to a given dwelling
-SELECT *
+SELECT *
FROM lv_electors, electors
WHERE lv_electors.id = electors.id
AND electors.dwelling_id = :id
@@ -535,7 +537,7 @@ ORDER BY lv_electors.name,
-- :name list-electors-by-gender :? :*
-- :doc lists all existing elector records related to a given gender
-SELECT *
+SELECT *
FROM lv_electors, electors
WHERE lv_electors.id = electors.id
AND electors.gender = :id
@@ -556,7 +558,7 @@ ORDER BY lv_followupactions.date,
-- :name list-followupactions-by-canvasser :? :*
-- :doc lists all existing followupaction records related to a given canvasser
-SELECT *
+SELECT *
FROM lv_followupactions, followupactions
WHERE lv_followupactions.id = followupactions.id
AND followupactions.actor = :id
@@ -566,7 +568,7 @@ ORDER BY lv_followupactions.date,
-- :name list-followupactions-by-followuprequest :? :*
-- :doc lists all existing followupaction records related to a given followuprequest
-SELECT *
+SELECT *
FROM lv_followupactions, followupactions
WHERE lv_followupactions.id = followupactions.id
AND followupactions.request_id = :id
@@ -592,7 +594,7 @@ ORDER BY lv_followuprequests.elector_id,
-- :name list-followuprequests-by-elector :? :*
-- :doc lists all existing followuprequest records related to a given elector
-SELECT *
+SELECT *
FROM lv_followuprequests, followuprequests
WHERE lv_followuprequests.id = followuprequests.id
AND followuprequests.elector_id = :id
@@ -603,7 +605,7 @@ ORDER BY lv_followuprequests.elector_id,
-- :name list-followuprequests-by-followupmethod :? :*
-- :doc lists all existing followuprequest records related to a given followupmethod
-SELECT *
+SELECT *
FROM lv_followuprequests, followuprequests
WHERE lv_followuprequests.id = followuprequests.id
AND followuprequests.method_id = :id
@@ -614,7 +616,7 @@ ORDER BY lv_followuprequests.elector_id,
-- :name list-followuprequests-by-issue :? :*
-- :doc lists all existing followuprequest records related to a given issue
-SELECT *
+SELECT *
FROM lv_followuprequests, followuprequests
WHERE lv_followuprequests.id = followuprequests.id
AND followuprequests.issue_id = :id
@@ -625,7 +627,7 @@ ORDER BY lv_followuprequests.elector_id,
-- :name list-followuprequests-by-visit :? :*
-- :doc lists all existing followuprequest records related to a given visit
-SELECT *
+SELECT *
FROM lv_followuprequests, followuprequests
WHERE lv_followuprequests.id = followuprequests.id
AND followuprequests.visit_id = :id
@@ -648,21 +650,21 @@ SELECT DISTINCT * FROM lv_intentions
-- :name list-intentions-by-elector :? :*
-- :doc lists all existing intention records related to a given elector
-SELECT *
+SELECT *
FROM lv_intentions, intentions
WHERE lv_intentions.Id = intentions.Id
AND intentions.elector_id = :id
-- :name list-intentions-by-option :? :*
-- :doc lists all existing intention records related to a given option
-SELECT *
+SELECT *
FROM lv_intentions, intentions
WHERE lv_intentions.Id = intentions.Id
AND intentions.option_id = :id
-- :name list-intentions-by-visit :? :*
-- :doc lists all existing intention records related to a given visit
-SELECT *
+SELECT *
FROM lv_intentions, intentions
WHERE lv_intentions.Id = intentions.Id
AND intentions.visit_id = :id
@@ -689,7 +691,7 @@ ORDER BY lv_roles.name,
-- :name list-roles-by-canvasser :? :*
-- :doc links all existing role records related to a given canvasser
-SELECT *
+SELECT *
FROM roles, ln_canvassers_roles
WHERE roles.id = ln_canvassers_roles.role_id
AND ln_canvassers_roles.canvasser_id = :id
@@ -706,7 +708,7 @@ ORDER BY lv_teams.name,
-- :name list-teams-by-canvasser :? :*
-- :doc links all existing team records related to a given canvasser
-SELECT *
+SELECT *
FROM teams, ln_canvassers_teams
WHERE teams.id = ln_canvassers_teams.team_id
AND ln_canvassers_teams.canvasser_id = :id
@@ -715,7 +717,7 @@ ORDER BY teams.name,
-- :name list-teams-by-district :? :*
-- :doc lists all existing team records related to a given district
-SELECT *
+SELECT *
FROM lv_teams, teams
WHERE lv_teams.id = teams.id
AND teams.district_id = :id
@@ -733,7 +735,7 @@ ORDER BY lv_visits.address_id,
-- :name list-visits-by-address :? :*
-- :doc lists all existing visit records related to a given address
-SELECT *
+SELECT *
FROM lv_visits, visits
WHERE lv_visits.id = visits.id
AND visits.address_id = :id
@@ -743,7 +745,7 @@ ORDER BY lv_visits.address_id,
-- :name list-visits-by-canvasser :? :*
-- :doc lists all existing visit records related to a given canvasser
-SELECT *
+SELECT *
FROM lv_visits, visits
WHERE lv_visits.id = visits.id
AND visits.canvasser_id = :id
@@ -912,6 +914,7 @@ SELECT DISTINCT * FROM lv_issues
WHERE false
--~ (if (:url params) "OR url LIKE '%:url%'")
--~ (if (:current params) "OR current = :current")
+ --~ (if (:brief params) "OR brief LIKE '%:brief%'")
--~ (if (:id params) "OR id LIKE '%:id%'")
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
@@ -1055,6 +1058,7 @@ WHERE intentions.Id = :Id
UPDATE issues
SET url = :url,
current = :current,
+ brief = :brief,
id = :id
WHERE issues.id = :id
@@ -1079,4 +1083,4 @@ UPDATE visits
SET address_id = :address_id,
canvasser_id = :canvasser_id,
date = :date
-WHERE visits.id = :id
+WHERE visits.id = :id
\ No newline at end of file
diff --git a/resources/sql/youyesyet.postgres.sql b/resources/sql/youyesyet.postgres.sql
index a8aab30..1375265 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 20180701T221532.672Z
+-- (https://github.com/simon-brooke/adl) at 20180703T122351.367Z
--
--
-- A web-app intended to be used by canvassers campaigning for a
@@ -338,7 +338,8 @@ CREATE TABLE issues
(
id VARCHAR(32) NOT NULL PRIMARY KEY,
url VARCHAR(256),
- current BOOLEAN DEFAULT true
+ current BOOLEAN DEFAULT true,
+ brief TEXT
);
GRANT SELECT ON issues TO admin,
analysts,
@@ -676,6 +677,7 @@ GRANT SELECT ON lv_intentions TO admin,
CREATE VIEW lv_issues AS
SELECT issues.url,
issues.current,
+ issues.brief,
issues.id
FROM issues
;
diff --git a/resources/templates/auto/application-index.html b/resources/templates/auto/application-index.html
index 27f6615..d20b64c 100644
--- a/resources/templates/auto/application-index.html
+++ b/resources/templates/auto/application-index.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
diff --git a/resources/templates/auto/form-addresses-Address.html b/resources/templates/auto/form-addresses-Address.html
index 6fbbbc4..9ca72aa 100644
--- a/resources/templates/auto/form-addresses-Address.html
+++ b/resources/templates/auto/form-addresses-Address.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
diff --git a/resources/templates/auto/form-authorities-Authority.html b/resources/templates/auto/form-authorities-Authority.html
index 02749f0..329e3a7 100644
--- a/resources/templates/auto/form-authorities-Authority.html
+++ b/resources/templates/auto/form-authorities-Authority.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
diff --git a/resources/templates/auto/form-canvassers-Canvasser.html b/resources/templates/auto/form-canvassers-Canvasser.html
index 7e94c21..320c80b 100644
--- a/resources/templates/auto/form-canvassers-Canvasser.html
+++ b/resources/templates/auto/form-canvassers-Canvasser.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
diff --git a/resources/templates/auto/form-districts-District.html b/resources/templates/auto/form-districts-District.html
index 733f6f2..41fa5f2 100644
--- a/resources/templates/auto/form-districts-District.html
+++ b/resources/templates/auto/form-districts-District.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
diff --git a/resources/templates/auto/form-dwellings-Dwelling.html b/resources/templates/auto/form-dwellings-Dwelling.html
index 692539f..2b562c7 100644
--- a/resources/templates/auto/form-dwellings-Dwelling.html
+++ b/resources/templates/auto/form-dwellings-Dwelling.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
diff --git a/resources/templates/auto/form-electors-Elector.html b/resources/templates/auto/form-electors-Elector.html
index 6ad712a..9ea1a40 100644
--- a/resources/templates/auto/form-electors-Elector.html
+++ b/resources/templates/auto/form-electors-Elector.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
diff --git a/resources/templates/auto/form-followupactions-Followupaction.html b/resources/templates/auto/form-followupactions-Followupaction.html
index ac42a80..eea3de0 100644
--- a/resources/templates/auto/form-followupactions-Followupaction.html
+++ b/resources/templates/auto/form-followupactions-Followupaction.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
diff --git a/resources/templates/auto/form-followupmethods-Followupmethod.html b/resources/templates/auto/form-followupmethods-Followupmethod.html
index b1810ab..f22b050 100644
--- a/resources/templates/auto/form-followupmethods-Followupmethod.html
+++ b/resources/templates/auto/form-followupmethods-Followupmethod.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
diff --git a/resources/templates/auto/form-followuprequests-Followuprequest.html b/resources/templates/auto/form-followuprequests-Followuprequest.html
index fc30435..7632816 100644
--- a/resources/templates/auto/form-followuprequests-Followuprequest.html
+++ b/resources/templates/auto/form-followuprequests-Followuprequest.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
diff --git a/resources/templates/auto/form-genders-Gender.html b/resources/templates/auto/form-genders-Gender.html
index 9beaae3..a62df40 100644
--- a/resources/templates/auto/form-genders-Gender.html
+++ b/resources/templates/auto/form-genders-Gender.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
diff --git a/resources/templates/auto/form-intentions-Intention.html b/resources/templates/auto/form-intentions-Intention.html
index d04e85a..472abe6 100644
--- a/resources/templates/auto/form-intentions-Intention.html
+++ b/resources/templates/auto/form-intentions-Intention.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
diff --git a/resources/templates/auto/form-issues-Issue.html b/resources/templates/auto/form-issues-Issue.html
index e2e6ebc..3fde700 100644
--- a/resources/templates/auto/form-issues-Issue.html
+++ b/resources/templates/auto/form-issues-Issue.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-
@@ -61,6 +61,24 @@ You are not permitted to view current of issues
{% endifmemberof %}
{% endifmemberof %}
+
+
+{% ifmemberof issueeditors admin %}
+
+{% else %}
+{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
+
+{{record.brief}}
+
+{% else %}
+
+You are not permitted to view brief of issues
+
+{% endifmemberof %}
+{% endifmemberof %}
+