Tactical commit; much progress but not ready for release.

This commit is contained in:
Simon Brooke 2018-07-07 10:21:09 +01:00
parent fc2bd86cff
commit 0026218993
61 changed files with 2920 additions and 1031 deletions

3
.gitignore vendored
View file

@ -23,5 +23,8 @@ pom.xml.asc
profiles\.clj profiles\.clj
.bowerrc .bowerrc
bower.json bower.json
.idea
src/clj/youyesyet/scratchpad\.clj src/clj/youyesyet/scratchpad\.clj
*.iml

View file

@ -3,4 +3,5 @@
;; when :nrepl-port is set the application starts the nREPL server on load ;; when :nrepl-port is set the application starts the nREPL server on load
:nrepl-port 7000 :nrepl-port 7000
:site-title "Project Hope" :site-title "Project Hope"
:site-logo "img/ProjectHopeLogo.png"} :site-logo "img/ProjectHopeLogo.png"
:motd "motd.md"}

9
resources/motd.md Normal file
View file

@ -0,0 +1,9 @@
## Welcome to Project Hope
### Alpha test code
This is a voter intention information system intended to be used by the 'Yes' side in the next Scottish independence referendum.
Design documentation is [here](https://github.com/simon-brooke/youyesyet/blob/master/doc/specification/userspec.md).
Although addresses in the database mostly are real, all personal data in the database is randomly generated and does not represent real people.

View file

@ -1,7 +1,7 @@
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- File queries.sql -- File queries.sql
-- --
-- autogenerated by adl.to-hugsql-queries at 2018-07-05T10:14:16.954Z -- autogenerated by adl.to-hugsql-queries at 2018-07-07T08:09:48.253Z
-- --
-- See [Application Description -- See [Application Description
-- Language](https://github.com/simon-brooke/adl). -- Language](https://github.com/simon-brooke/adl).
@ -45,6 +45,8 @@ returning id
-- :doc creates a new canvasser record -- :doc creates a new canvasser record
INSERT INTO canvassers (username, INSERT INTO canvassers (username,
fullname, fullname,
avatar,
bio,
elector_id, elector_id,
address_id, address_id,
phone, phone,
@ -53,6 +55,8 @@ INSERT INTO canvassers (username,
authorised) authorised)
VALUES (:username, VALUES (:username,
:fullname, :fullname,
:avatar,
:bio,
:elector_id, :elector_id,
:address_id, :address_id,
:phone, :phone,
@ -89,6 +93,20 @@ VALUES (:name,
:gender) :gender)
returning id returning id
-- :name create-event! :! :n
-- :doc creates a new event record
INSERT INTO events (name,
date,
time,
decription,
cancelled)
VALUES (:name,
:date,
:time,
:decription,
:cancelled)
returning id
-- :name create-followupaction! :! :n -- :name create-followupaction! :! :n
-- :doc creates a new followupaction record -- :doc creates a new followupaction record
INSERT INTO followupactions (request_id, INSERT INTO followupactions (request_id,
@ -137,7 +155,7 @@ VALUES (:visit_id,
:elector_id, :elector_id,
:option_id, :option_id,
:locality) :locality)
returning Id returning id
-- :name create-issue! :! :n -- :name create-issue! :! :n
-- :doc creates a new issue record -- :doc creates a new issue record
@ -215,6 +233,11 @@ WHERE dwellings.id = :id
DELETE FROM electors DELETE FROM electors
WHERE electors.id = :id WHERE electors.id = :id
-- :name delete-event! :! :n
-- :doc updates an existing event record
DELETE FROM events
WHERE events.id = :id
-- :name delete-followupaction! :! :n -- :name delete-followupaction! :! :n
-- :doc updates an existing followupaction record -- :doc updates an existing followupaction record
DELETE FROM followupactions DELETE FROM followupactions
@ -238,7 +261,7 @@ WHERE genders.id = :id
-- :name delete-intention! :! :n -- :name delete-intention! :! :n
-- :doc updates an existing intention record -- :doc updates an existing intention record
DELETE FROM intentions DELETE FROM intentions
WHERE intentions.Id = :Id WHERE intentions.id = :id
-- :name delete-issue! :! :n -- :name delete-issue! :! :n
-- :doc updates an existing issue record -- :doc updates an existing issue record
@ -325,6 +348,15 @@ ORDER BY electors.name,
electors.gender, electors.gender,
electors.id electors.id
-- :name get-event :? :1
-- :doc selects an existing event record
SELECT * FROM events
WHERE events.id = :id
ORDER BY events.name,
events.date,
events.time,
events.id
-- :name get-followupaction :? :1 -- :name get-followupaction :? :1
-- :doc selects an existing followupaction record -- :doc selects an existing followupaction record
SELECT * FROM followupactions SELECT * FROM followupactions
@ -355,7 +387,7 @@ WHERE genders.id = :id
-- :name get-intention :? :1 -- :name get-intention :? :1
-- :doc selects an existing intention record -- :doc selects an existing intention record
SELECT * FROM intentions SELECT * FROM intentions
WHERE intentions.Id = :Id WHERE intentions.id = :id
-- :name get-issue :? :1 -- :name get-issue :? :1
-- :doc selects an existing issue record -- :doc selects an existing issue record
@ -475,9 +507,9 @@ ORDER BY lv_canvassers.username,
-- :name list-canvassers-by-role :? :* -- :name list-canvassers-by-role :? :*
-- :doc links all existing canvasser records related to a given role -- :doc links all existing canvasser records related to a given role
SELECT * SELECT *
FROM canvassers, ln_canvassers_roles FROM canvassers, ln_roles_canvassers_roles
WHERE canvassers.id = ln_canvassers_roles.canvasser_id WHERE canvassers.id = ln_roles_canvassers_roles.canvasser_id
AND ln_canvassers_roles.role_id = :id AND ln_roles_canvassers_roles.role_id = :id
ORDER BY canvassers.username, ORDER BY canvassers.username,
canvassers.fullname, canvassers.fullname,
canvassers.address_id, canvassers.address_id,
@ -547,6 +579,27 @@ ORDER BY lv_electors.name,
lv_electors.gender, lv_electors.gender,
lv_electors.id lv_electors.id
-- :name list-events :? :*
-- :doc lists all existing event records
SELECT DISTINCT * FROM lv_events
ORDER BY lv_events.name,
lv_events.date,
lv_events.time,
lv_events.id
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-- :name list-events-by-team :? :*
-- :doc links all existing event records related to a given team
SELECT *
FROM events, ln_teams_events_teams
WHERE events.id = ln_teams_events_teams.event_id
AND ln_teams_events_teams.team_id = :id
ORDER BY events.name,
events.date,
events.time,
events.id
-- :name list-followupactions :? :* -- :name list-followupactions :? :*
-- :doc lists all existing followupaction records -- :doc lists all existing followupaction records
SELECT DISTINCT * FROM lv_followupactions SELECT DISTINCT * FROM lv_followupactions
@ -652,21 +705,21 @@ SELECT DISTINCT * FROM lv_intentions
-- :doc lists all existing intention records related to a given elector -- :doc lists all existing intention records related to a given elector
SELECT * SELECT *
FROM lv_intentions, intentions FROM lv_intentions, intentions
WHERE lv_intentions.Id = intentions.Id WHERE lv_intentions.id = intentions.id
AND intentions.elector_id = :id AND intentions.elector_id = :id
-- :name list-intentions-by-option :? :* -- :name list-intentions-by-option :? :*
-- :doc lists all existing intention records related to a given option -- :doc lists all existing intention records related to a given option
SELECT * SELECT *
FROM lv_intentions, intentions FROM lv_intentions, intentions
WHERE lv_intentions.Id = intentions.Id WHERE lv_intentions.id = intentions.id
AND intentions.option_id = :id AND intentions.option_id = :id
-- :name list-intentions-by-visit :? :* -- :name list-intentions-by-visit :? :*
-- :doc lists all existing intention records related to a given visit -- :doc lists all existing intention records related to a given visit
SELECT * SELECT *
FROM lv_intentions, intentions FROM lv_intentions, intentions
WHERE lv_intentions.Id = intentions.Id WHERE lv_intentions.id = intentions.id
AND intentions.visit_id = :id AND intentions.visit_id = :id
-- :name list-issues :? :* -- :name list-issues :? :*
@ -692,9 +745,9 @@ ORDER BY lv_roles.name,
-- :name list-roles-by-canvasser :? :* -- :name list-roles-by-canvasser :? :*
-- :doc links all existing role records related to a given canvasser -- :doc links all existing role records related to a given canvasser
SELECT * SELECT *
FROM roles, ln_canvassers_roles FROM roles, ln_members_roles_canvassers
WHERE roles.id = ln_canvassers_roles.role_id WHERE roles.id = ln_members_roles_canvassers.role_id
AND ln_canvassers_roles.canvasser_id = :id AND ln_members_roles_canvassers.canvasser_id = :id
ORDER BY roles.name, ORDER BY roles.name,
roles.id roles.id
@ -709,9 +762,9 @@ ORDER BY lv_teams.name,
-- :name list-teams-by-canvasser :? :* -- :name list-teams-by-canvasser :? :*
-- :doc links all existing team records related to a given canvasser -- :doc links all existing team records related to a given canvasser
SELECT * SELECT *
FROM teams, ln_canvassers_teams FROM teams, ln_organisers_teams_canvassers
WHERE teams.id = ln_canvassers_teams.team_id WHERE teams.id = ln_organisers_teams_canvassers.team_id
AND ln_canvassers_teams.canvasser_id = :id AND ln_organisers_teams_canvassers.canvasser_id = :id
ORDER BY teams.name, ORDER BY teams.name,
teams.id teams.id
@ -790,6 +843,8 @@ SELECT DISTINCT * FROM lv_canvassers
WHERE false WHERE false
--~ (if (:username params) "OR username LIKE '%:username%'") --~ (if (:username params) "OR username LIKE '%:username%'")
--~ (if (:fullname params) "OR fullname LIKE '%:fullname%'") --~ (if (:fullname params) "OR fullname LIKE '%:fullname%'")
--~ (if (:avatar params) "OR avatar = :avatar")
--~ (if (:bio params) "OR bio LIKE '%:bio%'")
--~ (if (:elector_id params) "OR elector_id = :elector_id") --~ (if (:elector_id params) "OR elector_id = :elector_id")
--~ (if (:address_id params) "OR address_id = :address_id") --~ (if (:address_id params) "OR address_id = :address_id")
--~ (if (:phone params) "OR phone LIKE '%:phone%'") --~ (if (:phone params) "OR phone LIKE '%:phone%'")
@ -848,6 +903,23 @@ ORDER BY lv_electors.name,
--~ (if (:offset params) "OFFSET :offset ") --~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100") --~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-- :name search-strings-events :? :1
-- :doc selects existing event records having any string field matching the parameter of the same name by substring match
SELECT DISTINCT * FROM lv_events
WHERE false
--~ (if (:name params) "OR name LIKE '%:name%'")
--~ (if (:date params) "OR date = ':date'")
--~ (if (:time params) "OR time = ':time'")
--~ (if (:decription params) "OR decription LIKE '%:decription%'")
--~ (if (:cancelled params) "OR cancelled = :cancelled")
--~ (if (:id params) "OR id = :id")
ORDER BY lv_events.name,
lv_events.date,
lv_events.time,
lv_events.id
--~ (if (:offset params) "OFFSET :offset ")
--~ (if (:limit params) "LIMIT :limit" "LIMIT 100")
-- :name search-strings-followupactions :? :1 -- :name search-strings-followupactions :? :1
-- :doc selects existing followupaction records having any string field matching the parameter of the same name by substring match -- :doc selects existing followupaction records having any string field matching the parameter of the same name by substring match
SELECT DISTINCT * FROM lv_followupactions SELECT DISTINCT * FROM lv_followupactions
@ -904,7 +976,7 @@ WHERE false
--~ (if (:elector_id params) "OR elector_id = :elector_id") --~ (if (:elector_id params) "OR elector_id = :elector_id")
--~ (if (:option_id params) "OR option_id LIKE '%:option_id%'") --~ (if (:option_id params) "OR option_id LIKE '%:option_id%'")
--~ (if (:locality params) "OR locality = :locality") --~ (if (:locality params) "OR locality = :locality")
--~ (if (:Id params) "OR Id = :Id") --~ (if (:id params) "OR id = :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")
@ -994,6 +1066,8 @@ WHERE authorities.id = :id
UPDATE canvassers UPDATE canvassers
SET username = :username, SET username = :username,
fullname = :fullname, fullname = :fullname,
avatar = :avatar,
bio = :bio,
elector_id = :elector_id, elector_id = :elector_id,
address_id = :address_id, address_id = :address_id,
phone = :phone, phone = :phone,
@ -1025,6 +1099,16 @@ SET name = :name,
gender = :gender gender = :gender
WHERE electors.id = :id WHERE electors.id = :id
-- :name update-event! :! :n
-- :doc updates an existing event record
UPDATE events
SET name = :name,
date = :date,
time = :time,
decription = :decription,
cancelled = :cancelled
WHERE events.id = :id
-- :name update-followupaction! :! :n -- :name update-followupaction! :! :n
-- :doc updates an existing followupaction record -- :doc updates an existing followupaction record
UPDATE followupactions UPDATE followupactions
@ -1063,7 +1147,7 @@ SET visit_id = :visit_id,
elector_id = :elector_id, elector_id = :elector_id,
option_id = :option_id, option_id = :option_id,
locality = :locality locality = :locality
WHERE intentions.Id = :Id WHERE intentions.id = :id
-- :name update-issue! :! :n -- :name update-issue! :! :n
-- :doc updates an existing issue record -- :doc updates an existing issue record

View file

@ -0,0 +1,65 @@
insert into canvassers (username, fullname, elector_id, address_id, authority_id)
values ('test_admin', 'Michael Thomson', 14, 4, 'Twitter');
insert into canvassers (username, fullname, elector_id, address_id, authority_id)
values ('test_analyst', 'Jack Lang', 13, 4, 'Twitter');
insert into canvassers (username, fullname, elector_id, address_id, authority_id)
values ('test_canvasser', 'Catriona Lang', 12, 4, 'Twitter');
insert into canvassers (username, fullname, elector_id, address_id, authority_id)
values ('test_editor', 'Ursula Lang', 11, 4, 'Twitter');
insert into canvassers (username, fullname, elector_id, address_id, authority_id)
values ('test_expert', 'Charlie Gourlay', 18, 5, 'Twitter');
insert into canvassers (username, fullname, elector_id, address_id, authority_id)
values ('test_organiser', 'Jude Morrison', 15, 5, 'Twitter');
insert into ln_members_roles_canvassers
values (1, (select id from canvassers where username='test_admin'));
insert into ln_members_roles_canvassers
values (2, (select id from canvassers where username='test_analyst'));
insert into ln_members_roles_canvassers
values (3, (select id from canvassers where username='test_editor'));
insert into ln_members_roles_canvassers
values (4, (select id from canvassers where username='test_organiser'));
insert into ln_members_roles_canvassers
values (5, (select id from canvassers where username='test_expert'));
insert into ln_members_roles_canvassers
values (6, (select id from canvassers where username='test_canvasser'));
insert into teams (name, district_id, latitude, longitude)
values ('Yes Stewartry', 1, 54.94, -3.94);
insert into ln_members_teams_canvassers
values (
(select id from teams where name='Yes Stewartry'),
(select id from canvassers where username='test_admin'));
insert into ln_members_teams_canvassers
values (
(select id from teams where name='Yes Stewartry'),
(select id from canvassers where username='test_analyst'));
insert into ln_members_teams_canvassers
values (
(select id from teams where name='Yes Stewartry'),
(select id from canvassers where username='test_editor'));
insert into ln_members_teams_canvassers
values (
(select id from teams where name='Yes Stewartry'),
(select id from canvassers where username='test_organiser'));
insert into ln_members_teams_canvassers
values (
(select id from teams where name='Yes Stewartry'),
(select id from canvassers where username='test_expert'));
insert into ln_members_teams_canvassers
values (
(select id from teams where name='Yes Stewartry'),
(select id from canvassers where username='test_canvasser'));

View file

@ -5,23 +5,19 @@
-- --
-- auto-generated by [Application Description Language framework] -- auto-generated by [Application Description Language framework]
-- --
-- (https://github.com/simon-brooke/adl) at 20180705T101417.868Z -- (https://github.com/simon-brooke/adl) at 20180707T080949.294Z
--
--
-- A web-app intended to be used by canvassers campaigning for a
-- 'Yes' vote in the second independence referendum.
--
-- The web-app will be delivered to canvassers out knocking doors
-- primarily through an HTML5/React single-page app designed to work on a
-- mobile phone; it's possible that someone else may do an Android of
-- iPhone native app to address the same back end but at present I have
-- no plans for this.
--
-- There must also be an administrative interface through which
-- privileged users can set the system up and authorise canvassers, and a
-- 'followup' interface through which issue-expert specialist canvassers
-- can address particular electors' queries.
-- --
-- A web-app intended to be used by canvassers
-- campaigning for a 'Yes' vote in the second independence
-- referendum. The web-app will be delivered to canvassers out
-- knocking doors primarily through an HTML5/React single-page app
-- designed to work on a mobile phone; it's possible that someone
-- else may do an Android of iPhone native app to address the same
-- back end but at present I have no plans for this. There must also
-- be an administrative interface through which privileged users can
-- set the system up and authorise canvassers, and a 'followup'
-- interface through which issue-expert specialist canvassers can
-- address particular electors' queries.
------------------------------------------------------------------------ ------------------------------------------------------------------------
------------------------------------------------------------------------ ------------------------------------------------------------------------
@ -69,7 +65,8 @@ CREATE GROUP teamorganisers;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table addresses for entity addresses -- primary table addresses for entity addresses
-- --
-- Addresses of all buildings which contain dwellings. -- Addresses of all buildings which contain
-- dwellings.
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE addresses CREATE TABLE addresses
( (
@ -95,7 +92,8 @@ GRANT DELETE ON addresses TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table authorities for entity authorities -- primary table authorities for entity authorities
-- --
-- Authorities which may authenticate canvassers to the system. -- Authorities which may authenticate canvassers to
-- the system.
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE authorities CREATE TABLE authorities
( (
@ -119,13 +117,16 @@ GRANT DELETE ON authorities TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table canvassers for entity canvassers -- primary table canvassers for entity canvassers
-- --
-- Primary users of the system: those actually interviewing electors. -- Primary users of the system: those actually
-- interviewing electors.
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE canvassers CREATE TABLE canvassers
( (
id SERIAL NOT NULL PRIMARY KEY, id SERIAL NOT NULL PRIMARY KEY,
username VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL,
fullname VARCHAR(64) NOT NULL, fullname VARCHAR(64) NOT NULL,
avatar VARCHAR(),
bio TEXT,
elector_id INTEGER, elector_id INTEGER,
address_id INTEGER NOT NULL, address_id INTEGER NOT NULL,
phone VARCHAR(16), phone VARCHAR(16),
@ -150,8 +151,9 @@ GRANT DELETE ON canvassers TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table districts for entity districts -- primary table districts for entity districts
-- --
-- Electoral districts: TODO: Shape (polygon) information will need to be -- Electoral districts: TODO: Shape (polygon)
-- added, for use in maps. -- information will need to be added, for use in
-- maps.
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE districts CREATE TABLE districts
( (
@ -172,15 +174,12 @@ GRANT DELETE ON districts TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table dwellings for entity dwellings -- primary table dwellings for entity dwellings
-- --
-- All dwellings within addresses in the system; a dwelling is a -- All dwellings within addresses in the system; a
-- house, flat or appartment in which electors live. Every address -- dwelling is a house, flat or appartment in which electors live.
-- should have -- Every address should have at least one dwelling; essentially,
-- at least one dwelling; essentially, an address maps onto a -- an address maps onto a street door and dwellings map onto
-- street door and -- what's behind that door. So a tenement or a block of flats
-- dwellings map onto what's behind that door. So a tenement or a -- would be one address with many dwellings.
-- block of flats
-- would be one address with many dwellings.
--
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE dwellings CREATE TABLE dwellings
( (
@ -201,8 +200,9 @@ GRANT DELETE ON dwellings TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table electors for entity electors -- primary table electors for entity electors
-- --
-- All electors known to the system; electors are people believed to be -- All electors known to the system; electors are
-- entitled to vote in the current campaign. -- people believed to be entitled to vote in the current
-- campaign.
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE electors CREATE TABLE electors
( (
@ -223,10 +223,42 @@ GRANT INSERT ON electors TO admin ;
GRANT UPDATE ON electors TO admin ; GRANT UPDATE ON electors TO admin ;
GRANT DELETE ON electors TO admin ; GRANT DELETE ON electors TO admin ;
------------------------------------------------------------------------
-- primary table events for entity events
--
--
-- An event to which a team or teams are invited. Typically created
-- by the team organiser(s).
-- May be a training event, a social event or a canvassing
-- session.
--
------------------------------------------------------------------------
CREATE TABLE events
(
id SERIAL NOT NULL PRIMARY KEY,
name VARCHAR(64) NOT NULL,
date DATE,
time TIME,
decription TEXT,
cancelled BOOLEAN DEFAULT false
);
GRANT SELECT ON events TO admin,
analysts,
canvassers,
issueeditors,
issueexperts,
teamorganisers ;
GRANT INSERT ON events TO admin,
teamorganisers ;
GRANT UPDATE ON events TO admin,
teamorganisers ;
GRANT DELETE ON events TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table followupactions for entity followupactions -- primary table followupactions for entity followupactions
-- --
-- Actions taken on followup requests. -- Actions taken on followup
-- requests.
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE followupactions CREATE TABLE followupactions
( (
@ -267,7 +299,8 @@ GRANT DELETE ON followupmethods TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table followuprequests for entity followuprequests -- primary table followuprequests for entity followuprequests
-- --
-- Requests for a followup with an issue expert -- Requests for a followup with an issue
-- expert
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE followuprequests CREATE TABLE followuprequests
( (
@ -291,7 +324,8 @@ GRANT DELETE ON followuprequests TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table genders for entity genders -- primary table genders for entity genders
-- --
-- All genders which may be assigned to electors. -- All genders which may be assigned to
-- electors.
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE genders CREATE TABLE genders
( (
@ -310,11 +344,12 @@ GRANT DELETE ON genders TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table intentions for entity intentions -- primary table intentions for entity intentions
-- --
-- Intentions of electors to vote for options elicited in visits. -- Intentions of electors to vote for options
-- elicited in visits.
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE intentions CREATE TABLE intentions
( (
Id SERIAL NOT NULL PRIMARY KEY, id SERIAL NOT NULL PRIMARY KEY,
visit_id INTEGER NOT NULL, visit_id INTEGER NOT NULL,
elector_id INTEGER, elector_id INTEGER,
option_id VARCHAR(32) NOT NULL, option_id VARCHAR(32) NOT NULL,
@ -331,8 +366,8 @@ GRANT DELETE ON intentions TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table issues for entity issues -- primary table issues for entity issues
-- --
-- Issues believed to be of interest to electors, about which they may -- Issues believed to be of interest to electors,
-- have questions. -- about which they may have questions.
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE issues CREATE TABLE issues
( (
@ -356,7 +391,8 @@ GRANT DELETE ON issues TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table options for entity options -- primary table options for entity options
-- --
-- Options in the election or referendum being canvassed on -- Options in the election or referendum being
-- canvassed on
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE options CREATE TABLE options
( (
@ -375,8 +411,9 @@ GRANT DELETE ON options TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table roles for entity roles -- primary table roles for entity roles
-- --
-- A role (essentially, the same as a group, but application layer rather -- A role (essentially, the same as a group, but
-- than database layer) of which a user may be a member. -- application layer rather than database layer) of which a user
-- may be a member.
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE roles CREATE TABLE roles
( (
@ -419,8 +456,8 @@ GRANT DELETE ON teams TO admin ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- primary table visits for entity visits -- primary table visits for entity visits
-- --
-- All visits made by canvassers to dwellings in which opinions were -- All visits made by canvassers to dwellings in
-- recorded. -- which opinions were recorded.
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE visits CREATE TABLE visits
( (
@ -491,6 +528,8 @@ GRANT SELECT ON lv_authorities TO admin,
CREATE VIEW lv_canvassers AS CREATE VIEW lv_canvassers AS
SELECT canvassers.username, SELECT canvassers.username,
canvassers.fullname, canvassers.fullname,
canvassers.avatar,
canvassers.bio,
electors.name ||', '|| electors.phone ||', '|| electors.email ||', '|| genders.id AS elector_id_expanded, electors.name ||', '|| electors.phone ||', '|| electors.email ||', '|| genders.id AS elector_id_expanded,
canvassers.elector_id, canvassers.elector_id,
addresses.address ||', '|| addresses.postcode AS address_id_expanded, addresses.address ||', '|| addresses.postcode AS address_id_expanded,
@ -570,6 +609,25 @@ GRANT SELECT ON lv_electors TO admin,
issueexperts, issueexperts,
teamorganisers ; teamorganisers ;
------------------------------------------------------------------------
-- convenience view lv_events of entity events for lists, et cetera
------------------------------------------------------------------------
CREATE VIEW lv_events AS
SELECT events.name,
events.date,
events.time,
events.decription,
events.cancelled,
events.id
FROM events
;
GRANT SELECT ON lv_events TO admin,
analysts,
canvassers,
issueeditors,
issueexperts,
teamorganisers ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- convenience view lv_followupactions of entity followupactions for -- convenience view lv_followupactions of entity followupactions for
-- lists, et cetera -- lists, et cetera
@ -661,7 +719,7 @@ SELECT addresses.address ||', '|| addresses.postcode ||', '|| visits.date AS vis
options.id AS option_id_expanded, options.id AS option_id_expanded,
intentions.option_id, intentions.option_id,
intentions.locality, intentions.locality,
intentions.Id intentions.id
FROM visits, intentions, addresses, genders, electors, options FROM visits, intentions, addresses, genders, electors, options
WHERE intentions.visit_id = visits.id WHERE intentions.visit_id = visits.id
AND intentions.elector_id = electors.id AND intentions.elector_id = electors.id
@ -860,64 +918,149 @@ ALTER TABLE visits ADD CONSTRAINT ri_visits_canvassers_canvasser_id
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- link table joining canvassers with roles -- link table joining canvassers with roles
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE ln_canvassers_roles CREATE TABLE ln_roles_canvassers_roles
( (
canvasser_id INTEGER, canvasser_id INTEGER,
role_id INTEGER role_id INTEGER
); );
GRANT SELECT ON ln_canvassers_roles TO admin, GRANT SELECT ON ln_roles_canvassers_roles TO admin,
analysts, analysts,
canvassers, canvassers,
issueeditors, issueeditors,
issueexperts, issueexperts,
teamorganisers ; teamorganisers ;
GRANT INSERT ON ln_canvassers_roles TO admin, GRANT INSERT ON ln_roles_canvassers_roles TO admin,
canvassers, canvassers,
teamorganisers ; teamorganisers ;
GRANT UPDATE ON ln_canvassers_roles TO admin, GRANT UPDATE ON ln_roles_canvassers_roles TO admin,
canvassers, canvassers,
teamorganisers ; teamorganisers ;
GRANT DELETE ON ln_canvassers_roles TO admin ; GRANT DELETE ON ln_roles_canvassers_roles TO admin ;
ALTER TABLE ln_canvassers_roles ADD CONSTRAINT ri_ln_canvassers_roles_canvassers_canvasser_id ALTER TABLE ln_roles_canvassers_roles ADD CONSTRAINT ri_ln_roles_canvassers_roles_canvassers_canvasser_id
FOREIGN KEY( canvasser_id ) FOREIGN KEY( canvasser_id )
REFERENCES canvassers(id) REFERENCES canvassers(id)
ON DELETE NO ACTION ; ON DELETE NO ACTION ;
ALTER TABLE ln_canvassers_roles ADD CONSTRAINT ri_ln_canvassers_roles_roles_role_id ALTER TABLE ln_roles_canvassers_roles ADD CONSTRAINT ri_ln_roles_canvassers_roles_roles_role_id
FOREIGN KEY( role_id ) FOREIGN KEY( role_id )
REFERENCES roles(id) REFERENCES roles(id)
ON DELETE NO ACTION ; ON DELETE NO ACTION ;
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- link table joining teams with canvassers -- link table joining events with teams
------------------------------------------------------------------------ ------------------------------------------------------------------------
CREATE TABLE ln_canvassers_teams CREATE TABLE ln_teams_events_teams
( (
team_id INTEGER, event_id INTEGER,
canvasser_id INTEGER team_id INTEGER
); );
GRANT SELECT ON ln_canvassers_teams TO admin, GRANT SELECT ON ln_teams_events_teams TO admin,
analysts, analysts,
canvassers, canvassers,
issueeditors, issueeditors,
issueexperts, issueexperts,
teamorganisers ; teamorganisers ;
GRANT INSERT ON ln_canvassers_teams TO admin, GRANT INSERT ON ln_teams_events_teams TO admin,
teamorganisers ; teamorganisers ;
GRANT UPDATE ON ln_canvassers_teams TO admin, GRANT UPDATE ON ln_teams_events_teams TO admin,
teamorganisers ; teamorganisers ;
GRANT DELETE ON ln_canvassers_teams TO admin ; GRANT DELETE ON ln_teams_events_teams TO admin ;
ALTER TABLE ln_canvassers_teams ADD CONSTRAINT ri_ln_canvassers_teams_canvassers_canvasser_id ALTER TABLE ln_teams_events_teams ADD CONSTRAINT ri_ln_teams_events_teams_events_event_id
FOREIGN KEY( canvasser_id ) FOREIGN KEY( event_id )
REFERENCES canvassers(id) REFERENCES events(id)
ON DELETE NO ACTION ; ON DELETE NO ACTION ;
ALTER TABLE ln_canvassers_teams ADD CONSTRAINT ri_ln_canvassers_teams_teams_team_id ALTER TABLE ln_teams_events_teams ADD CONSTRAINT ri_ln_teams_events_teams_teams_team_id
FOREIGN KEY( team_id ) FOREIGN KEY( team_id )
REFERENCES teams(id) REFERENCES teams(id)
ON DELETE NO ACTION ; ON DELETE NO ACTION ;
------------------------------------------------------------------------
-- link table joining roles with canvassers
------------------------------------------------------------------------
CREATE TABLE ln_members_roles_canvassers
(
role_id INTEGER,
canvasser_id INTEGER
);
GRANT SELECT ON ln_members_roles_canvassers TO admin,
analysts,
canvassers,
issueeditors,
issueexperts,
teamorganisers ;
GRANT INSERT ON ln_members_roles_canvassers TO admin ;
GRANT UPDATE ON ln_members_roles_canvassers TO admin ;
GRANT DELETE ON ln_members_roles_canvassers TO admin ;
ALTER TABLE ln_members_roles_canvassers ADD CONSTRAINT ri_ln_members_roles_canvassers_canvassers_canvasser_id
FOREIGN KEY( canvasser_id )
REFERENCES canvassers(id)
ON DELETE NO ACTION ;
ALTER TABLE ln_members_roles_canvassers ADD CONSTRAINT ri_ln_members_roles_canvassers_roles_role_id
FOREIGN KEY( role_id )
REFERENCES roles(id)
ON DELETE NO ACTION ;
------------------------------------------------------------------------
-- link table joining teams with canvassers
------------------------------------------------------------------------
CREATE TABLE ln_members_teams_canvassers
(
team_id INTEGER,
canvasser_id INTEGER
);
GRANT SELECT ON ln_members_teams_canvassers TO admin,
analysts,
canvassers,
issueeditors,
issueexperts,
teamorganisers ;
GRANT INSERT ON ln_members_teams_canvassers TO admin,
teamorganisers ;
GRANT UPDATE ON ln_members_teams_canvassers TO admin,
teamorganisers ;
GRANT DELETE ON ln_members_teams_canvassers TO admin ;
ALTER TABLE ln_members_teams_canvassers ADD CONSTRAINT ri_ln_members_teams_canvassers_canvassers_canvasser_id
FOREIGN KEY( canvasser_id )
REFERENCES canvassers(id)
ON DELETE NO ACTION ;
ALTER TABLE ln_members_teams_canvassers ADD CONSTRAINT ri_ln_members_teams_canvassers_teams_team_id
FOREIGN KEY( team_id )
REFERENCES teams(id)
ON DELETE NO ACTION ;
------------------------------------------------------------------------
-- link table joining teams with canvassers
------------------------------------------------------------------------
CREATE TABLE ln_organisers_teams_canvassers
(
team_id INTEGER,
canvasser_id INTEGER
);
GRANT SELECT ON ln_organisers_teams_canvassers TO admin,
analysts,
canvassers,
issueeditors,
issueexperts,
teamorganisers ;
GRANT INSERT ON ln_organisers_teams_canvassers TO admin,
teamorganisers ;
GRANT UPDATE ON ln_organisers_teams_canvassers TO admin,
teamorganisers ;
GRANT DELETE ON ln_organisers_teams_canvassers TO admin ;
ALTER TABLE ln_organisers_teams_canvassers ADD CONSTRAINT ri_ln_organisers_teams_canvassers_canvassers_canvasser_id
FOREIGN KEY( canvasser_id )
REFERENCES canvassers(id)
ON DELETE NO ACTION ;
ALTER TABLE ln_organisers_teams_canvassers ADD CONSTRAINT ri_ln_organisers_teams_canvassers_teams_team_id
FOREIGN KEY( team_id )
REFERENCES teams(id)
ON DELETE NO ACTION ;

View file

@ -2,12 +2,6 @@
{% block big-links %} {% block big-links %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h2> {{motd|safe}}
Alpha test code
</h2>
<p>
Although addresses in the database mostly are real, all personal data in the database
is randomly generated and does not represent real people.
</p>
{% endblock %} {% endblock %}

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File application-index.html generated 2018-07-05T10:14:18.460Z by adl.to-selmer-templates. <!-- File application-index.html generated 2018-07-07T08:09:49.942Z 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).-->
@ -15,7 +15,8 @@ Address
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<dd> <dd>
<p> <p>
Addresses of all buildings which contain dwellings. Addresses of all buildings which contain
dwellings.
</p> </p>
</dd> </dd>
{% endifmemberof %} {% endifmemberof %}
@ -29,7 +30,8 @@ Authority
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<dd> <dd>
<p> <p>
Authorities which may authenticate canvassers to the system. Authorities which may authenticate canvassers to
the system.
</p> </p>
</dd> </dd>
{% endifmemberof %} {% endifmemberof %}
@ -43,7 +45,8 @@ Canvasser
{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers issueexperts analysts issueeditors admin %}
<dd> <dd>
<p> <p>
Primary users of the system: those actually interviewing electors. Primary users of the system: those actually
interviewing electors.
</p> </p>
</dd> </dd>
{% endifmemberof %} {% endifmemberof %}
@ -57,7 +60,9 @@ District
{% ifmemberof public admin canvassers teamorganisers issueexperts analysts issueeditors %} {% ifmemberof public admin canvassers teamorganisers issueexperts analysts issueeditors %}
<dd> <dd>
<p> <p>
Electoral districts: TODO: Shape (polygon) information will need to be added, for use in maps. Electoral districts: TODO: Shape (polygon)
information will need to be added, for use in
maps.
</p> </p>
</dd> </dd>
{% endifmemberof %} {% endifmemberof %}
@ -71,12 +76,12 @@ Dwelling
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<dd> <dd>
<p> <p>
All dwellings within addresses in the system; a dwelling is a All dwellings within addresses in the system; a
house, flat or appartment in which electors live. Every address should have dwelling is a house, flat or appartment in which electors live.
at least one dwelling; essentially, an address maps onto a street door and Every address should have at least one dwelling; essentially,
dwellings map onto what's behind that door. So a tenement or a block of flats an address maps onto a street door and dwellings map onto
would be one address with many dwellings. what's behind that door. So a tenement or a block of flats
would be one address with many dwellings.
</p> </p>
</dd> </dd>
{% endifmemberof %} {% endifmemberof %}
@ -90,7 +95,26 @@ Elector
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<dd> <dd>
<p> <p>
All electors known to the system; electors are people believed to be entitled to vote in the current campaign. All electors known to the system; electors are
people believed to be entitled to vote in the current
campaign.
</p>
</dd>
{% endifmemberof %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<dt>
<a href='list-events-Events'>
Event
</a>
</dt>
{% endifmemberof %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<dd>
<p>
An event to which a team or teams are invited. Typically created by the team organiser(s).
May be a training event, a social event or a canvassing session.
</p> </p>
</dd> </dd>
{% endifmemberof %} {% endifmemberof %}
@ -104,7 +128,8 @@ Followupaction
{% ifmemberof issueexperts canvassers analysts issueeditors admin %} {% ifmemberof issueexperts canvassers analysts issueeditors admin %}
<dd> <dd>
<p> <p>
Actions taken on followup requests. Actions taken on followup
requests.
</p> </p>
</dd> </dd>
{% endifmemberof %} {% endifmemberof %}
@ -129,7 +154,8 @@ Followuprequest
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<dd> <dd>
<p> <p>
Requests for a followup with an issue expert Requests for a followup with an issue
expert
</p> </p>
</dd> </dd>
{% endifmemberof %} {% endifmemberof %}
@ -143,7 +169,8 @@ Gender
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<dd> <dd>
<p> <p>
All genders which may be assigned to electors. All genders which may be assigned to
electors.
</p> </p>
</dd> </dd>
{% endifmemberof %} {% endifmemberof %}
@ -157,7 +184,8 @@ Intention
{% ifmemberof canvassers analysts admin %} {% ifmemberof canvassers analysts admin %}
<dd> <dd>
<p> <p>
Intentions of electors to vote for options elicited in visits. Intentions of electors to vote for options
elicited in visits.
</p> </p>
</dd> </dd>
{% endifmemberof %} {% endifmemberof %}
@ -171,7 +199,8 @@ Issue
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<dd> <dd>
<p> <p>
Issues believed to be of interest to electors, about which they may have questions. Issues believed to be of interest to electors,
about which they may have questions.
</p> </p>
</dd> </dd>
{% endifmemberof %} {% endifmemberof %}
@ -185,7 +214,8 @@ Option
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<dd> <dd>
<p> <p>
Options in the election or referendum being canvassed on Options in the election or referendum being
canvassed on
</p> </p>
</dd> </dd>
{% endifmemberof %} {% endifmemberof %}
@ -199,7 +229,9 @@ Role
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<dd> <dd>
<p> <p>
A role (essentially, the same as a group, but application layer rather than database layer) of which a user may be a member. A role (essentially, the same as a group, but
application layer rather than database layer) of which a user
may be a member.
</p> </p>
</dd> </dd>
{% endifmemberof %} {% endifmemberof %}
@ -224,7 +256,8 @@ Visit
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers %} {% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin canvassers teamorganisers %}
<dd> <dd>
<p> <p>
All visits made by canvassers to dwellings in which opinions were recorded. All visits made by canvassers to dwellings in
which opinions were recorded.
</p> </p>
</dd> </dd>
{% endifmemberof %} {% endifmemberof %}

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-addresses-Address.html generated 2018-07-05T10:14:18.448Z by adl.to-selmer-templates. <!-- File form-addresses-Address.html generated 2018-07-07T08:09:49.931Z 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).-->
@ -12,7 +12,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>
@ -30,7 +30,7 @@ You are not permitted to view id of addresses
</p> </p>
<p class='widget'> <p class='widget'>
<label for='address'> <label for='address'>
address Address
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='address' name='address' type='string' value='{{record.address}}' maxlength='256' size='60'/> <input id='address' name='address' type='string' value='{{record.address}}' maxlength='256' size='60'/>
@ -48,7 +48,7 @@ You are not permitted to view address of addresses
</p> </p>
<p class='widget'> <p class='widget'>
<label for='postcode'> <label for='postcode'>
postcode Postcode
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='postcode' name='postcode' type='string' value='{{record.postcode}}' maxlength='16' size='16'/> <input id='postcode' name='postcode' type='string' value='{{record.postcode}}' maxlength='16' size='16'/>
@ -66,7 +66,7 @@ You are not permitted to view postcode of addresses
</p> </p>
<p class='widget'> <p class='widget'>
<label for='phone'> <label for='phone'>
phone Phone
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='phone' name='phone' type='string' value='{{record.phone}}' maxlength='16' size='16'/> <input id='phone' name='phone' type='string' value='{{record.phone}}' maxlength='16' size='16'/>
@ -84,7 +84,7 @@ You are not permitted to view phone of addresses
</p> </p>
<p class='widget'> <p class='widget'>
<label for='district_id'> <label for='district_id'>
district_id District_id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='districts' found='true'> <span class='select-box' farside='districts' found='true'>
@ -108,7 +108,7 @@ You are not permitted to view district_id of addresses
</p> </p>
<p class='widget'> <p class='widget'>
<label for='latitude'> <label for='latitude'>
latitude Latitude
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='latitude' name='latitude' type='number' value='{{record.latitude}}' maxlength='' size='16'/> <input id='latitude' name='latitude' type='number' value='{{record.latitude}}' maxlength='' size='16'/>
@ -126,7 +126,7 @@ You are not permitted to view latitude of addresses
</p> </p>
<p class='widget'> <p class='widget'>
<label for='longitude'> <label for='longitude'>
longitude Longitude
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='longitude' name='longitude' type='number' value='{{record.longitude}}' maxlength='' size='16'/> <input id='longitude' name='longitude' type='number' value='{{record.longitude}}' maxlength='' size='16'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-authorities-Authority.html generated 2018-07-05T10:14:18.468Z by adl.to-selmer-templates. <!-- File form-authorities-Authority.html generated 2018-07-07T08:09:49.951Z 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).-->
@ -12,7 +12,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>
@ -30,7 +30,7 @@ You are not permitted to view id of authorities
</p> </p>
<p class='widget'> <p class='widget'>
<label for='request_token_uri'> <label for='request_token_uri'>
request-token-uri Request-token-uri
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='request_token_uri' name='request_token_uri' type='string' value='{{record.request_token_uri}}' maxlength='256' size='60'/> <input id='request_token_uri' name='request_token_uri' type='string' value='{{record.request_token_uri}}' maxlength='256' size='60'/>
@ -48,7 +48,7 @@ You are not permitted to view request_token_uri of authorities
</p> </p>
<p class='widget'> <p class='widget'>
<label for='access_token_uri'> <label for='access_token_uri'>
access-token-uri Access-token-uri
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='access_token_uri' name='access_token_uri' type='string' value='{{record.access_token_uri}}' maxlength='256' size='60'/> <input id='access_token_uri' name='access_token_uri' type='string' value='{{record.access_token_uri}}' maxlength='256' size='60'/>
@ -66,7 +66,7 @@ You are not permitted to view access_token_uri of authorities
</p> </p>
<p class='widget'> <p class='widget'>
<label for='authorize_uri'> <label for='authorize_uri'>
authorize-uri Authorize-uri
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='authorize_uri' name='authorize_uri' type='string' value='{{record.authorize_uri}}' maxlength='256' size='60'/> <input id='authorize_uri' name='authorize_uri' type='string' value='{{record.authorize_uri}}' maxlength='256' size='60'/>
@ -84,7 +84,7 @@ You are not permitted to view authorize_uri of authorities
</p> </p>
<p class='widget'> <p class='widget'>
<label for='consumer_key'> <label for='consumer_key'>
consumer-key Consumer-key
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='consumer_key' name='consumer_key' type='string' value='{{record.consumer_key}}' maxlength='32' size='32'/> <input id='consumer_key' name='consumer_key' type='string' value='{{record.consumer_key}}' maxlength='32' size='32'/>
@ -102,7 +102,7 @@ You are not permitted to view consumer_key of authorities
</p> </p>
<p class='widget'> <p class='widget'>
<label for='consumer_secret'> <label for='consumer_secret'>
consumer-secret Consumer-secret
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='consumer_secret' name='consumer_secret' type='string' value='{{record.consumer_secret}}' maxlength='256' size='60'/> <input id='consumer_secret' name='consumer_secret' type='string' value='{{record.consumer_secret}}' maxlength='256' size='60'/>

View file

@ -1,10 +1,11 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-canvassers-Canvasser.html generated 2018-07-05T10:14:18.471Z by adl.to-selmer-templates. <!-- File form-canvassers-Canvasser.html generated 2018-07-07T08:09:49.958Z 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 extra-head %} {% block extra-head %}
{% script "js/lib/node_modules/simplemde/dist/simplemde.min.js" %}
{% style "js/lib/node_modules/simplemde/dist/simplemde.min.css" %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id='content' class='edit'> <div id='content' class='edit'>
@ -12,7 +13,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>
@ -30,7 +31,7 @@ You are not permitted to view id of canvassers
</p> </p>
<p class='widget'> <p class='widget'>
<label for='username'> <label for='username'>
username Username
</label> </label>
{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %}
<input id='username' name='username' type='string' value='{{record.username}}' maxlength='32' size='32'/> <input id='username' name='username' type='string' value='{{record.username}}' maxlength='32' size='32'/>
@ -48,7 +49,7 @@ You are not permitted to view username of canvassers
</p> </p>
<p class='widget'> <p class='widget'>
<label for='fullname'> <label for='fullname'>
fullname Fullname
</label> </label>
{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %}
<input id='fullname' name='fullname' type='string' value='{{record.fullname}}' maxlength='64' size='60'/> <input id='fullname' name='fullname' type='string' value='{{record.fullname}}' maxlength='64' size='60'/>
@ -66,7 +67,7 @@ You are not permitted to view fullname of canvassers
</p> </p>
<p class='widget'> <p class='widget'>
<label for='elector_id'> <label for='elector_id'>
elector_id Elector_id
</label> </label>
{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %}
<span class='select-box' farside='electors' found='true'> <span class='select-box' farside='electors' found='true'>
@ -90,7 +91,7 @@ You are not permitted to view elector_id of canvassers
</p> </p>
<p class='widget'> <p class='widget'>
<label for='address_id'> <label for='address_id'>
address_id Address_id
</label> </label>
{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %}
<span class='select-box' farside='addresses' found='true'> <span class='select-box' farside='addresses' found='true'>
@ -114,7 +115,7 @@ You are not permitted to view address_id of canvassers
</p> </p>
<p class='widget'> <p class='widget'>
<label for='phone'> <label for='phone'>
phone Phone
</label> </label>
{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %}
<input id='phone' name='phone' type='string' value='{{record.phone}}' maxlength='16' size='16'/> <input id='phone' name='phone' type='string' value='{{record.phone}}' maxlength='16' size='16'/>
@ -132,7 +133,7 @@ You are not permitted to view phone of canvassers
</p> </p>
<p class='widget'> <p class='widget'>
<label for='email'> <label for='email'>
email Email
</label> </label>
{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %}
<input id='email' name='email' type='string' value='{{record.email}}' maxlength='128' size='60'/> <input id='email' name='email' type='string' value='{{record.email}}' maxlength='128' size='60'/>
@ -150,7 +151,7 @@ You are not permitted to view email of canvassers
</p> </p>
<p class='widget'> <p class='widget'>
<label for='authority_id'> <label for='authority_id'>
authority_id Authority_id
</label> </label>
{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %}
<span class='select-box' farside='authorities' found='true'> <span class='select-box' farside='authorities' found='true'>
@ -174,7 +175,7 @@ You are not permitted to view authority_id of canvassers
</p> </p>
<p class='widget'> <p class='widget'>
<label for='authorised'> <label for='authorised'>
authorised Authorised
</label> </label>
{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %}
<input id='authorised' name='authorised' type='checkbox' value='{{record.authorised}}' maxlength='' size='16'/> <input id='authorised' name='authorised' type='checkbox' value='{{record.authorised}}' maxlength='' size='16'/>
@ -192,7 +193,7 @@ You are not permitted to view authorised of canvassers
</p> </p>
<p class='widget'> <p class='widget'>
<label for='roles'> <label for='roles'>
roles Roles
</label> </label>
{% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %} {% ifmemberof canvassers teamorganisers admin canvassers teamorganisers admin %}
<span class='select-box' farside='roles' found='true'> <span class='select-box' farside='roles' found='true'>
@ -249,6 +250,24 @@ To delete this canvassers record
}); });
} }
var simplemde = new SimpleMDE({
autosave: {
enabled: true,
uniqueId: "Smeagol-{{page}}",
delay: 1000,
},
indentWithTabs: true,
insertTexts: {
horizontalRule: ["", "\n\n-----\n\n"],
image: ["![](http://", ")"],
link: ["[", "](http://)"],
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
},
showIcons: ["code"], //, "table"], - sadly, markdown-clj does not support tables
spellChecker: true,
status: ["autosave", "lines", "words", "cursor"]
});
</script> </script>
{% endblock %} {% endblock %}

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-districts-District.html generated 2018-07-05T10:14:18.436Z by adl.to-selmer-templates. <!-- File form-districts-District.html generated 2018-07-07T08:09:49.922Z 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).-->
@ -12,7 +12,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>
@ -30,7 +30,7 @@ You are not permitted to view id of districts
</p> </p>
<p class='widget'> <p class='widget'>
<label for='name'> <label for='name'>
name Name
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='name' name='name' type='string' value='{{record.name}}' maxlength='64' size='60'/> <input id='name' name='name' type='string' value='{{record.name}}' maxlength='64' size='60'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-dwellings-Dwelling.html generated 2018-07-05T10:14:18.485Z by adl.to-selmer-templates. <!-- File form-dwellings-Dwelling.html generated 2018-07-07T08:09:49.973Z 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).-->
@ -12,7 +12,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>
@ -30,7 +30,7 @@ You are not permitted to view id of dwellings
</p> </p>
<p class='widget'> <p class='widget'>
<label for='address_id'> <label for='address_id'>
address_id Address_id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='addresses' found='true'> <span class='select-box' farside='addresses' found='true'>
@ -54,7 +54,7 @@ You are not permitted to view address_id of dwellings
</p> </p>
<p class='widget'> <p class='widget'>
<label for='sub_address'> <label for='sub_address'>
sub-address Sub-address
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='sub_address' name='sub_address' type='string' value='{{record.sub_address}}' maxlength='32' size='32'/> <input id='sub_address' name='sub_address' type='string' value='{{record.sub_address}}' maxlength='32' size='32'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-electors-Elector.html generated 2018-07-05T10:14:18.465Z by adl.to-selmer-templates. <!-- File form-electors-Elector.html generated 2018-07-07T08:09:49.947Z 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).-->
@ -12,7 +12,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>
@ -30,7 +30,7 @@ You are not permitted to view id of electors
</p> </p>
<p class='widget'> <p class='widget'>
<label for='name'> <label for='name'>
name Name
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='name' name='name' type='string' value='{{record.name}}' maxlength='64' size='60'/> <input id='name' name='name' type='string' value='{{record.name}}' maxlength='64' size='60'/>
@ -48,7 +48,7 @@ You are not permitted to view name of electors
</p> </p>
<p class='widget'> <p class='widget'>
<label for='dwelling_id'> <label for='dwelling_id'>
dwelling_id Dwelling_id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='dwellings' found='true'> <span class='select-box' farside='dwellings' found='true'>
@ -72,7 +72,7 @@ You are not permitted to view dwelling_id of electors
</p> </p>
<p class='widget'> <p class='widget'>
<label for='phone'> <label for='phone'>
phone Phone
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='phone' name='phone' type='string' value='{{record.phone}}' maxlength='16' size='16'/> <input id='phone' name='phone' type='string' value='{{record.phone}}' maxlength='16' size='16'/>
@ -90,7 +90,7 @@ You are not permitted to view phone of electors
</p> </p>
<p class='widget'> <p class='widget'>
<label for='email'> <label for='email'>
email Email
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='email' name='email' type='string' value='{{record.email}}' maxlength='128' size='60'/> <input id='email' name='email' type='string' value='{{record.email}}' maxlength='128' size='60'/>
@ -108,7 +108,7 @@ You are not permitted to view email of electors
</p> </p>
<p class='widget'> <p class='widget'>
<label for='gender'> <label for='gender'>
gender Gender
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='genders' found='true'> <span class='select-box' farside='genders' found='true'>

View file

@ -0,0 +1,205 @@
{% extends "base.html" %}
<!-- File form-events-Events.html generated 2018-07-07T08:09:49.954Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block extra-head %}
{% script "js/lib/node_modules/simplemde/dist/simplemde.min.js" %}
{% style "js/lib/node_modules/simplemde/dist/simplemde.min.css" %}
{% endblock %}
{% block content %}
<div id='content' class='edit'>
<form action='{{servlet-context}}/form-events-Events' method='POST'>
{% csrf-field %}
<p class='widget'>
<label for='id'>
Id
</label>
{% ifmemberof teamorganisers admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='id' name='id' class='pseudo-widget disabled'>
{{record.id}}
</span>
{% else %}
<span id='id' name='id' class='pseudo-widget not-authorised'>
You are not permitted to view id of events
</span>
{% endifmemberof %}
{% endifmemberof %}
</p>
<p class='widget'>
<label for='name'>
Name
</label>
{% ifmemberof teamorganisers admin %}
<input id='name' name='name' type='string' value='{{record.name}}' maxlength='64' size='60'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='name' name='name' class='pseudo-widget disabled'>
{{record.name}}
</span>
{% else %}
<span id='name' name='name' class='pseudo-widget not-authorised'>
You are not permitted to view name of events
</span>
{% endifmemberof %}
{% endifmemberof %}
</p>
<p class='widget'>
<label for='teams'>
Teams
</label>
{% ifmemberof teamorganisers admin %}
<span class='select-box' farside='teams' found='true'>
<input name='teams_search_box' onchange='$.getJSON("/auto/json/seach-strings-teams?name=" + teams_search_box.text, null, function (data) {updateMenuOptions("teams", "id", ["name"], data);})'/>
<br/>
<select id='teams' name='teams' multiple='multiple'>
{% for r in teams %}<option value='{{r.id}}' {% ifequal record.teams r.id%}selected{% endifequal %}>{{r.name}}</option>{% endfor %}
</select>
</span>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='teams' name='teams' class='pseudo-widget disabled'>
{{record.teams}}
</span>
{% else %}
<span id='teams' name='teams' class='pseudo-widget not-authorised'>
You are not permitted to view teams of events
</span>
{% endifmemberof %}
{% endifmemberof %}
</p>
<p class='widget'>
<label for='date'>
Date
</label>
{% ifmemberof teamorganisers admin %}
<input id='date' name='date' type='date' value='{{record.date}}' maxlength='' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='date' name='date' class='pseudo-widget disabled'>
{{record.date}}
</span>
{% else %}
<span id='date' name='date' class='pseudo-widget not-authorised'>
You are not permitted to view date of events
</span>
{% endifmemberof %}
{% endifmemberof %}
</p>
<p class='widget'>
<label for='time'>
Time
</label>
{% ifmemberof teamorganisers admin %}
<input id='time' name='time' type='time' value='{{record.time}}' maxlength='' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='time' name='time' class='pseudo-widget disabled'>
{{record.time}}
</span>
{% else %}
<span id='time' name='time' class='pseudo-widget not-authorised'>
You are not permitted to view time of events
</span>
{% endifmemberof %}
{% endifmemberof %}
</p>
<p class='widget'>
<label for='decription'>
Decription
</label>
{% ifmemberof teamorganisers admin %}
<textarea rows='8' cols='60' id='decription' name='decription'>
{{record.decription}}
</textarea>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='decription' name='decription' class='pseudo-widget disabled'>
{{record.decription}}
</span>
{% else %}
<span id='decription' name='decription' class='pseudo-widget not-authorised'>
You are not permitted to view decription of events
</span>
{% endifmemberof %}
{% endifmemberof %}
</p>
<p class='widget'>
<label for='cancelled'>
Cancelled
</label>
{% ifmemberof teamorganisers admin %}
<input id='cancelled' name='cancelled' type='checkbox' value='{{record.cancelled}}' maxlength='' size='16'/>
{% else %}
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
<span id='cancelled' name='cancelled' class='pseudo-widget disabled'>
{{record.cancelled}}
</span>
{% else %}
<span id='cancelled' name='cancelled' class='pseudo-widget not-authorised'>
You are not permitted to view cancelled of events
</span>
{% endifmemberof %}
{% endifmemberof %}
</p>
{% ifmemberof teamorganisers admin %}
<p class='widget action-safe'>
<label for='save-button' class='action-safe'>
To save this events record
</label>
<input id='save-button' name='save-button' class='action-safe' type='submit' value='Save!'/>
</p>
{% endifmemberof %}
{% ifmemberof teamorganisers admin %}
<p class='widget action-dangerous'>
<label for='delete-button' class='action-dangerous'>
To delete this events record
</label>
<input id='delete-button' name='delete-button' class='action-dangerous' type='submit' value='Delete!'/>
</p>
{% endifmemberof %}
</form>
</div>
{% endblock %}
{% block extra-tail %}
<script type='text/javascript'>
/**
* update the select menu with id `wid` from this `data` whose fields include
* this `entity_key` and these `fields`
*/
function updateMenuOptions(wid, entity_key, fields, data){
$('#' + wid).children().filter(function(){
return $(this).attr('selected') === undefined;
}).remove().end();
$.each(data, function(key, entry){
$('#' + wid).append(
$('<option></option>').attr('value', key).text(entry));
});
}
var simplemde = new SimpleMDE({
autosave: {
enabled: true,
uniqueId: "Smeagol-{{page}}",
delay: 1000,
},
indentWithTabs: true,
insertTexts: {
horizontalRule: ["", "\n\n-----\n\n"],
image: ["![](http://", ")"],
link: ["[", "](http://)"],
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
},
showIcons: ["code"], //, "table"], - sadly, markdown-clj does not support tables
spellChecker: true,
status: ["autosave", "lines", "words", "cursor"]
});
</script>
{% endblock %}

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-followupactions-Followupaction.html generated 2018-07-05T10:14:18.488Z by adl.to-selmer-templates. <!-- File form-followupactions-Followupaction.html generated 2018-07-07T08:09:49.976Z 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).-->
@ -13,7 +13,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>
@ -31,7 +31,7 @@ You are not permitted to view id of followupactions
</p> </p>
<p class='widget'> <p class='widget'>
<label for='request_id'> <label for='request_id'>
request_id Request_id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='followuprequests' found='true'> <span class='select-box' farside='followuprequests' found='true'>
@ -55,7 +55,7 @@ You are not permitted to view request_id of followupactions
</p> </p>
<p class='widget'> <p class='widget'>
<label for='actor'> <label for='actor'>
actor Actor
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='canvassers' found='true'> <span class='select-box' farside='canvassers' found='true'>
@ -79,7 +79,7 @@ You are not permitted to view actor of followupactions
</p> </p>
<p class='widget'> <p class='widget'>
<label for='date'> <label for='date'>
date Date
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='date' name='date' type='string' value='{{record.date}}' maxlength='' size='16'/> <input id='date' name='date' type='string' value='{{record.date}}' maxlength='' size='16'/>
@ -97,7 +97,7 @@ You are not permitted to view date of followupactions
</p> </p>
<p class='widget'> <p class='widget'>
<label for='notes'> <label for='notes'>
notes Notes
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<textarea rows='8' cols='60' id='notes' name='notes'> <textarea rows='8' cols='60' id='notes' name='notes'>
@ -117,7 +117,7 @@ You are not permitted to view notes of followupactions
</p> </p>
<p class='widget'> <p class='widget'>
<label for='closed'> <label for='closed'>
closed Closed
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='closed' name='closed' type='checkbox' value='{{record.closed}}' maxlength='' size='16'/> <input id='closed' name='closed' type='checkbox' value='{{record.closed}}' maxlength='' size='16'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-followupmethods-Followupmethod.html generated 2018-07-05T10:14:18.491Z by adl.to-selmer-templates. <!-- File form-followupmethods-Followupmethod.html generated 2018-07-07T08:09:49.979Z 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).-->
@ -12,7 +12,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-followuprequests-Followuprequest.html generated 2018-07-05T10:14:18.440Z by adl.to-selmer-templates. <!-- File form-followuprequests-Followuprequest.html generated 2018-07-07T08:09:49.925Z 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).-->
@ -12,7 +12,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>
@ -30,7 +30,7 @@ You are not permitted to view id of followuprequests
</p> </p>
<p class='widget'> <p class='widget'>
<label for='elector_id'> <label for='elector_id'>
elector_id Elector_id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='electors' found='true'> <span class='select-box' farside='electors' found='true'>
@ -54,7 +54,7 @@ You are not permitted to view elector_id of followuprequests
</p> </p>
<p class='widget'> <p class='widget'>
<label for='visit_id'> <label for='visit_id'>
visit_id Visit_id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='visits' found='true'> <span class='select-box' farside='visits' found='true'>
@ -78,7 +78,7 @@ You are not permitted to view visit_id of followuprequests
</p> </p>
<p class='widget'> <p class='widget'>
<label for='issue_id'> <label for='issue_id'>
issue_id Issue_id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='issues' found='true'> <span class='select-box' farside='issues' found='true'>
@ -100,7 +100,7 @@ You are not permitted to view issue_id of followuprequests
</p> </p>
<p class='widget'> <p class='widget'>
<label for='method_id'> <label for='method_id'>
method_id Method_id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='followupmethods' found='true'> <span class='select-box' farside='followupmethods' found='true'>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-genders-Gender.html generated 2018-07-05T10:14:18.432Z by adl.to-selmer-templates. <!-- File form-genders-Gender.html generated 2018-07-07T08:09:49.918Z 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).-->
@ -12,7 +12,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-intentions-Intention.html generated 2018-07-05T10:14:18.481Z by adl.to-selmer-templates. <!-- File form-intentions-Intention.html generated 2018-07-07T08:09:49.968Z 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).-->
@ -12,7 +12,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='visit_id'> <label for='visit_id'>
visit_id Visit_id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='visits' found='true'> <span class='select-box' farside='visits' found='true'>
@ -36,7 +36,7 @@ You are not permitted to view visit_id of intentions
</p> </p>
<p class='widget'> <p class='widget'>
<label for='elector_id'> <label for='elector_id'>
elector_id Elector_id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='electors' found='true'> <span class='select-box' farside='electors' found='true'>
@ -60,7 +60,7 @@ You are not permitted to view elector_id of intentions
</p> </p>
<p class='widget'> <p class='widget'>
<label for='option_id'> <label for='option_id'>
option_id Option_id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='options' found='true'> <span class='select-box' farside='options' found='true'>
@ -82,7 +82,7 @@ You are not permitted to view option_id of intentions
</p> </p>
<p class='widget'> <p class='widget'>
<label for='locality'> <label for='locality'>
locality Locality
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='locality' name='locality' type='number' value='{{record.locality}}' maxlength='' size='16'/> <input id='locality' name='locality' type='number' value='{{record.locality}}' maxlength='' size='16'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-issues-Issue.html generated 2018-07-05T10:14:18.452Z by adl.to-selmer-templates. <!-- File form-issues-Issue.html generated 2018-07-07T08:09:49.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).-->
@ -13,7 +13,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof issueeditors admin %} {% ifmemberof issueeditors admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>
@ -31,7 +31,7 @@ You are not permitted to view id of issues
</p> </p>
<p class='widget'> <p class='widget'>
<label for='url'> <label for='url'>
url Url
</label> </label>
{% ifmemberof issueeditors admin %} {% ifmemberof issueeditors admin %}
<input id='url' name='url' type='string' value='{{record.url}}' maxlength='256' size='60'/> <input id='url' name='url' type='string' value='{{record.url}}' maxlength='256' size='60'/>
@ -49,7 +49,7 @@ You are not permitted to view url of issues
</p> </p>
<p class='widget'> <p class='widget'>
<label for='current'> <label for='current'>
current Current
</label> </label>
{% ifmemberof issueeditors admin %} {% ifmemberof issueeditors admin %}
<input id='current' name='current' type='checkbox' value='{{record.current}}' maxlength='' size='16'/> <input id='current' name='current' type='checkbox' value='{{record.current}}' maxlength='' size='16'/>
@ -67,7 +67,7 @@ You are not permitted to view current of issues
</p> </p>
<p class='widget'> <p class='widget'>
<label for='brief'> <label for='brief'>
brief Brief
</label> </label>
{% ifmemberof issueeditors admin %} {% ifmemberof issueeditors admin %}
<textarea rows='8' cols='60' id='brief' name='brief'> <textarea rows='8' cols='60' id='brief' name='brief'>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-options-Option.html generated 2018-07-05T10:14:18.481Z by adl.to-selmer-templates. <!-- File form-options-Option.html generated 2018-07-07T08:09:49.967Z 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).-->
@ -12,7 +12,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-roles-Role.html generated 2018-07-05T10:14:18.454Z by adl.to-selmer-templates. <!-- File form-roles-Role.html generated 2018-07-07T08:09:49.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).-->
@ -12,7 +12,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>
@ -30,7 +30,7 @@ You are not permitted to view id of roles
</p> </p>
<p class='widget'> <p class='widget'>
<label for='name'> <label for='name'>
name Name
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='name' name='name' type='string' value='{{record.name}}' maxlength='64' size='60'/> <input id='name' name='name' type='string' value='{{record.name}}' maxlength='64' size='60'/>
@ -48,7 +48,7 @@ You are not permitted to view name of roles
</p> </p>
<p class='widget'> <p class='widget'>
<label for='members'> <label for='members'>
members Members
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='canvassers' found='true'> <span class='select-box' farside='canvassers' found='true'>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-teams-Team.html generated 2018-07-05T10:14:18.461Z by adl.to-selmer-templates. <!-- File form-teams-Team.html generated 2018-07-07T08:09:49.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).-->
@ -12,7 +12,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof teamorganisers admin teamorganisers admin %} {% ifmemberof teamorganisers admin teamorganisers admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>
@ -30,7 +30,7 @@ You are not permitted to view id of teams
</p> </p>
<p class='widget'> <p class='widget'>
<label for='name'> <label for='name'>
name Name
</label> </label>
{% ifmemberof teamorganisers admin teamorganisers admin %} {% ifmemberof teamorganisers admin teamorganisers admin %}
<input id='name' name='name' type='string' value='{{record.name}}' maxlength='64' size='60'/> <input id='name' name='name' type='string' value='{{record.name}}' maxlength='64' size='60'/>
@ -48,7 +48,7 @@ You are not permitted to view name of teams
</p> </p>
<p class='widget'> <p class='widget'>
<label for='district_id'> <label for='district_id'>
district_id District_id
</label> </label>
{% ifmemberof teamorganisers admin teamorganisers admin %} {% ifmemberof teamorganisers admin teamorganisers admin %}
<span class='select-box' farside='districts' found='true'> <span class='select-box' farside='districts' found='true'>
@ -72,7 +72,7 @@ You are not permitted to view district_id of teams
</p> </p>
<p class='widget'> <p class='widget'>
<label for='latitude'> <label for='latitude'>
latitude Latitude
</label> </label>
{% ifmemberof teamorganisers admin teamorganisers admin %} {% ifmemberof teamorganisers admin teamorganisers admin %}
<input id='latitude' name='latitude' type='number' value='{{record.latitude}}' maxlength='' size='16'/> <input id='latitude' name='latitude' type='number' value='{{record.latitude}}' maxlength='' size='16'/>
@ -90,7 +90,7 @@ You are not permitted to view latitude of teams
</p> </p>
<p class='widget'> <p class='widget'>
<label for='members'> <label for='members'>
members Members
</label> </label>
{% ifmemberof teamorganisers admin teamorganisers admin %} {% ifmemberof teamorganisers admin teamorganisers admin %}
<span class='select-box' farside='canvassers' found='true'> <span class='select-box' farside='canvassers' found='true'>
@ -114,7 +114,7 @@ You are not permitted to view members of teams
</p> </p>
<p class='widget'> <p class='widget'>
<label for='organisers'> <label for='organisers'>
organisers Organisers
</label> </label>
{% ifmemberof teamorganisers admin teamorganisers admin %} {% ifmemberof teamorganisers admin teamorganisers admin %}
<span class='select-box' farside='canvassers' found='true'> <span class='select-box' farside='canvassers' found='true'>
@ -138,7 +138,7 @@ You are not permitted to view organisers of teams
</p> </p>
<p class='widget'> <p class='widget'>
<label for='longitude'> <label for='longitude'>
longitude Longitude
</label> </label>
{% ifmemberof teamorganisers admin teamorganisers admin %} {% ifmemberof teamorganisers admin teamorganisers admin %}
<input id='longitude' name='longitude' type='number' value='{{record.longitude}}' maxlength='' size='16'/> <input id='longitude' name='longitude' type='number' value='{{record.longitude}}' maxlength='' size='16'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File form-visits-Visit.html generated 2018-07-05T10:14:18.457Z by adl.to-selmer-templates. <!-- File form-visits-Visit.html generated 2018-07-07T08:09:49.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).-->
@ -12,7 +12,7 @@ See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% csrf-field %} {% csrf-field %}
<p class='widget'> <p class='widget'>
<label for='id'> <label for='id'>
id Id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/> <input id='id' name='id' type='string' value='{{record.id}}' maxlength='' size='16'/>
@ -30,7 +30,7 @@ You are not permitted to view id of visits
</p> </p>
<p class='widget'> <p class='widget'>
<label for='address_id'> <label for='address_id'>
address_id Address_id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='addresses' found='true'> <span class='select-box' farside='addresses' found='true'>
@ -54,7 +54,7 @@ You are not permitted to view address_id of visits
</p> </p>
<p class='widget'> <p class='widget'>
<label for='canvasser_id'> <label for='canvasser_id'>
canvasser_id Canvasser_id
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<span class='select-box' farside='canvassers' found='true'> <span class='select-box' farside='canvassers' found='true'>
@ -78,7 +78,7 @@ You are not permitted to view canvasser_id of visits
</p> </p>
<p class='widget'> <p class='widget'>
<label for='date'> <label for='date'>
date Date
</label> </label>
{% ifmemberof admin %} {% ifmemberof admin %}
<input id='date' name='date' type='string' value='{{record.date}}' maxlength='' size='16'/> <input id='date' name='date' type='string' value='{{record.date}}' maxlength='' size='16'/>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-addresses-Addresses.html generated 2018-07-05T10:14:18.471Z by adl.to-selmer-templates. <!-- File list-addresses-Addresses.html generated 2018-07-07T08:09:49.953Z 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).-->
@ -45,25 +45,25 @@ Add a new Address
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
address Address
</th> </th>
<th> <th>
postcode Postcode
</th> </th>
<th> <th>
phone Phone
</th> </th>
<th> <th>
district_id District_id
</th> </th>
<th> <th>
latitude Latitude
</th> </th>
<th> <th>
longitude Longitude
</th> </th>
<th> <th>
&nbsp; &nbsp;
@ -74,10 +74,10 @@ longitude
<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 id='address' type='text' name='address' value='{{ params.address }}'/> <input id='Address' type='text' name='Address' value='{{ params.Address }}'/>
</th> </th>
<th> <th>
<input id='postcode' type='text' name='postcode' value='{{ params.postcode }}'/> <input id='Postcode' type='text' name='Postcode' value='{{ params.Postcode }}'/>
</th> </th>
<th> <th>
<input id='phone' type='text' name='phone' value='{{ params.phone }}'/> <input id='phone' type='text' name='phone' value='{{ params.phone }}'/>
@ -103,10 +103,10 @@ longitude
{{ record.id }} {{ record.id }}
</td> </td>
<td> <td>
{{ record.address }} {{ record. }}
</td> </td>
<td> <td>
{{ record.postcode }} {{ record. }}
</td> </td>
<td> <td>
{{ record.phone }} {{ record.phone }}

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-authorities-Authorities.html generated 2018-07-05T10:14:18.439Z by adl.to-selmer-templates. <!-- File list-authorities-Authorities.html generated 2018-07-07T08:09:49.924Z 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).-->
@ -45,16 +45,16 @@ Add a new Authority
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
request-token-uri Request-token-uri
</th> </th>
<th> <th>
access-token-uri Access-token-uri
</th> </th>
<th> <th>
authorize-uri Authorize-uri
</th> </th>
<th> <th>
&nbsp; &nbsp;

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-canvassers-Canvassers.html generated 2018-07-05T10:14:18.485Z by adl.to-selmer-templates. <!-- File list-canvassers-Canvassers.html generated 2018-07-07T08:09:49.972Z 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).-->
@ -45,31 +45,31 @@ Add a new Canvasser
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
username Username
</th> </th>
<th> <th>
fullname Fullname
</th> </th>
<th> <th>
elector_id Elector_id
</th> </th>
<th> <th>
address_id Address_id
</th> </th>
<th> <th>
phone Phone
</th> </th>
<th> <th>
email Email
</th> </th>
<th> <th>
authority_id Authority_id
</th> </th>
<th> <th>
authorised Authorised
</th> </th>
<th> <th>
&nbsp; &nbsp;

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-districts-Districts.html generated 2018-07-05T10:14:18.479Z by adl.to-selmer-templates. <!-- File list-districts-Districts.html generated 2018-07-07T08:09:49.965Z 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).-->
@ -45,10 +45,10 @@ Add a new District
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
name Name
</th> </th>
<th> <th>
&nbsp; &nbsp;

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-dwellings-Dwellings.html generated 2018-07-05T10:14:18.468Z by adl.to-selmer-templates. <!-- File list-dwellings-Dwellings.html generated 2018-07-07T08:09:49.950Z 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).-->
@ -45,13 +45,13 @@ Add a new Dwelling
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
address_id Address_id
</th> </th>
<th> <th>
sub-address Sub-address
</th> </th>
<th> <th>
&nbsp; &nbsp;

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-electors-Electors.html generated 2018-07-05T10:14:18.451Z by adl.to-selmer-templates. <!-- File list-electors-Electors.html generated 2018-07-07T08:09:49.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).-->
@ -45,22 +45,22 @@ Add a new Elector
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
name Name
</th> </th>
<th> <th>
dwelling_id Dwelling_id
</th> </th>
<th> <th>
phone Phone
</th> </th>
<th> <th>
email Email
</th> </th>
<th> <th>
gender Gender
</th> </th>
<th> <th>
&nbsp; &nbsp;

View file

@ -0,0 +1,148 @@
{% extends "base.html" %}
<!-- File list-events-Events.html generated 2018-07-07T08:09:49.965Z by adl.to-selmer-templates.
See [Application Description Language](https://github.com/simon-brooke/adl).-->
{% block back-links %}
<div>
<div class='back-link-container'>
{% ifequal params.offset "0" %}
<a id='back-link' class='back-link' href='{{servlet-context}}/admin'>
Back
</a>
{% else %}
<a id='prev-selector' class='back-link'>
Previous
</a>
{% endifunequal %}
</div>
</div>
{% endblock %}
{% block big-links %}
<div>
<div class='big-link-container'>
<a id='next-selector' role='button' class='big-link'>
Next
</a>
</div>
{% ifmemberof teamorganisers admin %}
<div class='big-link-container'>
<a href='form-events-Events' class='big-link'>
Add a new Event
</a>
</div>
{% endifmemberof %}
</div>
{% endblock %}
{% block content %}
<form id='list-events-Events' class='list' action='{{servlet-context}}/list-events-Events' 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='events'>
<thead>
<tr>
<th>
Id
</th>
<th>
Name
</th>
<th>
Date
</th>
<th>
Time
</th>
<th>
Decription
</th>
<th>
Cancelled
</th>
<th>
&nbsp;
</th>
</tr>
<tr>
<th>
<input id='id' type='text' name='id' value='{{ params.id }}'/>
</th>
<th>
<input id='name' type='text' name='name' value='{{ params.name }}'/>
</th>
<th>
<input id='date' type='date' name='date' value='{{ params.date }}'/>
</th>
<th>
<input id='time' type='time' name='time' value='{{ params.time }}'/>
</th>
<th>
<input id='decription' type='text' name='decription' value='{{ params.decription }}'/>
</th>
<th>
<input id='cancelled' type='text' name='cancelled' value='{{ params.cancelled }}'/>
</th>
<th>
<input type='submit' id='search-widget' value='Search'/>
</th>
</tr>
</thead>
<tbody>
{% for record in records %}
<tr>
<td>
{{ record.id }}
</td>
<td>
{{ record.name }}
</td>
<td>
{{ record.date }}
</td>
<td>
{{ record.time }}
</td>
<td>
{{ record.decription }}
</td>
<td>
{{ record.cancelled }}
</td>
<td>
<a href='form-events-Events?id={{ record.id }}'>
View
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</form>
{% endblock %}
{% block extra-script %}
var form = document.getElementById('list-events-Events');
var ow = document.getElementById('offset');
var lw = document.getElementById('limit');
form.addEventListener('submit', function() {
ow.value='0';
});
{% ifunequal params.offset "0" %}
document.getElementById('prev-selector').addEventListener('click', function () {
ow.value=(parseInt(ow.value)-parseInt(lw.value));
console.log('Updated offset to ' + ow.value);
form.submit();
});
{% endifunequal %}
document.getElementById('next-selector').addEventListener('click', function () {
ow.value=(parseInt(ow.value)+parseInt(lw.value));
console.log('Updated offset to ' + ow.value);
form.submit();
});
{% endblock %}

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-followupactions-Followupactions.html generated 2018-07-05T10:14:18.484Z by adl.to-selmer-templates. <!-- File list-followupactions-Followupactions.html generated 2018-07-07T08:09:49.971Z 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).-->
@ -45,22 +45,22 @@ Add a new Followupaction
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
request_id Request_id
</th> </th>
<th> <th>
actor Actor
</th> </th>
<th> <th>
date Date
</th> </th>
<th> <th>
notes Notes
</th> </th>
<th> <th>
closed Closed
</th> </th>
<th> <th>
&nbsp; &nbsp;

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-followupmethods-Followupmethods.html generated 2018-07-05T10:14:18.456Z by adl.to-selmer-templates. <!-- File list-followupmethods-Followupmethods.html generated 2018-07-07T08:09:49.939Z 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).-->
@ -45,7 +45,7 @@ Add a new Followupmethod
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
&nbsp; &nbsp;

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-followuprequests-Followuprequests.html generated 2018-07-05T10:14:18.434Z by adl.to-selmer-templates. <!-- File list-followuprequests-Followuprequests.html generated 2018-07-07T08:09:49.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).-->
@ -45,19 +45,19 @@ Add a new Followuprequest
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
elector_id Elector_id
</th> </th>
<th> <th>
visit_id Visit_id
</th> </th>
<th> <th>
issue_id Issue_id
</th> </th>
<th> <th>
method_id Method_id
</th> </th>
<th> <th>
&nbsp; &nbsp;

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-genders-Genders.html generated 2018-07-05T10:14:18.428Z by adl.to-selmer-templates. <!-- File list-genders-Genders.html generated 2018-07-07T08:09:49.914Z 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).-->
@ -45,7 +45,7 @@ Add a new Gender
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
&nbsp; &nbsp;

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-intentions-Intentions.html generated 2018-07-05T10:14:18.487Z by adl.to-selmer-templates. <!-- File list-intentions-Intentions.html generated 2018-07-07T08:09:49.975Z 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).-->
@ -45,16 +45,16 @@ Add a new Intention
<thead> <thead>
<tr> <tr>
<th> <th>
visit_id Visit_id
</th> </th>
<th> <th>
elector_id Elector_id
</th> </th>
<th> <th>
option_id Option_id
</th> </th>
<th> <th>
locality Locality
</th> </th>
<th> <th>
&nbsp; &nbsp;
@ -100,7 +100,7 @@ locality
{{ record.locality }} {{ record.locality }}
</td> </td>
<td> <td>
<a href='form-intentions-Intention?Id={{ record.Id }}'> <a href='form-intentions-Intention?id={{ record.id }}'>
View View
</a> </a>
</td> </td>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-issues-Issues.html generated 2018-07-05T10:14:18.480Z by adl.to-selmer-templates. <!-- File list-issues-Issues.html generated 2018-07-07T08:09:49.966Z 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).-->
@ -45,16 +45,16 @@ Add a new Issue
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
url Url
</th> </th>
<th> <th>
current Current
</th> </th>
<th> <th>
brief Brief
</th> </th>
<th> <th>
&nbsp; &nbsp;

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-options-Options.html generated 2018-07-05T10:14:18.435Z by adl.to-selmer-templates. <!-- File list-options-Options.html generated 2018-07-07T08:09:49.921Z 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).-->
@ -45,7 +45,7 @@ Add a new Option
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
&nbsp; &nbsp;

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-roles-Roles.html generated 2018-07-05T10:14:18.456Z by adl.to-selmer-templates. <!-- File list-roles-Roles.html generated 2018-07-07T08:09:49.939Z 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).-->
@ -45,10 +45,10 @@ Add a new Role
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
name Name
</th> </th>
<th> <th>
&nbsp; &nbsp;

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-teams-Teams.html generated 2018-07-05T10:14:18.431Z by adl.to-selmer-templates. <!-- File list-teams-Teams.html generated 2018-07-07T08:09:49.917Z 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).-->
@ -45,19 +45,19 @@ Add a new Team
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
name Name
</th> </th>
<th> <th>
district_id District_id
</th> </th>
<th> <th>
latitude Latitude
</th> </th>
<th> <th>
longitude Longitude
</th> </th>
<th> <th>
&nbsp; &nbsp;

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
<!-- File list-visits-Visits.html generated 2018-07-05T10:14:18.430Z by adl.to-selmer-templates. <!-- File list-visits-Visits.html generated 2018-07-07T08:09:49.916Z 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).-->
@ -45,16 +45,16 @@ Add a new Visit
<thead> <thead>
<tr> <tr>
<th> <th>
id Id
</th> </th>
<th> <th>
address_id Address_id
</th> </th>
<th> <th>
canvasser_id Canvasser_id
</th> </th>
<th> <th>
date Date
</th> </th>
<th> <th>
&nbsp; &nbsp;

View file

@ -5,11 +5,11 @@
<!-- head: if you want entire custom head content, override this block. --> <!-- head: if you want entire custom head content, override this block. -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/> <meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" type="text/css" href="css/yyy-common.css" /> {% style "/css/yyy-common.css" %}
<link rel="stylesheet" type="text/css" href="css/yyy-site.css" /> {% style "/css/yyy-site.css" %}
<link rel="stylesheet" type="text/css" href="css/spinner.css" /> {% style "/css/spinner.css" %}
<link href="https://fonts.googleapis.com/css?family=Archivo+Black|Archivo+Narrow" rel="stylesheet"/> <link href="https://fonts.googleapis.com/css?family=Archivo+Black|Archivo+Narrow" rel="stylesheet"/>
{% script "js/lib/node_modules/jquery/dist/jquery.min.js" %} {% script "/js/lib/node_modules/jquery/dist/jquery.min.js" %}
<title>{{site-title}}: {{title}}</title> <title>{{site-title}}: {{title}}</title>
{% endblock %} {% endblock %}
{% block extra-head %} {% block extra-head %}

View file

@ -1,38 +1,7 @@
<!DOCTYPE html> {% extends "base.html" %}
<html> {% block big-links %}
<head> {% endblock %}
<title>Something bad happened</title> {% block content %}
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% style "/assets/bootstrap/css/bootstrap.min.css" %}
{% style "/assets/bootstrap/css/bootstrap-theme.min.css" %}
<style type="text/css">
html {
height: 100%;
min-height: 100%;
min-width: 100%;
overflow: hidden;
width: 100%;
}
html body {
height: 100%;
margin: 0;
padding: 0;
width: 100%;
}
html .container-fluid {
display: table;
height: 100%;
padding: 0;
width: 100%;
}
html .row-fluid {
display: table-cell;
height: 100%;
vertical-align: middle;
}
</style>
</head>
<body> <body>
<div class="container-fluid"> <div class="container-fluid">
<div class="row-fluid"> <div class="row-fluid">
@ -52,5 +21,5 @@
</div> </div>
</div> </div>
</div> </div>
</body> {% endblock %}
</html>

View file

@ -9,39 +9,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<img id="site-logo" src="img/ProjectHopeLogo4.png" alt="{{site-title}}" style="float: left;" height="345" width="345"/> <img id="site-logo" src="img/ProjectHopeLogo4.png" alt="{{site-title}}" style="float: left;" height="345" width="345"/>
<h2> {{motd|safe}}
Alpha test code
</h2>
<p>
This is a voter intention information system intended to be used by the 'Yes' side in the next independence referendum.
Design documentation is <a href="https://github.com/simon-brooke/youyesyet/blob/master/doc/specification/userspec.md">here</a>.</p>
<p>Although addresses in the database mostly are real, all personal data in the database
is randomly generated and does not represent real people.</p>
<h3>
The Canvasser app
</h3>
<p>Because the canvasser app now loads data from the database and uses your current location, and the database currently only holds
data for the Castle Douglas area, you're unlikely to see any actual data in the app. A dummy of the app in which you can see
data is <a href="http://www.journeyman.cc/~simon/tmp/yyy-dummy-2/">here</a>.
</p>
<p>
The app currently works on the Chrome browser, and on Android phones. I don't yet know whether it works on iPhones. It does not at
present work with Firefox.
</p>
<h3>
The Admin system
</h3>
<p>'Save' and 'Delete' buttons on administrative pages do not work; this is intentional at this stage.
I want you to be able to see what different roles in the project can see, without actually being able
to mess up the database.</p>
<p>If you encounter problems, please submit a report <a href="https://github.com/simon-brooke/youyesyet/issues">here</a>.
General feedback on usability is also appreciated.</p>
</p>
{% endblock %} {% endblock %}

View file

@ -11,7 +11,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<form action="auth" method="post"> <form action="login" method="post">
{% csrf-field %} {% csrf-field %}
<h2> <h2>
Or use a test username and password Or use a test username and password

View file

@ -5,7 +5,7 @@
{% block big-links %} {% block big-links %}
{% for role in roles %} {% for role in roles %}
<div class="big-link-container"> <div class="big-link-container">
<a href="{{role.name|lower}}" class="big-link" id="big-link">{{role.name}}</a> <a href="roles/{{role.link|lower}}" class="big-link" id="big-link">{{role.name}}</a>
</div> </div>
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}

View file

@ -0,0 +1 @@

View file

@ -1,7 +1,7 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block big-links %} {% block big-links %}
<div class="big-link-container"> <div class="big-link-container">
<a href="auth" class="big-link" id="yes-link">Yes</a> <a href="login" class="big-link" id="yes-link">Yes</a>
</div> </div>
<div class="big-link-container"> <div class="big-link-container">
<a href="register" class="big-link" id="signup-link">No</a> <a href="register" class="big-link" id="signup-link">No</a>

View file

@ -11,7 +11,7 @@
clojure.lang.IPersistentMap clojure.lang.IPersistentMap
clojure.lang.IPersistentVector clojure.lang.IPersistentVector
[java.sql [java.sql
BatchUpdateException ;; BatchUpdateException
Date Date
Timestamp Timestamp
PreparedStatement])) PreparedStatement]))

View file

@ -14,6 +14,8 @@
[youyesyet.routes.auto-json :refer [auto-rest-routes]] [youyesyet.routes.auto-json :refer [auto-rest-routes]]
[youyesyet.routes.auto :refer [auto-selmer-routes]] [youyesyet.routes.auto :refer [auto-selmer-routes]]
[youyesyet.routes.rest :refer [rest-routes]] [youyesyet.routes.rest :refer [rest-routes]]
[youyesyet.routes.roles :refer [roles-routes]]
[youyesyet.routes.services :refer [service-routes]]
[youyesyet.env :refer [defaults]])) [youyesyet.env :refer [defaults]]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -61,11 +63,15 @@
(shutdown-agents) (shutdown-agents)
(log/info "youyesyet has shut down!")) (log/info "youyesyet has shut down!"))
(def app-routes (def app-routes
(routes (routes
(-> #'home-routes (-> #'home-routes
(wrap-routes middleware/wrap-csrf) (wrap-routes middleware/wrap-csrf)
(wrap-routes middleware/wrap-formats)) (wrap-routes middleware/wrap-formats))
(-> #'roles-routes
(wrap-routes middleware/wrap-csrf)
(wrap-routes middleware/wrap-formats))
(-> #'auto-rest-routes (-> #'auto-rest-routes
(wrap-routes middleware/wrap-csrf) (wrap-routes middleware/wrap-csrf)
(wrap-routes middleware/wrap-formats)) (wrap-routes middleware/wrap-formats))
@ -76,12 +82,15 @@
(wrap-routes middleware/wrap-formats)) (wrap-routes middleware/wrap-formats))
(-> #'rest-routes (-> #'rest-routes
(wrap-routes middleware/wrap-formats)) (wrap-routes middleware/wrap-formats))
(-> #'service-routes
(wrap-routes middleware/wrap-formats)) ;; TODO: and authentication, but let's not sweat the small stuff.
'oauth-routes 'oauth-routes
(route/resources "/") (route/resources "/")
(route/not-found (route/not-found
(:body (:body
(error-page {:status 404 (error-page {:status 404
:title "page not found"}))))) :title "Page not found"
:message "The page you requested has not yet been implemented"})))))
(def app (middleware/wrap-base #'app-routes)) (def app (middleware/wrap-base #'app-routes))

View file

@ -90,4 +90,4 @@
[error-details] [error-details]
{:status (:status error-details) {:status (:status error-details)
:headers {"Content-Type" "text/html; charset=utf-8"} :headers {"Content-Type" "text/html; charset=utf-8"}
:body (parser/render-file "error.html" error-details)}) :body (render "error.html" {} error-details)})

View file

@ -1,6 +1,6 @@
(ns (ns
youyesyet.routes.auto youyesyet.routes.auto
"User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180705T101418.070Z" "User interface routes for Youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180707T080949.557Z"
(:require (:require
[adl-support.core :as support] [adl-support.core :as support]
[clojure.java.io :as io] [clojure.java.io :as io]
@ -63,8 +63,8 @@
(do (db/create-address! db/*db* p) {:message "Saved record"})) (do (db/create-address! db/*db* p) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -114,8 +114,8 @@
{:message "Saved record"})) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -165,8 +165,8 @@
{:message "Saved record"})) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -220,8 +220,8 @@
{:message "Saved record"})) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -271,8 +271,8 @@
{:message "Saved record"})) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -320,8 +320,8 @@
(do (db/create-elector! db/*db* p) {:message "Saved record"})) (do (db/create-elector! db/*db* p) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -331,6 +331,53 @@
{:dwellings (db/list-dwellings db/*db*)} {:dwellings (db/list-dwellings db/*db*)}
{:genders (db/list-genders db/*db*)})))))) {:genders (db/list-genders db/*db*)}))))))
(defn
form-events-Events
[r]
(let
[p (support/massage-params (:params r) (:form-params r) #{"id"})]
(l/render
(support/resolve-template "form-events-Events.html")
(:session r)
(merge
{:title "Events", :params p}
(reduce
merge
(merge
(cond
(:save-button p)
(try
(if
(some #{"id"} (map name (keys p)))
(do (db/update-event! db/*db* p) {:message "Updated record"})
(do (db/create-event! db/*db* p) {:message "Saved record"}))
(catch
java.lang.Exception
any__2085__auto__
{:error (.getMessage any__2085__auto__)})))
{:record
(if
(empty? (remove nil? (vals p)))
[]
(db/get-event db/*db* p))})
(list {:teams (db/list-teams db/*db*)}))))))
(defn
list-events-Events
[r]
(let
[p (support/massage-params (:params r) (:form-params r) #{"id"})]
(l/render
(support/resolve-template "list-events-Events.html")
(:session r)
(merge
{:title "Events", :params p}
{:records
(if
(not (empty? (remove nil? (vals p))))
(db/search-strings-events db/*db* p)
(db/list-events db/*db* {}))}))))
(defn (defn
list-followupactions-Followupactions list-followupactions-Followupactions
[r] [r]
@ -375,8 +422,8 @@
{:message "Saved record"})) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -430,8 +477,8 @@
{:message "Saved record"})) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -483,8 +530,8 @@
{:message "Saved record"})) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -534,8 +581,8 @@
(do (db/create-gender! db/*db* p) {:message "Saved record"})) (do (db/create-gender! db/*db* p) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -547,7 +594,7 @@
list-intentions-Intentions list-intentions-Intentions
[r] [r]
(let (let
[p (support/massage-params (:params r) (:form-params r) #{"Id"})] [p (support/massage-params (:params r) (:form-params r) #{"id"})]
(l/render (l/render
(support/resolve-template "list-intentions-Intentions.html") (support/resolve-template "list-intentions-Intentions.html")
(:session r) (:session r)
@ -563,7 +610,7 @@
form-intentions-Intention form-intentions-Intention
[r] [r]
(let (let
[p (support/massage-params (:params r) (:form-params r) #{"Id"})] [p (support/massage-params (:params r) (:form-params r) #{"id"})]
(l/render (l/render
(support/resolve-template "form-intentions-Intention.html") (support/resolve-template "form-intentions-Intention.html")
(:session r) (:session r)
@ -576,7 +623,7 @@
(:save-button p) (:save-button p)
(try (try
(if (if
(some #{"Id"} (map name (keys p))) (some #{"id"} (map name (keys p)))
(do (do
(db/update-intention! db/*db* p) (db/update-intention! db/*db* p)
{:message "Updated record"}) {:message "Updated record"})
@ -585,8 +632,8 @@
{:message "Saved record"})) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -635,8 +682,8 @@
(do (db/create-issue! db/*db* p) {:message "Saved record"})) (do (db/create-issue! db/*db* p) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -682,8 +729,8 @@
(do (db/create-option! db/*db* p) {:message "Saved record"})) (do (db/create-option! db/*db* p) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -729,8 +776,8 @@
(do (db/create-role! db/*db* p) {:message "Saved record"})) (do (db/create-role! db/*db* p) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -776,8 +823,8 @@
(do (db/create-team! db/*db* p) {:message "Saved record"})) (do (db/create-team! db/*db* p) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -826,8 +873,8 @@
(do (db/create-visit! db/*db* p) {:message "Saved record"})) (do (db/create-visit! db/*db* p) {:message "Saved record"}))
(catch (catch
java.lang.Exception java.lang.Exception
any__2078__auto__ any__2085__auto__
{:error (.getMessage any__2078__auto__)}))) {:error (.getMessage any__2085__auto__)})))
{:record {:record
(if (if
(empty? (remove nil? (vals p))) (empty? (remove nil? (vals p)))
@ -924,6 +971,16 @@
request request
(route/restricted (route/restricted
(apply (resolve-handler "form-electors-Elector") (list request)))) (apply (resolve-handler "form-electors-Elector") (list request))))
(GET
"/form-events-Events"
request
(route/restricted
(apply (resolve-handler "form-events-Events") (list request))))
(POST
"/form-events-Events"
request
(route/restricted
(apply (resolve-handler "form-events-Events") (list request))))
(GET (GET
"/form-followupactions-Followupaction" "/form-followupactions-Followupaction"
request request
@ -1120,6 +1177,16 @@
request request
(route/restricted (route/restricted
(apply (resolve-handler "list-electors-Electors") (list request)))) (apply (resolve-handler "list-electors-Electors") (list request))))
(GET
"/list-events-Events"
request
(route/restricted
(apply (resolve-handler "list-events-Events") (list request))))
(POST
"/list-events-Events"
request
(route/restricted
(apply (resolve-handler "list-events-Events") (list request))))
(GET (GET
"/list-followupactions-Followupactions" "/list-followupactions-Followupactions"
request request

View file

@ -1,6 +1,6 @@
(ns (ns
youyesyet.routes.auto-json youyesyet.routes.auto-json
"JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180705T101417.082Z" "JSON routes for youyesyet auto-generated by [Application Description Language framework](https://github.com/simon-brooke/adl) at 20180707T080948.404Z"
(:require (:require
[adl-support.core :as support] [adl-support.core :as support]
[clojure.core.memoize :as memo] [clojure.core.memoize :as memo]
@ -37,7 +37,7 @@
(defn (defn
create-canvasser! create-canvasser!
"Auto-generated method to insert one record to the `canvassers` table. Expects the following key(s) to be present in `params`: `(:username :fullname :elector_id :address_id :phone :email :authority_id :authorised)`. Returns a map containing the keys `#{\"id\"}` identifying the record created." "Auto-generated method to insert one record to the `canvassers` table. Expects the following key(s) to be present in `params`: `(:username :fullname :avatar :bio :elector_id :address_id :phone :email :authority_id :authorised)`. Returns a map containing the keys `#{\"id\"}` identifying the record created."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let (let
[result [result
@ -79,6 +79,17 @@
(support/massage-params params form-params #{"id"}))] (support/massage-params params form-params #{"id"}))]
(response/ok result))) (response/ok result)))
(defn
create-event!
"Auto-generated method to insert one record to the `events` table. Expects the following key(s) to be present in `params`: `(:name :date :time :decription :cancelled)`. Returns a map containing the keys `#{\"id\"}` identifying the record created."
[{:keys [params form-params]}]
(let
[result
(db/create-event!
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/ok result)))
(defn (defn
create-followupaction! create-followupaction!
"Auto-generated method to insert one record to the `followupactions` table. Expects the following key(s) to be present in `params`: `(:request_id :actor :date :notes :closed)`. Returns a map containing the keys `#{\"id\"}` identifying the record created." "Auto-generated method to insert one record to the `followupactions` table. Expects the following key(s) to be present in `params`: `(:request_id :actor :date :notes :closed)`. Returns a map containing the keys `#{\"id\"}` identifying the record created."
@ -125,13 +136,13 @@
(defn (defn
create-intention! create-intention!
"Auto-generated method to insert one record to the `intentions` table. Expects the following key(s) to be present in `params`: `(:visit_id :elector_id :option_id :locality)`. Returns a map containing the keys `#{\"Id\"}` identifying the record created." "Auto-generated method to insert one record to the `intentions` table. Expects the following key(s) to be present in `params`: `(:visit_id :elector_id :option_id :locality)`. Returns a map containing the keys `#{\"id\"}` identifying the record created."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let (let
[result [result
(db/create-intention! (db/create-intention!
db/*db* db/*db*
(support/massage-params params form-params #{"Id"}))] (support/massage-params params form-params #{"id"}))]
(response/ok result))) (response/ok result)))
(defn (defn
@ -193,176 +204,153 @@
delete-address! delete-address!
"Auto-generated method to delete one record from the `addresses` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `addresses` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-address!
[result db/*db*
(db/delete-address! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
delete-authority! delete-authority!
"Auto-generated method to delete one record from the `authorities` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `authorities` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-authority!
[result db/*db*
(db/delete-authority! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
delete-canvasser! delete-canvasser!
"Auto-generated method to delete one record from the `canvassers` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `canvassers` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-canvasser!
[result db/*db*
(db/delete-canvasser! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
delete-district! delete-district!
"Auto-generated method to delete one record from the `districts` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `districts` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-district!
[result db/*db*
(db/delete-district! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
delete-dwelling! delete-dwelling!
"Auto-generated method to delete one record from the `dwellings` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `dwellings` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-dwelling!
[result db/*db*
(db/delete-dwelling! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
delete-elector! delete-elector!
"Auto-generated method to delete one record from the `electors` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `electors` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-elector!
[result db/*db*
(db/delete-elector! (support/massage-params params form-params #{"id"}))
db/*db* (response/found "/")))
(support/massage-params params form-params #{"id"}))]
(defn
delete-event!
"Auto-generated method to delete one record from the `events` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}]
((db/delete-event!
db/*db*
(support/massage-params params form-params #{"id"}))
(response/found "/"))) (response/found "/")))
(defn (defn
delete-followupaction! delete-followupaction!
"Auto-generated method to delete one record from the `followupactions` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `followupactions` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-followupaction!
[result db/*db*
(db/delete-followupaction! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
delete-followupmethod! delete-followupmethod!
"Auto-generated method to delete one record from the `followupmethods` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `followupmethods` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-followupmethod!
[result db/*db*
(db/delete-followupmethod! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
delete-followuprequest! delete-followuprequest!
"Auto-generated method to delete one record from the `followuprequests` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `followuprequests` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-followuprequest!
[result db/*db*
(db/delete-followuprequest! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
delete-gender! delete-gender!
"Auto-generated method to delete one record from the `genders` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `genders` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-gender!
[result db/*db*
(db/delete-gender! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
delete-intention! delete-intention!
"Auto-generated method to delete one record from the `intentions` table. Expects the following key(s) to be present in `params`: `#{\"Id\"}`." "Auto-generated method to delete one record from the `intentions` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-intention!
[result db/*db*
(db/delete-intention! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"Id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
delete-issue! delete-issue!
"Auto-generated method to delete one record from the `issues` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `issues` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-issue!
[result db/*db*
(db/delete-issue! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
delete-option! delete-option!
"Auto-generated method to delete one record from the `options` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `options` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-option!
[result db/*db*
(db/delete-option! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
delete-role! delete-role!
"Auto-generated method to delete one record from the `roles` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `roles` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-role!
[result db/*db*
(db/delete-role! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
delete-team! delete-team!
"Auto-generated method to delete one record from the `teams` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `teams` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-team!
[result db/*db*
(db/delete-team! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
delete-visit! delete-visit!
"Auto-generated method to delete one record from the `visits` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`." "Auto-generated method to delete one record from the `visits` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/delete-visit!
[result db/*db*
(db/delete-visit! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(def (def
@ -463,6 +451,17 @@
:ttl/threshold :ttl/threshold
100000000)) 100000000))
(defn
get-event
"Auto-generated method to select one record from the `events` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`. Returns a map containing the following keys: `clojure.lang.LazySeq@3ac90901`."
[{:keys [params form-params]}]
(let
[result
(db/get-event
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/ok result)))
(defn (defn
get-followupaction get-followupaction
"Auto-generated method to select one record from the `followupactions` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`. Returns a map containing the following keys: `clojure.lang.LazySeq@6b32af0e`." "Auto-generated method to select one record from the `followupactions` table. Expects the following key(s) to be present in `params`: `#{\"id\"}`. Returns a map containing the following keys: `clojure.lang.LazySeq@6b32af0e`."
@ -525,7 +524,7 @@
[result [result
(db/get-intention (db/get-intention
db/*db* db/*db*
(support/massage-params params form-params #{"Id"}))] (support/massage-params params form-params #{"id"}))]
(response/ok result))) (response/ok result)))
:ttl/threshold :ttl/threshold
100000)) 100000))
@ -738,6 +737,22 @@
[{:keys [params]}] [{:keys [params]}]
(do (db/list-electors-by-gender params))) (do (db/list-electors-by-gender params)))
(defn
list-events
"Auto-generated method to select all records from the `events` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(:name :teams :date :time :decription :cancelled :id)`."
[{:keys [params form-params]}]
(let
[result
(db/list-events
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/ok result)))
(defn
list-events-by-team
[{:keys [params]}]
(do (db/list-events-by-team params)))
(defn (defn
list-followupactions list-followupactions
"Auto-generated method to select all records from the `followupactions` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(:request_id :actor :date :notes :closed :id)`." "Auto-generated method to select all records from the `followupactions` table. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(:request_id :actor :date :notes :closed :id)`."
@ -830,7 +845,7 @@
[result [result
(db/list-intentions (db/list-intentions
db/*db* db/*db*
(support/massage-params params form-params #{"Id"}))] (support/massage-params params form-params #{"id"}))]
(response/ok result))) (response/ok result)))
:ttl/threshold :ttl/threshold
100000)) 100000))
@ -1029,6 +1044,17 @@
:ttl/threshold :ttl/threshold
100000000)) 100000000))
(defn
search-strings-events
"Auto-generated method to select all records from the `events` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(:name :teams :date :time :decription :cancelled :id)`."
[{:keys [params form-params]}]
(let
[result
(db/search-strings-events
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/ok result)))
(defn (defn
search-strings-followupactions search-strings-followupactions
"Auto-generated method to select all records from the `followupactions` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(:request_id :actor :date :notes :closed :id)`." "Auto-generated method to select all records from the `followupactions` table with any text field matching the value of the key `:pattern` which should be in the request. If the keys `(:limit :offset)` are present in the request then they will be used to page through the data. Returns a sequence of maps each containing the following keys: `(:request_id :actor :date :notes :closed :id)`."
@ -1091,7 +1117,7 @@
[result [result
(db/search-strings-intentions (db/search-strings-intentions
db/*db* db/*db*
(support/massage-params params form-params #{"Id"}))] (support/massage-params params form-params #{"id"}))]
(response/ok result))) (response/ok result)))
:ttl/threshold :ttl/threshold
100000)) 100000))
@ -1170,176 +1196,153 @@
update-address! update-address!
"Auto-generated method to update one record in the `addresses` table. Expects the following key(s) to be present in `params`: `(:address :district_id :id :latitude :locality :longitude :phone :postcode)`." "Auto-generated method to update one record in the `addresses` table. Expects the following key(s) to be present in `params`: `(:address :district_id :id :latitude :locality :longitude :phone :postcode)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-address!
[result db/*db*
(db/update-address! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
update-authority! update-authority!
"Auto-generated method to update one record in the `authorities` table. Expects the following key(s) to be present in `params`: `(:access-token-uri :authorize-uri :consumer-key :consumer-secret :id :request-token-uri)`." "Auto-generated method to update one record in the `authorities` table. Expects the following key(s) to be present in `params`: `(:access-token-uri :authorize-uri :consumer-key :consumer-secret :id :request-token-uri)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-authority!
[result db/*db*
(db/update-authority! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
update-canvasser! update-canvasser!
"Auto-generated method to update one record in the `canvassers` table. Expects the following key(s) to be present in `params`: `(:address_id :authorised :authority_id :elector_id :email :fullname :id :phone :username)`." "Auto-generated method to update one record in the `canvassers` table. Expects the following key(s) to be present in `params`: `(:address_id :authorised :authority_id :avatar :bio :elector_id :email :fullname :id :phone :username)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-canvasser!
[result db/*db*
(db/update-canvasser! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
update-district! update-district!
"Auto-generated method to update one record in the `districts` table. Expects the following key(s) to be present in `params`: `(:id :name)`." "Auto-generated method to update one record in the `districts` table. Expects the following key(s) to be present in `params`: `(:id :name)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-district!
[result db/*db*
(db/update-district! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
update-dwelling! update-dwelling!
"Auto-generated method to update one record in the `dwellings` table. Expects the following key(s) to be present in `params`: `(:address_id :id :sub-address)`." "Auto-generated method to update one record in the `dwellings` table. Expects the following key(s) to be present in `params`: `(:address_id :id :sub-address)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-dwelling!
[result db/*db*
(db/update-dwelling! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
update-elector! update-elector!
"Auto-generated method to update one record in the `electors` table. Expects the following key(s) to be present in `params`: `(:dwelling_id :email :gender :id :name :phone)`." "Auto-generated method to update one record in the `electors` table. Expects the following key(s) to be present in `params`: `(:dwelling_id :email :gender :id :name :phone)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-elector!
[result db/*db*
(db/update-elector! (support/massage-params params form-params #{"id"}))
db/*db* (response/found "/")))
(support/massage-params params form-params #{"id"}))]
(defn
update-event!
"Auto-generated method to update one record in the `events` table. Expects the following key(s) to be present in `params`: `(:cancelled :date :decription :id :name :time)`."
[{:keys [params form-params]}]
((db/update-event!
db/*db*
(support/massage-params params form-params #{"id"}))
(response/found "/"))) (response/found "/")))
(defn (defn
update-followupaction! update-followupaction!
"Auto-generated method to update one record in the `followupactions` table. Expects the following key(s) to be present in `params`: `(:actor :closed :date :id :notes :request_id)`." "Auto-generated method to update one record in the `followupactions` table. Expects the following key(s) to be present in `params`: `(:actor :closed :date :id :notes :request_id)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-followupaction!
[result db/*db*
(db/update-followupaction! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
update-followupmethod! update-followupmethod!
"Auto-generated method to update one record in the `followupmethods` table. Expects the following key(s) to be present in `params`: `(:id)`." "Auto-generated method to update one record in the `followupmethods` table. Expects the following key(s) to be present in `params`: `(:id)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-followupmethod!
[result db/*db*
(db/update-followupmethod! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
update-followuprequest! update-followuprequest!
"Auto-generated method to update one record in the `followuprequests` table. Expects the following key(s) to be present in `params`: `(:elector_id :id :issue_id :method_id :visit_id)`." "Auto-generated method to update one record in the `followuprequests` table. Expects the following key(s) to be present in `params`: `(:elector_id :id :issue_id :method_id :visit_id)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-followuprequest!
[result db/*db*
(db/update-followuprequest! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
update-gender! update-gender!
"Auto-generated method to update one record in the `genders` table. Expects the following key(s) to be present in `params`: `(:id)`." "Auto-generated method to update one record in the `genders` table. Expects the following key(s) to be present in `params`: `(:id)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-gender!
[result db/*db*
(db/update-gender! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
update-intention! update-intention!
"Auto-generated method to update one record in the `intentions` table. Expects the following key(s) to be present in `params`: `(:Id :elector_id :locality :option_id :visit_id)`." "Auto-generated method to update one record in the `intentions` table. Expects the following key(s) to be present in `params`: `(:elector_id :id :locality :option_id :visit_id)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-intention!
[result db/*db*
(db/update-intention! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"Id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
update-issue! update-issue!
"Auto-generated method to update one record in the `issues` table. Expects the following key(s) to be present in `params`: `(:brief :current :id :url)`." "Auto-generated method to update one record in the `issues` table. Expects the following key(s) to be present in `params`: `(:brief :current :id :url)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-issue!
[result db/*db*
(db/update-issue! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
update-option! update-option!
"Auto-generated method to update one record in the `options` table. Expects the following key(s) to be present in `params`: `(:id)`." "Auto-generated method to update one record in the `options` table. Expects the following key(s) to be present in `params`: `(:id)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-option!
[result db/*db*
(db/update-option! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
update-role! update-role!
"Auto-generated method to update one record in the `roles` table. Expects the following key(s) to be present in `params`: `(:id :name)`." "Auto-generated method to update one record in the `roles` table. Expects the following key(s) to be present in `params`: `(:id :name)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-role!
[result db/*db*
(db/update-role! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
update-team! update-team!
"Auto-generated method to update one record in the `teams` table. Expects the following key(s) to be present in `params`: `(:district_id :id :latitude :longitude :name)`." "Auto-generated method to update one record in the `teams` table. Expects the following key(s) to be present in `params`: `(:district_id :id :latitude :longitude :name)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-team!
[result db/*db*
(db/update-team! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defn (defn
update-visit! update-visit!
"Auto-generated method to update one record in the `visits` table. Expects the following key(s) to be present in `params`: `(:address_id :canvasser_id :date :id)`." "Auto-generated method to update one record in the `visits` table. Expects the following key(s) to be present in `params`: `(:address_id :canvasser_id :date :id)`."
[{:keys [params form-params]}] [{:keys [params form-params]}]
(let ((db/update-visit!
[result db/*db*
(db/update-visit! (support/massage-params params form-params #{"id"}))
db/*db*
(support/massage-params params form-params #{"id"}))]
(response/found "/"))) (response/found "/")))
(defroutes (defroutes
@ -1368,6 +1371,10 @@
"/json/auto/create-elector" "/json/auto/create-elector"
request request
(route/restricted (create-elector! request))) (route/restricted (create-elector! request)))
(POST
"/json/auto/create-event"
request
(route/restricted (create-event! request)))
(POST (POST
"/json/auto/create-followupaction" "/json/auto/create-followupaction"
request request
@ -1432,6 +1439,10 @@
"/json/auto/delete-elector" "/json/auto/delete-elector"
request request
(route/restricted (delete-elector! request))) (route/restricted (delete-elector! request)))
(POST
"/json/auto/delete-event"
request
(route/restricted (delete-event! request)))
(POST (POST
"/json/auto/delete-followupaction" "/json/auto/delete-followupaction"
request request
@ -1500,6 +1511,10 @@
"/json/auto/get-elector" "/json/auto/get-elector"
request request
(route/restricted (get-elector request))) (route/restricted (get-elector request)))
(GET
"/json/auto/get-event"
request
(route/restricted (get-event request)))
(GET (GET
"/json/auto/get-followupaction" "/json/auto/get-followupaction"
request request
@ -1600,6 +1615,14 @@
"/json/auto/list-electors-by-gender" "/json/auto/list-electors-by-gender"
request request
(route/restricted (list-electors-by-gender request))) (route/restricted (list-electors-by-gender request)))
(GET
"/json/auto/list-events"
request
(route/restricted (list-events request)))
(GET
"/json/auto/list-events-by-team"
request
(route/restricted (list-events-by-team request)))
(GET (GET
"/json/auto/list-followupactions" "/json/auto/list-followupactions"
request request
@ -1720,6 +1743,10 @@
"/json/auto/search-strings-electors" "/json/auto/search-strings-electors"
request request
(route/restricted (search-strings-electors request))) (route/restricted (search-strings-electors request)))
(GET
"/json/auto/search-strings-events"
request
(route/restricted (search-strings-events request)))
(GET (GET
"/json/auto/search-strings-followupactions" "/json/auto/search-strings-followupactions"
request request
@ -1784,6 +1811,10 @@
"/json/auto/update-elector" "/json/auto/update-elector"
request request
(route/restricted (update-elector! request))) (route/restricted (update-elector! request)))
(POST
"/json/auto/update-event"
request
(route/restricted (update-event! request)))
(POST (POST
"/json/auto/update-followupaction" "/json/auto/update-followupaction"
request request

View file

@ -1,9 +1,11 @@
(ns ^{:doc "Routes/pages available to unauthenticated users." (ns ^{:doc "Routes/pages available to unauthenticated users."
:author "Simon Brooke"} youyesyet.routes.home :author "Simon Brooke"} youyesyet.routes.home
(:require [clojure.java.io :as io] (:require [adl-support.utils :refer [safe-name]]
[clojure.java.io :as io]
[clojure.string :as s] [clojure.string :as s]
[clojure.tools.logging :as log] [clojure.tools.logging :as log]
[clojure.walk :refer [keywordize-keys]] [clojure.walk :refer [keywordize-keys]]
[markdown.core :refer [md-to-html-string]]
[noir.util.route :as route] [noir.util.route :as route]
[ring.util.http-response :as response] [ring.util.http-response :as response]
[youyesyet.config :refer [env]] [youyesyet.config :refer [env]]
@ -36,6 +38,16 @@
;;;; ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn motd
[]
"Message of the day data is currently being loaded from a file in resources.
That probably isn't the final solution, but I don't currently have a final
solution"
(let [motd (io/as-file (io/resource (env :motd)))]
(if (.exists motd) (slurp motd) "")))
(defn app-page [request] (defn app-page [request]
(layout/render "app.html" {:title "Canvasser app" (layout/render "app.html" {:title "Canvasser app"
:user (:user (:session request))})) :user (:user (:session request))}))
@ -43,7 +55,9 @@
(defn about-page [] (defn about-page []
(layout/render "about.html" {} {:title (layout/render "about.html" {} {:title
(str "About " (:site-title env))})) (str "About " (:site-title env))
:motd (md-to-html-string (motd))}))
(defn call-me-page [request] (defn call-me-page [request]
@ -58,23 +72,9 @@
:concerns (db-core/list-issues db-core/*db* {})}))) :concerns (db-core/list-issues db-core/*db* {})})))
(defn roles-page [request]
(let
[session (:session request)
user (:user session)
roles (if user (db-core/list-roles-by-canvasser db-core/*db* {:id (:id user)}))]
(cond
roles (layout/render "roles.html"
(:session request)
{:title (str "Welcome " (:fullname user) ", what do you want to do?")
:user user
:roles roles})
(empty? roles)(response/found "/app")
true (assoc (response/found "/login") :session (dissoc session :user)))))
(defn home-page [] (defn home-page []
(layout/render "home.html" {} {:title "You yes yet?"})) (layout/render "home.html" {} {:title "You yes yet?"
:motd (md-to-html-string (motd))}))
(defn login-page (defn login-page
@ -126,17 +126,23 @@
:authorities (db-core/list-authorities db-core/*db*)})))) :authorities (db-core/list-authorities db-core/*db*)}))))
(defn handle-logout
[request]
(dissoc (response/found "home") :user :roles))
(defroutes home-routes (defroutes home-routes
(GET "/" [] (home-page)) (GET "/" [] (home-page))
(GET "/home" [] (home-page)) (GET "/home" [] (home-page))
(GET "/about" [] (about-page)) (GET "/about" [] (about-page))
(GET "/roles" request (route/restricted (roles-page request)))
(GET "/canvassers" [request] (route/restricted (app-page request)))
(GET "/call-me" [] (call-me-page nil)) (GET "/call-me" [] (call-me-page nil))
(POST "/call-me" request (call-me-page request)) (POST "/call-me" request (call-me-page request))
(GET "/auth" request (login-page request)) (GET "/login" request (login-page request))
(POST "/auth" request (login-page request)) (POST "/login" request (login-page request))
(GET "/logout" request (handle-logout request))
(GET "/notyet" [] (layout/render "notyet.html" {} (GET "/notyet" [] (layout/render "notyet.html" {}
{:title "Can we persuade you?"})) {:title "Can we persuade you?"}))
(GET "/supporter" [] (layout/render "supporter.html" {} (GET "/supporter" [] (layout/render "supporter.html" {}
{:title "Have you signed up as a canvasser yet?"}))) {:title "Have you signed up as a canvasser yet?"}))
;; TODO: this should move somewhere else but I'm not sure where yet
(GET "/app" [request] (route/restricted (app-page request))))

View file

@ -0,0 +1,71 @@
(ns ^{:doc "Routes/pages available to authenticated users in specific roles."
:author "Simon Brooke"} youyesyet.routes.roles
(:require [adl-support.utils :refer [safe-name]]
[clojure.tools.logging :as log]
[clojure.walk :refer [keywordize-keys]]
[compojure.core :refer [defroutes GET POST]]
[noir.util.route :as route]
[ring.util.http-response :as response]
[youyesyet.config :refer [env]]
[youyesyet.db.core :as db-core]
[youyesyet.layout :as layout]
[youyesyet.oauth :as oauth]
[youyesyet.routes.auto :as auto]))
(defn roles-page [request]
"Render the routing page for the roles the currently logged in user is member of."
(let
[session (:session request)
user (:user session)
roles (if
user
(db-core/list-roles-by-canvasser db-core/*db* {:id (:id user)}))]
(log/info (str "Roles routing page; user is " user "; roles are " roles))
(cond
roles (layout/render "roles.html"
(:session request)
{:title (str "Welcome " (:fullname user) ", what do you want to do?")
:user user
:roles (map #(assoc % :link (safe-name (:name %) :sql)) roles)})
(empty? roles)(response/found "/app")
true (assoc (response/found "/login") :session (dissoc session :user)))))
(defn admins-page
[request]
(response/found "/admin"))
(defn analysts-page
"My expectation is that analysts will do a lot of their work through QGIS or
some other geographical information system; so there isn't a need to put
anything sophisticated here."
[request]
(response/found "/admin"))
(defn canvassers-page
[request]
(layout/render "roles/canvasser.html" request {}))
(defn issue-experts-page
[request]
(layout/render "roles/issue-experts.html" request {}))
(defn team-organisers-page
[request]
(layout/render "roles/team-orgenisers.html" request {}))
(defroutes roles-routes
(GET "/roles/admins" [request] (route/restricted (admins-page request)))
(GET "/roles/analysts" [request] (route/restricted (analysts-page request)))
(GET "/roles/canvassers" [request] (route/restricted (canvassers-page request)))
(GET "/roles/issue_editors" [request] (route/restricted (auto/list-issues-Issues request)))
(GET "/roles/issue_experts" [request] (route/restricted (issue-experts-page request)))
(GET "/roles/team_organisers" [request] (route/restricted (auto/list-teams-Teams request)))
(GET "/roles" request (route/restricted (roles-page request))))

View file

@ -3,21 +3,26 @@
(ns ^{:doc "REST API." (ns ^{:doc "REST API."
:author "Simon Brooke"} youyesyet.routes.services :author "Simon Brooke"} youyesyet.routes.services
(:require [clj-http.client :as client] (:require [clj-http.client :as client]
[ring.util.http-response :refer :all]
[compojure.api.sweet :refer :all] [compojure.api.sweet :refer :all]
[schema.core :as s])) [ring.util.http-response :refer :all]
[schema.core :as s]
[youyesyet.db.core :as db]))
(defapi service-routes (defapi service-routes
{:swagger {:ui "/swagger-ui" {:swagger {:ui "/swagger-ui"
:spec "/swagger.json" :spec "/swagger.json"
:coercion :schema
:data {:info {:version "1.0.0" :data {:info {:version "1.0.0"
:title "Sample API" :title "Sample API"
:description "Sample Services"}}}} :description "Sample Services"}}}}
(context "/api" [] (context "/api" []
:tags ["thingie"] :tags ["thingie"]
;; (GET "/electors-by-dwelling/:dwelling-id" []
(GET "/electors/:address-id" [] ;; :return map
;; :query-params [dwelling-id :- s/Int]
;; :summary ""
;; (db/list-electors-by-dwelling db/*db* {:id dwelling-id}))
(GET "/plus" [] (GET "/plus" []
:return Long :return Long
@ -47,4 +52,4 @@
:return Long :return Long
:header-params [x :- Long, y :- Long] :header-params [x :- Long, y :- Long]
:summary "x^y with header-parameters" :summary "x^y with header-parameters"
(ok (long (Math/pow x y))))))) (ok (long (Math/pow x y))))))

View file

@ -1,20 +0,0 @@
(ns^{:doc "Custom Selmer tags."
:author "Simon Brooke"}
youyesyet.tags
(:require [selmer.parser :as parser]
[selmer.filters :as filters]
[selmer.util :refer :all]))
(defn if-writable-handler [params tag-content render rdr]
"If the current element is writable by the current user, emit the content of
the if clause; else emit the content of the else clause."
(let [{if-tags :ifwritable else-tags :else} (tag-content rdr :ifwritable :else :endifwritable)]
params))
(defn if-readable-handler [params tag-content render rdr]
"If the current element is readable by the current user, emit the content of
the if clause; else emit the content of the else clause."
(let [{if-tags :ifreadable else-tags :else} (tag-content rdr :ifwritable :else :endifwritable)]
params))

View file

@ -39,7 +39,7 @@
[:div [:div
[:h1 "You Yes Yet?"] [:h1 "You Yes Yet?"]
[:div.container {:id "main-container"} [:div.container {:id "main-container"}
[:h2 "Pre-alpha/proof of concept"] [:h2 "Alpha test code"]
[:p.motd {:dangerouslySetInnerHTML [:p.motd {:dangerouslySetInnerHTML
{:__html (md->html motd)}}] {:__html (md->html motd)}}]
[:p [:p

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff