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.
This commit is contained in:
Simon Brooke 2018-07-03 19:50:19 +01:00
parent d4f0f4aa5c
commit 3a49e50a51
59 changed files with 1263 additions and 3166 deletions

View file

@ -8,10 +8,12 @@
[ch.qos.logback/logback-classic "1.2.2"] [ch.qos.logback/logback-classic "1.2.2"]
[clj-oauth "1.5.5"] [clj-oauth "1.5.5"]
[cljsjs/react-leaflet "0.12.3-4"] [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"] [compojure "1.5.2"]
[conman "0.6.3"] [conman "0.6.3"]
[cprop "0.1.10"] [cprop "0.1.10"]
[day8.re-frame/http-fx "0.1.6"]
[korma "0.4.3"] [korma "0.4.3"]
[lib-noir "0.9.9" :exclusions [org.clojure/tools.reader]] [lib-noir "0.9.9" :exclusions [org.clojure/tools.reader]]
[luminus/ring-ttl-session "0.3.1"] [luminus/ring-ttl-session "0.3.1"]

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

View file

Before

Width:  |  Height:  |  Size: 983 B

After

Width:  |  Height:  |  Size: 983 B

View file

Before

Width:  |  Height:  |  Size: 511 B

After

Width:  |  Height:  |  Size: 511 B

View file

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View file

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View file

@ -1,7 +1,7 @@
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- File queries.sql -- File queries.sql
-- --
-- autogenerated by adl.to-hugsql-queries at 2018-07-01T22:15:28.111Z -- autogenerated by adl.to-hugsql-queries at 2018-07-03T12:23:50.486Z
-- --
-- See [Application Description -- See [Application Description
-- Language](https://github.com/simon-brooke/adl). -- Language](https://github.com/simon-brooke/adl).
@ -143,9 +143,11 @@ returning Id
-- :doc creates a new issue record -- :doc creates a new issue record
INSERT INTO issues (url, INSERT INTO issues (url,
current, current,
brief,
id) id)
VALUES (:url, VALUES (:url,
:current, :current,
:brief,
:id) :id)
returning id returning id
@ -912,6 +914,7 @@ SELECT DISTINCT * FROM lv_issues
WHERE false WHERE false
--~ (if (:url params) "OR url LIKE '%:url%'") --~ (if (:url params) "OR url LIKE '%:url%'")
--~ (if (:current params) "OR current = :current") --~ (if (:current params) "OR current = :current")
--~ (if (:brief params) "OR brief LIKE '%:brief%'")
--~ (if (:id params) "OR id LIKE '%:id%'") --~ (if (:id params) "OR id LIKE '%:id%'")
--~ (if (:offset params) "OFFSET :offset ") --~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
@ -1055,6 +1058,7 @@ WHERE intentions.Id = :Id
UPDATE issues UPDATE issues
SET url = :url, SET url = :url,
current = :current, current = :current,
brief = :brief,
id = :id id = :id
WHERE issues.id = :id WHERE issues.id = :id

View file

@ -5,7 +5,7 @@
-- --
-- auto-generated by [Application Description Language framework] -- 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 -- 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, id VARCHAR(32) NOT NULL PRIMARY KEY,
url VARCHAR(256), url VARCHAR(256),
current BOOLEAN DEFAULT true current BOOLEAN DEFAULT true,
brief TEXT
); );
GRANT SELECT ON issues TO admin, GRANT SELECT ON issues TO admin,
analysts, analysts,
@ -676,6 +677,7 @@ GRANT SELECT ON lv_intentions TO admin,
CREATE VIEW lv_issues AS CREATE VIEW lv_issues AS
SELECT issues.url, SELECT issues.url,
issues.current, issues.current,
issues.brief,
issues.id issues.id
FROM issues FROM issues
; ;

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File application-index.html generated 2018-07-01T22:15:35.347Z by adl.to-selmer-templates. <!-- File application-index.html generated 2018-07-03T12:23:51.915Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-addresses-Address.html generated 2018-07-01T22:15:35.320Z by adl.to-selmer-templates. <!-- File form-addresses-Address.html generated 2018-07-03T12:23:51.902Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-authorities-Authority.html generated 2018-07-01T22:15:35.364Z by adl.to-selmer-templates. <!-- File form-authorities-Authority.html generated 2018-07-03T12:23:51.923Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-canvassers-Canvasser.html generated 2018-07-01T22:15:35.371Z by adl.to-selmer-templates. <!-- File form-canvassers-Canvasser.html generated 2018-07-03T12:23:51.926Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-districts-District.html generated 2018-07-01T22:15:35.303Z by adl.to-selmer-templates. <!-- File form-districts-District.html generated 2018-07-03T12:23:51.891Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-dwellings-Dwelling.html generated 2018-07-01T22:15:35.401Z by adl.to-selmer-templates. <!-- File form-dwellings-Dwelling.html generated 2018-07-03T12:23:51.938Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-electors-Elector.html generated 2018-07-01T22:15:35.355Z by adl.to-selmer-templates. <!-- File form-electors-Elector.html generated 2018-07-03T12:23:51.920Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-followupactions-Followupaction.html generated 2018-07-01T22:15:35.407Z by adl.to-selmer-templates. <!-- File form-followupactions-Followupaction.html generated 2018-07-03T12:23:51.940Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-followupmethods-Followupmethod.html generated 2018-07-01T22:15:35.414Z by adl.to-selmer-templates. <!-- File form-followupmethods-Followupmethod.html generated 2018-07-03T12:23:51.943Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-followuprequests-Followuprequest.html generated 2018-07-01T22:15:35.309Z by adl.to-selmer-templates. <!-- File form-followuprequests-Followuprequest.html generated 2018-07-03T12:23:51.895Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-genders-Gender.html generated 2018-07-01T22:15:35.292Z by adl.to-selmer-templates. <!-- File form-genders-Gender.html generated 2018-07-03T12:23:51.886Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-intentions-Intention.html generated 2018-07-01T22:15:35.391Z by adl.to-selmer-templates. <!-- File form-intentions-Intention.html generated 2018-07-03T12:23:51.935Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-issues-Issue.html generated 2018-07-01T22:15:35.330Z by adl.to-selmer-templates. <!-- File form-issues-Issue.html generated 2018-07-03T12:23:51.907Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
@ -61,6 +61,24 @@ You are not permitted to view current of issues
{% endifmemberof %} {% endifmemberof %}
{% endifmemberof %} {% endifmemberof %}
</p> </p>
<p class='widget'>
<label for='brief'>
brief
</label>
{% ifmemberof issueeditors admin %}
<input id='brief' name='brief' type='text' value='{{record.brief}}' maxlength='' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='brief' name='brief' class='pseudo-widget disabled'>
{{record.brief}}
</span>
{% else %}
<span id='brief' name='brief' class='pseudo-widget not-authorised'>
You are not permitted to view brief of issues
</span>
{% endifmemberof %}
{% endifmemberof %}
</p>
<p class='widget action-safe'> <p class='widget action-safe'>
<label for='save-button' class='action-safe'> <label for='save-button' class='action-safe'>
To save this issues record To save this issues record

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-options-Option.html generated 2018-07-01T22:15:35.389Z by adl.to-selmer-templates. <!-- File form-options-Option.html generated 2018-07-03T12:23:51.934Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-roles-Role.html generated 2018-07-01T22:15:35.334Z by adl.to-selmer-templates. <!-- File form-roles-Role.html generated 2018-07-03T12:23:51.910Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-teams-Team.html generated 2018-07-01T22:15:35.349Z by adl.to-selmer-templates. <!-- File form-teams-Team.html generated 2018-07-03T12:23:51.915Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-visits-Visit.html generated 2018-07-01T22:15:35.342Z by adl.to-selmer-templates. <!-- File form-visits-Visit.html generated 2018-07-03T12:23:51.913Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-addresses-Addresses.html generated 2018-07-01T22:15:35.368Z by adl.to-selmer-templates. <!-- File list-addresses-Addresses.html generated 2018-07-03T12:23:51.926Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-addresses-Address'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-addresses-Address' class='big-link'>
Add a new Address Add a new Address
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-addresses-Addresses' class='list' action='{{servlet-context}}/list-addresses-Addresses' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='addresses'> <table caption='addresses'>
<thead> <thead>
<tr> <tr>
@ -87,7 +58,7 @@ longitude
<input id='longitude' type='number' name='longitude' value='{{ params.longitude }}'/> <input id='longitude' type='number' name='longitude' value='{{ params.longitude }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -125,30 +96,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-authorities-Authorities.html generated 2018-07-01T22:15:35.307Z by adl.to-selmer-templates. <!-- File list-authorities-Authorities.html generated 2018-07-03T12:23:51.893Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-authorities-Authority'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-authorities-Authority' class='big-link'>
Add a new Authority Add a new Authority
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-authorities-Authorities' class='list' action='{{servlet-context}}/list-authorities-Authorities' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='authorities'> <table caption='authorities'>
<thead> <thead>
<tr> <tr>
@ -69,7 +40,7 @@ authorize-uri
<input id='authorize_uri' type='text' name='authorize_uri' value='{{ params.authorize_uri }}'/> <input id='authorize_uri' type='text' name='authorize_uri' value='{{ params.authorize_uri }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -96,30 +67,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-canvassers-Canvassers.html generated 2018-07-01T22:15:35.398Z by adl.to-selmer-templates. <!-- File list-canvassers-Canvassers.html generated 2018-07-03T12:23:51.938Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-canvassers-Canvasser'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-canvassers-Canvasser' class='big-link'>
Add a new Canvasser Add a new Canvasser
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-canvassers-Canvassers' class='list' action='{{servlet-context}}/list-canvassers-Canvassers' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='canvassers'> <table caption='canvassers'>
<thead> <thead>
<tr> <tr>
@ -99,7 +70,7 @@ authorised
<input id='authorised' type='text' name='authorised' value='{{ params.authorised }}'/> <input id='authorised' type='text' name='authorised' value='{{ params.authorised }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -147,30 +118,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-districts-Districts.html generated 2018-07-01T22:15:35.384Z by adl.to-selmer-templates. <!-- File list-districts-Districts.html generated 2018-07-03T12:23:51.932Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-districts-District'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-districts-District' class='big-link'>
Add a new District Add a new District
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-districts-Districts' class='list' action='{{servlet-context}}/list-districts-Districts' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='districts'> <table caption='districts'>
<thead> <thead>
<tr> <tr>
@ -57,7 +28,7 @@ name
<input id='name' type='text' name='name' value='{{ params.name }}'/> <input id='name' type='text' name='name' value='{{ params.name }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -78,30 +49,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-dwellings-Dwellings.html generated 2018-07-01T22:15:35.361Z by adl.to-selmer-templates. <!-- File list-dwellings-Dwellings.html generated 2018-07-03T12:23:51.923Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-dwellings-Dwelling'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-dwellings-Dwelling' class='big-link'>
Add a new Dwelling Add a new Dwelling
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-dwellings-Dwellings' class='list' action='{{servlet-context}}/list-dwellings-Dwellings' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='dwellings'> <table caption='dwellings'>
<thead> <thead>
<tr> <tr>
@ -63,7 +34,7 @@ sub-address
<input id='sub_address' type='text' name='sub_address' value='{{ params.sub_address }}'/> <input id='sub_address' type='text' name='sub_address' value='{{ params.sub_address }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -89,30 +60,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-electors-Electors.html generated 2018-07-01T22:15:35.326Z by adl.to-selmer-templates. <!-- File list-electors-Electors.html generated 2018-07-03T12:23:51.906Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-electors-Elector'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-electors-Elector' class='big-link'>
Add a new Elector Add a new Elector
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-electors-Electors' class='list' action='{{servlet-context}}/list-electors-Electors' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='electors'> <table caption='electors'>
<thead> <thead>
<tr> <tr>
@ -81,7 +52,7 @@ gender
<input id='gender_expanded' type='text' name='gender_expanded' value='{{ params.gender_expanded }}'/> <input id='gender_expanded' type='text' name='gender_expanded' value='{{ params.gender_expanded }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -118,30 +89,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-followupactions-Followupactions.html generated 2018-07-01T22:15:35.396Z by adl.to-selmer-templates. <!-- File list-followupactions-Followupactions.html generated 2018-07-03T12:23:51.937Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-followupactions-Followupaction'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-followupactions-Followupaction' class='big-link'>
Add a new Followupaction Add a new Followupaction
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-followupactions-Followupactions' class='list' action='{{servlet-context}}/list-followupactions-Followupactions' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='followupactions'> <table caption='followupactions'>
<thead> <thead>
<tr> <tr>
@ -81,7 +52,7 @@ closed
<input id='closed' type='text' name='closed' value='{{ params.closed }}'/> <input id='closed' type='text' name='closed' value='{{ params.closed }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -118,30 +89,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-followupmethods-Followupmethods.html generated 2018-07-01T22:15:35.341Z by adl.to-selmer-templates. <!-- File list-followupmethods-Followupmethods.html generated 2018-07-03T12:23:51.912Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-followupmethods-Followupmethod'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-followupmethods-Followupmethod' class='big-link'>
Add a new Followupmethod Add a new Followupmethod
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-followupmethods-Followupmethods' class='list' action='{{servlet-context}}/list-followupmethods-Followupmethods' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='followupmethods'> <table caption='followupmethods'>
<thead> <thead>
<tr> <tr>
@ -51,7 +22,7 @@ id
<input id='id' type='text' name='id' value='{{ params.id }}'/> <input id='id' type='text' name='id' value='{{ params.id }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -69,30 +40,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-followuprequests-Followuprequests.html generated 2018-07-01T22:15:35.297Z by adl.to-selmer-templates. <!-- File list-followuprequests-Followuprequests.html generated 2018-07-03T12:23:51.889Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-followuprequests-Followuprequest'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-followuprequests-Followuprequest' class='big-link'>
Add a new Followuprequest Add a new Followuprequest
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-followuprequests-Followuprequests' class='list' action='{{servlet-context}}/list-followuprequests-Followuprequests' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='followuprequests'> <table caption='followuprequests'>
<thead> <thead>
<tr> <tr>
@ -75,7 +46,7 @@ method_id
<input id='method_id_expanded' type='text' name='method_id_expanded' value='{{ params.method_id_expanded }}'/> <input id='method_id_expanded' type='text' name='method_id_expanded' value='{{ params.method_id_expanded }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -113,30 +84,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-genders-Genders.html generated 2018-07-01T22:15:35.275Z by adl.to-selmer-templates. <!-- File list-genders-Genders.html generated 2018-07-03T12:23:51.883Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-genders-Gender'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-genders-Gender' class='big-link'>
Add a new Gender Add a new Gender
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-genders-Genders' class='list' action='{{servlet-context}}/list-genders-Genders' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='genders'> <table caption='genders'>
<thead> <thead>
<tr> <tr>
@ -51,7 +22,7 @@ id
<input id='id' type='text' name='id' value='{{ params.id }}'/> <input id='id' type='text' name='id' value='{{ params.id }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -69,30 +40,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-intentions-Intentions.html generated 2018-07-01T22:15:35.404Z by adl.to-selmer-templates. <!-- File list-intentions-Intentions.html generated 2018-07-03T12:23:51.940Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-intentions-Intention'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-intentions-Intention' class='big-link'>
Add a new Intention Add a new Intention
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-intentions-Intentions' class='list' action='{{servlet-context}}/list-intentions-Intentions' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='intentions'> <table caption='intentions'>
<thead> <thead>
<tr> <tr>
@ -69,7 +40,7 @@ locality
<input id='locality' type='number' name='locality' value='{{ params.locality }}'/> <input id='locality' type='number' name='locality' value='{{ params.locality }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -102,30 +73,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-issues-Issues.html generated 2018-07-01T22:15:35.386Z by adl.to-selmer-templates. <!-- File list-issues-Issues.html generated 2018-07-03T12:23:51.933Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-issues-Issue'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-issues-Issue' class='big-link'>
Add a new Issue Add a new Issue
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-issues-Issues' class='list' action='{{servlet-context}}/list-issues-Issues' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='issues'> <table caption='issues'>
<thead> <thead>
<tr> <tr>
@ -51,6 +22,9 @@ url
<th> <th>
current current
</th> </th>
<th>
brief
</th>
</tr> </tr>
<tr> <tr>
<th> <th>
@ -63,7 +37,10 @@ current
<input id='current' type='text' name='current' value='{{ params.current }}'/> <input id='current' type='text' name='current' value='{{ params.current }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input id='brief' type='text' name='brief' value='{{ params.brief }}'/>
</th>
<th>
<input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -80,6 +57,9 @@ current
{{ record.current }} {{ record.current }}
</td> </td>
<td> <td>
{{ record.brief }}
</td>
<td>
<a href='form-issues-Issue?id={{ record.id }}'> <a href='form-issues-Issue?id={{ record.id }}'>
View View
</a> </a>
@ -87,30 +67,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-options-Options.html generated 2018-07-01T22:15:35.300Z by adl.to-selmer-templates. <!-- File list-options-Options.html generated 2018-07-03T12:23:51.890Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-options-Option'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-options-Option' class='big-link'>
Add a new Option Add a new Option
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-options-Options' class='list' action='{{servlet-context}}/list-options-Options' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='options'> <table caption='options'>
<thead> <thead>
<tr> <tr>
@ -51,7 +22,7 @@ id
<input id='id' type='text' name='id' value='{{ params.id }}'/> <input id='id' type='text' name='id' value='{{ params.id }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -69,30 +40,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-roles-Roles.html generated 2018-07-01T22:15:35.338Z by adl.to-selmer-templates. <!-- File list-roles-Roles.html generated 2018-07-03T12:23:51.912Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-roles-Role'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-roles-Role' class='big-link'>
Add a new Role Add a new Role
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-roles-Roles' class='list' action='{{servlet-context}}/list-roles-Roles' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='roles'> <table caption='roles'>
<thead> <thead>
<tr> <tr>
@ -57,7 +28,7 @@ name
<input id='name' type='text' name='name' value='{{ params.name }}'/> <input id='name' type='text' name='name' value='{{ params.name }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -78,30 +49,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-teams-Teams.html generated 2018-07-01T22:15:35.287Z by adl.to-selmer-templates. <!-- File list-teams-Teams.html generated 2018-07-03T12:23:51.885Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-teams-Team'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-teams-Team' class='big-link'>
Add a new Team Add a new Team
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-teams-Teams' class='list' action='{{servlet-context}}/list-teams-Teams' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='teams'> <table caption='teams'>
<thead> <thead>
<tr> <tr>
@ -75,7 +46,7 @@ longitude
<input id='longitude' type='number' name='longitude' value='{{ params.longitude }}'/> <input id='longitude' type='number' name='longitude' value='{{ params.longitude }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -107,30 +78,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -1,44 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-visits-Visits.html generated 2018-07-01T22:15:35.283Z by adl.to-selmer-templates. <!-- File list-visits-Visits.html generated 2018-07-03T12:23:51.884Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).--> See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %} {% block content %}
<div> <form id='content' class='list'>
<div class='back-link-container'>
{% ifunequal params.offset "0" %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% else %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'> <div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'> <a href='form-visits-Visit'>
Next
</a>
</div>
<div class='big-link-container'>
<a href='form-visits-Visit' class='big-link'>
Add a new Visit Add a new Visit
</a> </a>
</div> </div>
</div>
{% endblock %}
{% block content %}
<form id='list-visits-Visits' class='list' action='{{servlet-context}}/list-visits-Visits' method='POST'>
{% csrf-field %}
<input id='offset' type='hidden' value='{{params.offset|default:0}}'/>
<input id='limit' type='hidden' value='{{params.limit|default:50}}'/>
<table caption='visits'> <table caption='visits'>
<thead> <thead>
<tr> <tr>
@ -69,7 +40,7 @@ date
<input id='date' type='date' name='date' value='{{ params.date }}'/> <input id='date' type='date' name='date' value='{{ params.date }}'/>
</th> </th>
<th> <th>
<input type='submit' id='search-widget' value='Search'/> <input type='submit' id='search' value='Search'/>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -100,30 +71,15 @@ View
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
<tfoot>
<div class='back-link-container'>
<input id='page' name='page' disabled='{% ifequal offset 0 %} false {% else %} true {% endifequal %}' value='Previous'/>
</div>
<div class='big-link-container'>
<input id='page' name='page' disabled='false' value='Next'/>
</div>
</tfoot>
</table> </table>
</form> </form>
{% endblock %} {% 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 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 %}

View file

@ -72,6 +72,8 @@
(-> #'auto-selmer-routes (-> #'auto-selmer-routes
(wrap-routes middleware/wrap-csrf) (wrap-routes middleware/wrap-csrf)
(wrap-routes middleware/wrap-formats)) (wrap-routes middleware/wrap-formats))
(-> #'auto-rest-routes
(wrap-routes middleware/wrap-formats))
(-> #'rest-routes (-> #'rest-routes
(wrap-routes middleware/wrap-formats)) (wrap-routes middleware/wrap-formats))
'oauth-routes 'oauth-routes

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
(ns ^{:doc "Routes which handle data transfer to/from the canvasser app." (ns ^{:doc "Manually maintained routes which handle data transfer to/from the canvasser app."
:author "Simon Brooke"} youyesyet.routes.rest :author "Simon Brooke"} youyesyet.routes.rest
(:require [clojure.core.memoize :as memo] (:require [clojure.core.memoize :as memo]
[clojure.java.io :as io] [clojure.java.io :as io]
@ -36,6 +36,7 @@
;;;; ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; See also src/clj/youyesyet/routes/auto-json.clj
(def in-get-local-data (def in-get-local-data
"Local data is volatile, because hopefully canvassers are updating it as they "Local data is volatile, because hopefully canvassers are updating it as they
@ -82,13 +83,8 @@
(in-get-local-data here))) (in-get-local-data here)))
(defn get-issues
"Get current issues. No arguments expected."
[request])
(defroutes rest-routes (defroutes rest-routes
(GET "/rest/get-local-data" request (get-local-data request)) (GET "/rest/get-local-data" request (route/restricted (get-local-data request)))
;; (GET "/rest/get-issues" request (route/restricted (get-issues request))) ;; (GET "/rest/get-issues" request (route/restricted (get-issues request)))
;; (GET "/rest/set-intention" request (route/restricted (set-intention request))) ;; (GET "/rest/set-intention" request (route/restricted (set-intention request)))
;; (GET "/rest/request-followup" request (route/restricted (request-followup request)))) ;; (GET "/rest/request-followup" request (route/restricted (request-followup request))))

View file

@ -1,10 +1,10 @@
(ns youyesyet.utils (ns youyesyet.utils
#?(:clj (require [clojure.tools.logging :as log])) #?(:clj (:require [clojure.tools.logging :as log])
) :cljs (:require [cljs.reader :refer [read-string]])))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ;;;;
;;;; youyesyet.locality: small utility functions. ;;;; youyesyet.utils: small utility functions.
;;;; ;;;;
;;;; This program is free software; you can redistribute it and/or ;;;; This program is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU General Public License ;;;; modify it under the terms of the GNU General Public License
@ -27,9 +27,11 @@
(defn coerce-to-number [v] (defn coerce-to-number [v]
"If it is possible to do so, coerce `v` to a number" "If it is possible to do so, coerce `v` to a number"
;; TODO: this doesn't work in cljs.
(if (number? v) v (if (number? v) v
(try (try
(read-string (str v)) (read-string (str v))
#?(:clj (catch Exception any #?(:clj (catch Exception any
(log/error (str "Could not coerce '" v "' to number: " any))) (log/error (str "Could not coerce '" v "' to number: " any)))
:cljs (js/console.log (str "Could not coerce '" v "' to number: " any)))))) :cljs (catch js/Object any
(js/console.log (str "Could not coerce '" v "' to number: " any)))))))

View file

@ -104,8 +104,10 @@
(if content [content] (if content [content]
[:div.error (str "No content in page " @(rf/subscribe [:page]))]) [:div.error (str "No content in page " @(rf/subscribe [:page]))])
[:footer [:footer
[:div.error {:style [:display (if error "block" "none")]} (str error)] [:div.error {:style [:display (if (empty? error) :none :block)]} (apply str error)]
[:div.feedback {:style [:display (if feedback :block :none)]} (str feedback)] [:div.feedback
{:style [:display (if (empty? feedback) :none :block)]}
(apply str (map #(h/feedback-messages %) (distinct feedback)))]
[:div.queue (if [:div.queue (if
(nil? outqueue) "" (nil? outqueue) ""
(str (count outqueue) " items queued to send"))]]])) (str (count outqueue) " items queued to send"))]]]))
@ -190,6 +192,9 @@
(defn init! [] (defn init! []
(rf/dispatch-sync [:initialize-db]) (rf/dispatch-sync [:initialize-db])
(h/get-current-location) (h/get-current-location)
(rf/dispatch [:fetch-locality])
(rf/dispatch [:fetch-options])
(rf/dispatch [:fetch-issues])
(load-interceptors!) (load-interceptors!)
(hook-browser-navigation!) (hook-browser-navigation!)
(mount-components)) (mount-components))

View file

@ -2,9 +2,12 @@
:author "Simon Brooke"} :author "Simon Brooke"}
youyesyet.canvasser-app.handlers youyesyet.canvasser-app.handlers
(:require [cljs.reader :refer [read-string]] (:require [cljs.reader :refer [read-string]]
[re-frame.core :refer [dispatch reg-event-db]] [cemerick.url :refer (url url-encode)]
[day8.re-frame.http-fx]
[re-frame.core :refer [dispatch reg-event-db reg-event-fx subscribe]]
[ajax.core :refer [GET]]
[ajax.json :refer [json-request-format json-response-format]]
[youyesyet.canvasser-app.state :as db] [youyesyet.canvasser-app.state :as db]
[youyesyet.utils :refer :all]
)) ))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -34,9 +37,47 @@
"Return a state like this state except with the error and feedback messages "Return a state like this state except with the error and feedback messages
set nil" set nil"
[state] [state]
(merge state {:error nil :feedback nil})) (merge state {:error '() :feedback '()}))
(def source-host (assoc
(url js/window.location)
:path "/"
:query nil
:anchor nil))
(def feedback-messages
{:fetch-locality "Fetching local data."
:send-request "Request has been queued."
})
(defn add-to-feedback
"Add the value of `k` in `feedback-messages` to the feedback in this `db`."
[db k]
(assoc db :feedback (cons k (:feedback db))))
(defn remove-from-feedback
"Remove the value of `k` in `feedback-messages` to the feedback in this `db`."
[db k]
(assoc db
:feedback
(remove
#(= % k)
(:feedback db))))
(defn coerce-to-number [v]
"If it is possible to do so, coerce `v` to a number.
NOTE: I tried to do this in *cljc*, but it did not work. Leave it alone."
(if (number? v) v
(try
(read-string (str v))
(catch js/Object any
(js/console.log (str "Could not coerce '" v "' to number: " any))
v))))
(defn get-elector (defn get-elector
@ -60,17 +101,250 @@
(:electors state) "'"))))) (:electors state) "'")))))
;; map stuff. If we do this in canvasser-app.views.map we get circular
;; references, so do it here.
(defn pin-image
"select the name of a suitable pin image for this address"
[address]
(let [intentions
(set
(remove
nil?
(map
:intention
(mapcat :electors
(:dwellings address)))))]
(case (count intentions)
0 "unknown-pin"
1 (str (name (first intentions)) "-pin")
"mixed-pin")))
(defn map-pin-click-handler
"On clicking on the pin, navigate to the electors at the address.
This way of doing it adds an antry in the browser location history,
so back links work."
[id]
(js/console.log (str "Click handler for address #" id))
(let [view @(subscribe [:view])
centre (.getCenter view)]
(dispatch [:set-zoom (.getZoom view)])
(dispatch [:set-latitude (.-lat centre)])
(dispatch [:set-longitude (.-lng centre)]))
(set! window.location.href (str "#building/" id)))
(defn add-map-pin
"Add a map-pin at this address in this map view"
[address view]
(let [lat (:latitude address)
lng (:longitude address)
pin (.icon js/L
(clj->js
{:iconAnchor [16 41]
:iconSize [32 42]
:iconUrl (str "img/map-pins/" (pin-image address) ".png")
:riseOnHover true
:shadowAnchor [16 23]
:shadowSize [57 24]
:shadowUrl "img/map-pins/shadow_pin.png"}))
marker (.marker js/L
(.latLng js/L lat lng)
(clj->js {:icon pin
:title (:address address)}))]
(.on (.addTo marker view) "click" (fn [_] (map-pin-click-handler (str (:id address)))))
marker))
(defn map-remove-pins
"Remove all pins from this map `view`. Side-effecty; liable to be problematic."
[view]
(try
(if
view
(.eachLayer
view
(fn [layer]
(if
(instance? layer js/L.Marker)
(.removeLayer view layer)))))
(catch js/Object any (js/console.log (str "Failed to remove pins from map: " any))))
view)
(defn refresh-map-pins
"Refresh the map pins on this map. Side-effecty; liable to be problematic."
[]
(let [view (map-remove-pins @(subscribe [:view]))
addresses @(subscribe [:addresses])]
(if
view
(do
(js/console.log (str "Adding " (count addresses) " pins"))
(doall (map #(add-map-pin % view) addresses)))
(js/console.log "View is not yet ready"))
view))
(reg-event-db (reg-event-db
:initialize-db :initialize-db
(fn [_ _] (fn [_ _]
db/default-db)) db/default-db))
(defn get-current-location []
"Get the current location from the device."
(try
(if (.-geolocation js/navigator)
(.getCurrentPosition
(.-geolocation js/navigator)
(fn [position]
(js/console.log "Current location is: " + position)
(dispatch [:set-latitude (.-latitude (.-coords position))])
(dispatch [:set-longitude (.-longitude (.-coords position))])))
(js/console.log "Geolocation not available"))
(catch js/Object any
(js/console.log "Exception while trying to access location: " + any))))
;; (reg-event-fx
;; :feedback
;; (fn [x y]
;; (js/console.log (str "Feedback event called with x = " x "; y = " y))
;; (:db x)))
;; (reg-event-fx
;; :issues
;; (fn [x y]
;; (js/console.log (str "Issues event called with x = " x "; y = " y))
;; (:db x)))
;; (reg-event-fx
;; :options
;; (fn [x y]
;; (js/console.log (str "Options event called with x = " x "; y = " y))
;; (:db x)))
;; (reg-event-fx
;; :event
;; (fn [x y]
;; (js/console.log (str "Event event called with x = " x "; y = " y))
;; (:db x)))
(reg-event-fx
:fetch-locality
(fn [{db :db} _]
(js/console.log "Fetching locality data")
;; we return a map of (side) effects
{:http-xhrio {:method :get
:uri (str source-host
"rest/get-local-data?latitude="
(:latitude db)
"&longitude="
(:longitude db))
:format (json-request-format)
:response-format (json-response-format {:keywords? true})
:on-success [:process-locality]
:on-failure [:bad-locality]}
:db (add-to-feedback db :fetch-locality)}))
(reg-event-db
:process-locality
(fn
[db [_ response]]
(js/console.log "Updating locality data")
(assoc
(remove-from-feedback db :fetch-locality)
(refresh-map-pins)
:addresses (js->clj response))))
(reg-event-db
:bad-locality
(fn [db _]
;; TODO: signal something has failed? It doesn't matter very much, unless it keeps failing.
(js/console.log "Failed to fetch locality data")
(assoc
(remove-from-feedback db :fetch-locality)
:error (cons :fetch-locality (:error db)))))
(reg-event-fx
:fetch-options
(fn [{db :db} _]
(js/console.log "Fetching options")
;; we return a map of (side) effects
{:http-xhrio {:method :get
:uri (str source-host "json/auto/list-options")
:format (json-request-format)
:response-format (json-response-format {:keywords? true})
:on-success [:process-options]
:on-failure [:bad-options]}
:db (add-to-feedback db :fetch-options)}))
(reg-event-db
:process-options
(fn
[db [_ response]]
(js/console.log "Updating options")
(assoc
(remove-from-feedback db :fetch-options)
:options (js->clj response))))
(reg-event-db
:bad-options
(fn [db _]
(js/console.log "Failed to fetch options")
(assoc
(remove-from-feedback db :fetch-options)
:error (cons :fetch-options (:error db)))))
(reg-event-fx
:fetch-issues
(fn [{db :db} _]
(js/console.log "Fetching issues")
;; we return a map of (side) effects
{:http-xhrio {:method :get
:uri (str source-host "json/auto/list-issues")
:format (json-request-format)
:response-format (json-response-format {:keywords? true})
:on-success [:process-issues]
:on-failure [:bad-issues]}
:db (add-to-feedback db :fetch-issues)}))
(reg-event-db
:process-issues
(fn
[db [_ response]]
(js/console.log "Updating issues")
(assoc
(remove-from-feedback db :fetch-issues)
:issues (js->clj response))))
(reg-event-db
:bad-issues
(fn [db _]
(js/console.log "Failed to fetch issues")
(assoc
(remove-from-feedback db :fetch-issues)
:error (cons :fetch-issues (:error db)))))
(reg-event-db (reg-event-db
:send-intention :send-intention
(fn [db [_ args]] (fn [db [_ args]]
(let [intention (:intention args) (let [intention (:intention args)
elector-id (coerce-to-number (:elector-id args)) elector-id (:elector-id args)
old-elector (first old-elector (first
(remove nil? (remove nil?
(map (map
@ -97,11 +371,11 @@
(:dwellings old-address))))] (:dwellings old-address))))]
(cond (cond
(nil? old-elector) (nil? old-elector)
(assoc db :error "No elector found; not setting intention") (assoc db :error (cons "No elector found; not setting intention" (:error db))
(= intention (:intention old-elector)) (= intention (:intention old-elector))
(do (do
(js/console.log "Elector's intention hasn't changed; not setting intention") (js/console.log "Elector's intention hasn't changed; not setting intention")
db) db))
true true
(do (do
(js/console.log (str "Setting intention of elector " old-elector " to " intention)) (js/console.log (str "Setting intention of elector " old-elector " to " intention))
@ -125,8 +399,7 @@
(if (and (:elector db) (:issue db) (:telephone db)) (if (and (:elector db) (:issue db) (:telephone db))
(do (do
(js/console.log "Sending request") (js/console.log "Sending request")
(assoc db (assoc (add-to-feedback db :send-request)
:feedback "Request has been queued"
:outqueue (cons :outqueue (cons
{:elector-id (:id (:elector db)) {:elector-id (:id (:elector db))
:issue (:issue db) :issue (:issue db)
@ -136,15 +409,16 @@
(reg-event-db (reg-event-db
:set-active-page :set-active-page
(fn [db [_ page]] (fn [db [_ k]]
(if page (if k
(assoc (clear-messages db) :page page)))) (assoc (clear-messages db) :page k)
db)))
(reg-event-db (reg-event-db
:set-address :set-address
(fn [db [_ address-id]] (fn [db [_ address-id]]
(let [id (coerce-to-number address-id) (let [id (coerce-to-number address-id)
address (first (remove nil? (map #(if (= id (:id %)) %) (:addresses db))))] address (first (remove nil? (map #(if (= id (:id %)) %) (:addresses db))))]
(if (if
(= (count (:dwellings address)) 1) (= (count (:dwellings address)) 1)
@ -167,7 +441,7 @@
consent (:consent args) consent (:consent args)
elector-id (coerce-to-number (:elector-id args)) elector-id (coerce-to-number (:elector-id args))
elector (get-elector elector-id db)] elector (get-elector elector-id db)]
(js/console.log (str "Setting page to " page ", consent to " consent " for " elector)) (js/console.log (str "Setting page to " page ", consent to " consent " for " (:name elector)))
(assoc (clear-messages db) :elector (assoc elector :consent true) :page page)))) (assoc (clear-messages db) :elector (assoc elector :consent true) :page page))))
@ -200,7 +474,7 @@
:set-elector-and-page :set-elector-and-page
(fn [db [_ args]] (fn [db [_ args]]
(let [page (:page args) (let [page (:page args)
elector-id (coerce-to-number (:elector-id args)) elector-id (:elector-id args)
elector (get-elector elector-id db)] elector (get-elector elector-id db)]
(js/console.log (str "Setting page to " page ", elector to " elector)) (js/console.log (str "Setting page to " page ", elector to " elector))
(assoc (clear-messages db) :elector elector :page page)))) (assoc (clear-messages db) :elector elector :page page))))
@ -252,18 +526,3 @@
(if (integer? zoom) (if (integer? zoom)
(assoc db :zoom zoom) (assoc db :zoom zoom)
db))) db)))
(defn get-current-location []
"Get the current location from the device."
(try
(if (.-geolocation js/navigator)
(.getCurrentPosition
(.-geolocation js/navigator)
(fn [position]
(js/console.log "Current location is: " + position)
(dispatch [:set-latitude (.-latitude (.-coords position))])
(dispatch [:set-longitude (.-longitude (.-coords position))])))
(js/console.log "Geolocation not available"))
(catch js/Object any
(js/console.log "Exception while trying to access location: " + any))))

View file

@ -29,59 +29,128 @@
;;; The atom gets updated by 'events' registered in handler.cljs, q.v. ;;; The atom gets updated by 'events' registered in handler.cljs, q.v.
(def default-db (def default-db
{;;; the currently selected address, if any. {
:address {:id 1 :address "13 Imaginary Terrace, IM1 3TE" :latitude 55.8253043 :longitude -4.2569057 :addresses
:dwellings [{:id 1 [{:locality 548223905,
:electors [{:id 1 :name "Alan Anderson" :gender :male :intention :no} :address
{:id 2 :name "Ann Anderson" :gender :female} "HAZELFIELD HOUSE, CASTLE DOUGLAS, DG7 1RF",
{:id 3 :name "Alex Anderson" :gender :fluid :intention :yes} :phone nil,
{:id 4 :name "Andy Anderson" :intention :yes}]}]} :postcode "DG7 1RF",
;;; a list of the addresses in the current location at which there :longitude -3.905045374625994,
;;; are electors registered. :district_id 1,
:addresses [{:id 1 :address "13 Imaginary Terrace, IM1 3TE" :latitude 55.8253043 :longitude -4.2570944 :dwellings
:dwellings [{:id 1 [{:address_id_expanded
:electors [{:id 1 :name "Alan Anderson" :gender :male :intention :no} "HAZELFIELD HOUSE, CASTLE DOUGLAS, DG7 1RF, DG7 1RF",
{:id 2 :name "Ann Anderson" :gender :female} :address_id 18,
{:id 3 :name "Alex Anderson" :gender :fluid :intention :yes} :sub_address "",
{:id 4 :name "Andy Anderson" :intention :yes}]}]} :id 17,
{:id 2 :address "15 Imaginary Terrace, IM1 3TE" :latitude 55.8252354 :longitude -4.2572778 :id_2 17,
:dwellings [{:id 2 :address_id_2 18,
:electors [{:id 5 :name "Beryl Brown" :gender :female} :sub_address_2 "",
{:id 6 :name "Betty Black" :gender :female}]}]} :electors
[{:email nil,
:dwelling_id_2 17,
:dwelling_id_expanded
"HAZELFIELD HOUSE, CASTLE DOUGLAS, DG7 1RF, DG7 1RF, ",
:intentions
[{:locality 548223905,
:visit_id_expanded
"HAZELFIELD HOUSE, CASTLE DOUGLAS, DG7 1RF, DG7 1RF, 2018-06-14 20:29:34.721522",
:option_id_expanded "Yes",
:option_id "Yes",
:option_id_2 "Yes",
:visit_id_2 1,
:elector_id_2 61,
:visit_id 1,
:elector_id 61,
:id 1,
:elector_id_expanded nil,
:id_2 1}],
:phone nil,
:phone_2 nil,
:gender_expanded "Female",
:name "Alice Sutherland",
:dwelling_id 17,
:id 61,
:gender "Female",
:gender_2 "Female",
:name_2 "Alice Sutherland",
:email_2 nil,
:id_2 61}
{:email nil,
:dwelling_id_2 17,
:dwelling_id_expanded
"HAZELFIELD HOUSE, CASTLE DOUGLAS, DG7 1RF, DG7 1RF, ",
:intentions [],
:phone nil,
:phone_2 nil,
:gender_expanded "Female",
:name "Charlie Sutherland",
:dwelling_id 17,
:id 62,
:gender "Female",
:gender_2 "Female",
:name_2 "Charlie Sutherland",
:email_2 nil,
:id_2 62}
{:email nil,
:dwelling_id_2 17,
:dwelling_id_expanded
"HAZELFIELD HOUSE, CASTLE DOUGLAS, DG7 1RF, DG7 1RF, ",
:intentions [],
:phone nil,
:phone_2 nil,
:gender_expanded "Male",
:name "Keith Sutherland",
:dwelling_id 17,
:id 64,
:gender "Male",
:gender_2 "Male",
:name_2 "Keith Sutherland",
:email_2 nil,
:id_2 64}
{:email nil,
:dwelling_id_2 17,
:dwelling_id_expanded
"HAZELFIELD HOUSE, CASTLE DOUGLAS, DG7 1RF, DG7 1RF, ",
:intentions [],
:phone nil,
:phone_2 nil,
:gender_expanded "Female",
:name "Lucy Sutherland",
:dwelling_id 17,
:id 63,
:gender "Female",
:gender_2 "Female",
:name_2 "Lucy Sutherland",
:email_2 nil,
:id_2 63}]}],
:id 18,
:latitude 54.8222716877376}]
{:id 3 :address "17 Imaginary Terrace, IM1 3TE" :latitude 55.825166 :longitude -4.257026 ;;; the currently selected address, if any.
:dwellings [{:id 3 :sub-address "Flat 1" :address nil
:electors [{:id 7 :name "Catriona Crathie" :gender :female :intention :yes}
{:id 8 :name "Colin Caruthers" :gender :male :intention :yes}
{:id 9 :name "Calum Crathie" :intention :yes}]}
{:id 4 :sub-address "Flat 2"
:electors [{:id 1 :name "David Dewar" :gender :male :intention :no}]}]}]
;;; electors at the currently selected dwelling ;;; electors at the currently selected dwelling
:electors [{:id 1 :name "Alan Anderson" :gender :male :intention :no} :electors nil
{:id 2 :name "Ann Anderson" :gender :female}
{:id 3 :name "Alex Anderson" :gender :fluid :intention :yes}
{:id 4 :name "Andy Anderson" :intention :yes}]
;;; any error to display ;;; any error to display
:error nil :error nil
;;; the issue from among the issues which is currently selected. ;;; the issue from among the issues which is currently selected.
;;; any confirmation message to display ;;; any confirmation message to display
:feedback nil :feedback '()
;;; the currently selected issue ;;; the currently selected issue
:issue "Currency" :issue nil
;;; the issues selected for the issues page on this day. ;;; the issues selected for the issues page on this day.
:issues {"Currency" "Scotland could keep the Pound, or use the Euro. But we could also set up a new currency of our own. Yada yada yada" :issues nil
"Monarchy" "Scotland could keep the Queen. This is an issue to be decided after independence. Yada yada yada"
"Defence" "Scotland will not have nuclear weapons, and will probably not choose to engage in far-off wars. But we could remain members of NATO"}
;;; message of the day ;;; message of the day
:motd "This is a test version only. There is no real data." :motd "This is a test version only. There is no real data."
;;; the options from among which electors can select. ;;; the options from among which electors can select.
:options [{:id :yes :description "Yes"} {:id :no :description "No"}] :options nil
;;; the queue of items waiting to be transmitted. ;;; the queue of items waiting to be transmitted.
:outqueue () :outqueue ()
;;; the currently displayed page within the app. ;;; the currently displayed page within the app.
:page :home :page :home
:view nil :view nil
:latitude 55.82 :latitude 54.82
:longitude -4.25 :longitude -3.90
:zoom 12}) :zoom 12})

View file

@ -37,15 +37,16 @@
[:div.back-link-container {:key (gensym "back-link")} [:div.back-link-container {:key (gensym "back-link")}
[:a.back-link {:href target} "Back"]])) [:a.back-link {:href target} "Back"]]))
(defn big-link (defn big-link
[text & {:keys [target handler]}] [text & {:keys [target handler]}]
(js/console.log (str "Constructing big link; target is '" target "'; handler is '" handler "'"))
[:div.big-link-container {:key (gensym "big-link")} [:div.big-link-container {:key (gensym "big-link")}
[:a.big-link (merge [:a.big-link (merge
(if target {:href target}{}) (if target {:href target}{})
(if handler {:on-click handler}{})) (if handler {:on-click handler}{}))
text]]) text]])
(defn nav-link [uri title page collapsed?] (defn nav-link [uri title page collapsed?]
(let [selected-page @(rf/subscribe [:page])] (let [selected-page @(rf/subscribe [:page])]
[:li.nav-item [:li.nav-item

View file

@ -50,12 +50,10 @@
(defn gender-cell (defn gender-cell
[elector] [elector]
(let [gender (:gender elector) (let [gender (:gender elector)
image (if gender (name gender) "unknown")] image (if gender (name gender) "Unknown")]
[:td {:key (str "gender-" (:id elector))} [:td {:key (str "gender-" (:id elector))}
[:a {:href (str "#gdpr/" (:id elector))} [:a {:href (str "#gdpr/" (:id elector))}
[:img {:src (str "img/gender/" image ".png") :alt image [:img {:src (str "img/gender/" image ".png") :alt image}]]]))
;; :on-click #(go-to-gdpr-for-elector elector)
}]]]))
(defn genders-row (defn genders-row

View file

@ -70,7 +70,7 @@
[elector] [elector]
[:tr [:tr
[:td {:key (:id elector)} [:td {:key (:id elector)}
[:a {:href (str "#/issues/" (:id elector))} [:a {:href (str "#issues/" (:id elector))}
[:img {:src "img/issues.png" :alt "Issues"}]]]]) [:img {:src "img/issues.png" :alt "Issues"}]]]])

View file

@ -38,14 +38,13 @@
(defn panel (defn panel
"Generate the issue panel." "Generate the issue panel."
[] []
(let [issue @(subscribe [:issue]) (let [issue @(subscribe [:issue])]
issues @(subscribe [:issues])]
[:div [:div
[:h1 issue] [:h1 (:id issue)]
[:div.container {:id "main-container"} [:div.container {:id "main-container"}
[:div {:id "issue"} [:div {:id "issue"}
[:div {:id "issue-text" [:div {:id "issue-text"
:dangerouslySetInnerHTML :dangerouslySetInnerHTML
{:__html (md->html (issues issue))}}]] {:__html (md->html (:brief issue))}}]]
(ui/big-link "Request call" :target "#/followup") (ui/big-link "Request call" :target "#/followup")
(ui/back-link)]])) (ui/back-link)]]))

View file

@ -46,5 +46,5 @@
[:div.container {:id "main-container"} [:div.container {:id "main-container"}
(ui/back-link) (ui/back-link)
[:div {:id "issue-list"} [:div {:id "issue-list"}
(map (fn [k] (ui/big-link k :target (str "#/issue/" k))) (keys issues))]]] (map (fn [i] (ui/big-link (:id i) :target (str "#issue/" (:id i)))) issues)]]]
(ui/error-panel "No issues loaded")))) (ui/error-panel "No issues loaded"))))

View file

@ -1,9 +1,9 @@
(ns ^{:doc "Canvasser app map view panel." (ns ^{:doc "Canvasser app map view panel."
:author "Simon Brooke"} :author "Simon Brooke"}
youyesyet.canvasser-app.views.map youyesyet.canvasser-app.views.map
(:require [re-frame.core :refer [reg-sub subscribe dispatch]] (:require [re-frame.core :refer [reg-sub subscribe dispatch dispatch-sync]]
[reagent.core :as reagent] [reagent.core :as reagent]
[youyesyet.canvasser-app.handlers :refer [get-current-location]])) [youyesyet.canvasser-app.handlers :refer [get-current-location refresh-map-pins]]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ;;;;
@ -54,66 +54,6 @@
(def osm-url "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png") (def osm-url "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png")
(def osm-attrib "Map data &copy; <a href='http://openstreetmap.org'>OpenStreetMap</a> contributors") (def osm-attrib "Map data &copy; <a href='http://openstreetmap.org'>OpenStreetMap</a> contributors")
(defn pin-image
"select the name of a suitable pin image for this address"
[address]
(let [intentions
(set
(remove
nil?
(map
:intention
(mapcat :electors
(:dwellings address)))))]
(case (count intentions)
0 "unknown-pin"
1 (str (name (first intentions)) "-pin")
"mixed-pin")))
(defn map-pin-click-handler
"On clicking on the pin, navigate to the electors at the address.
This way of doing it adds an antry in the browser location history,
so back links work."
[id]
(js/console.log (str "Click handler for address #" id))
(let [view @(subscribe [:view])
centre (.getCenter view)]
(dispatch [:set-zoom (.getZoom view)])
(dispatch [:set-latitude (.-lat centre)])
(dispatch [:set-longitude (.-lng centre)]))
(set! window.location.href (str "#building/" id)))
;; This way is probably more idiomatic React, but history doesn't work:
;; (defn map-pin-click-handler
;; [id]
;; (dispatch [:set-address id]))
(defn add-map-pin
"Add a map-pin at this address in this map view"
[address view]
(let [lat (:latitude address)
lng (:longitude address)
pin (.icon js/L
(clj->js
{:iconAnchor [16 41]
:iconSize [32 42]
:iconUrl (str "img/map-pins/" (pin-image address) ".png")
:riseOnHover true
:shadowAnchor [16 23]
:shadowSize [57 24]
:shadowUrl "img/map-pins/shadow_pin.png"}))
marker (.marker js/L
(.latLng js/L lat lng)
(clj->js {:icon pin
:title (:address address)}))
]
(.on (.addTo marker view) "click" (fn [_] (map-pin-click-handler (str (:id address)))))
))
;; My gods mapbox is user-hostile! ;; My gods mapbox is user-hostile!
(defn map-did-mount-mapbox (defn map-did-mount-mapbox
"Did-mount function loading map tile data from MapBox (proprietary)." "Did-mount function loading map tile data from MapBox (proprietary)."
@ -123,8 +63,8 @@
;; NEED TO REPLACE FIXME with your mapID! ;; NEED TO REPLACE FIXME with your mapID!
(.addTo (.tileLayer js/L "http://{s}.tiles.mapbox.com/v3/FIXME/{z}/{x}/{y}.png" (.addTo (.tileLayer js/L "http://{s}.tiles.mapbox.com/v3/FIXME/{z}/{x}/{y}.png"
(clj->js {:attribution "Map data &copy; [...]" (clj->js {:attribution "Map data &copy; [...]"
:maxZoom 18})) :maxZoom 18})))
view))) view))
(defn map-did-mount-osm (defn map-did-mount-osm
@ -132,28 +72,24 @@
[] []
(get-current-location) (get-current-location)
(let [view (.setView (let [view (.setView
(.map js/L "map" (clj->js {:zoomControl false})) (.map js/L
"map"
(clj->js {:zoomControl false}))
#js [@(subscribe [:latitude]) @(subscribe [:longitude])] #js [@(subscribe [:latitude]) @(subscribe [:longitude])]
@(subscribe [:zoom])) @(subscribe [:zoom]))]
addresses @(subscribe [:addresses])] (dispatch-sync [:set-view view])
(js/console.log (str "Adding " (count addresses) " pins")) (refresh-map-pins)
(doall (map #(add-map-pin % view) addresses))
(.addTo (.tileLayer js/L osm-url
(clj->js {:attribution osm-attrib
:maxZoom 18}))
view)
(dispatch [:set-view view])
view)) view))
(defn map-did-mount (defn map-did-mount
"Select the actual map provider to use." "Select the actual map provider to use."
[] []
(case *map-provider* (dispatch-sync [:set-view (case *map-provider*
:mapbox (map-did-mount-mapbox) :mapbox (map-did-mount-mapbox)
:osm (map-did-mount-osm)) :osm (map-did-mount-osm)
;; potentially others ;; potentially others
) )]))
(defn map-render (defn map-render

View file

@ -290,8 +290,11 @@
<property name="current" type="boolean" default="true"> <property name="current" type="boolean" default="true">
<prompt prompt="Is current?" locale="en-GB"/> <prompt prompt="Is current?" locale="en-GB"/>
</property> </property>
<list properties="listed" name="Issues"><field property="id"><prompt prompt="id" locale="en-GB"/></field><field property="url"><prompt prompt="url" locale="en-GB"/></field><field property="current"><prompt prompt="Is current?" locale="en-GB"/></field></list> <property type="text" name="brief">
<form properties="listed" name="Issue"><field property="id"><prompt prompt="id" locale="en-GB"/></field><field property="url"><prompt prompt="url" locale="en-GB"/></field><field property="current"><prompt prompt="Is current?" locale="en-GB"/></field></form> <prompt prompt="Brief response to issue" locale="en-GB"/>
</property>
<list properties="listed" name="Issues"><field property="id"><prompt prompt="id" locale="en-GB"/></field><field property="url"><prompt prompt="url" locale="en-GB"/></field><field property="current"><prompt prompt="Is current?" locale="en-GB"/></field><field property="brief"><prompt prompt="Brief response to issue" locale="en-GB"/></field></list>
<form properties="listed" name="Issue"><field property="id"><prompt prompt="id" locale="en-GB"/></field><field property="url"><prompt prompt="url" locale="en-GB"/></field><field property="current"><prompt prompt="Is current?" locale="en-GB"/></field><field property="brief"><prompt prompt="Brief response to issue" locale="en-GB"/></field></form>
<permission group="canvassers" permission="read"/> <permission group="canvassers" permission="read"/>
<permission group="teamorganisers" permission="read"/> <permission group="teamorganisers" permission="read"/>
<permission group="issueexperts" permission="read"/> <permission group="issueexperts" permission="read"/>