0.1.0 First public alpha
|
|
@ -1,669 +0,0 @@
|
|||
--------------------------------------------------------------------------------
|
||||
----
|
||||
---- 20161014170335-basic-setup.up.sql: database schema for youyesyet.
|
||||
----
|
||||
---- This program is free software; you can redistribute it and/or
|
||||
---- modify it under the terms of the GNU General Public License
|
||||
---- as published by the Free Software Foundation; either version 2
|
||||
---- of the License, or (at your option) any later version.
|
||||
----
|
||||
---- This program is distributed in the hope that it will be useful,
|
||||
---- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
---- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
---- GNU General Public License for more details.
|
||||
----
|
||||
---- You should have received a copy of the GNU General Public License
|
||||
---- along with this program; if not, write to the Free Software
|
||||
---- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
---- USA.
|
||||
----
|
||||
---- Copyright (C) 2016 Simon Brooke for Radical Independence Campaign
|
||||
----
|
||||
--------------------------------------------------------------------------------
|
||||
----
|
||||
---- NOTE
|
||||
---- This file is essentially a Postgres schema dump of a database schema which was
|
||||
---- created with the function initdb! in the file src/clj/youyesyet/db/schema.clj.
|
||||
---- This file has then been mildly massaged to work with Migratus.
|
||||
---- Either this file or src/clj/youyesyet/db/schema.clj is redundant; schema.clj
|
||||
---- represents the older, Korma, way of doing things but does not readily allow
|
||||
---- for migrations; this file represents the newer Migratus/HugSQL way. I'm not
|
||||
---- certain which of these paths I'm going to go down.
|
||||
----
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
SET statement_timeout = 0;
|
||||
--;;
|
||||
SET lock_timeout = 0;
|
||||
--;;
|
||||
SET client_encoding = 'UTF8';
|
||||
--;;
|
||||
SET standard_conforming_strings = on;
|
||||
--;;
|
||||
SET check_function_bodies = false;
|
||||
--;;
|
||||
SET client_min_messages = warning;
|
||||
--;;
|
||||
--
|
||||
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
|
||||
--
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
||||
--;;
|
||||
|
||||
--
|
||||
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
|
||||
--
|
||||
|
||||
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
||||
--;;
|
||||
|
||||
SET search_path = public, pg_catalog;
|
||||
--;;
|
||||
SET default_tablespace = '';
|
||||
--;;
|
||||
SET default_with_oids = false;
|
||||
--;;
|
||||
--
|
||||
-- Name: addresses; Type: TABLE; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS addresses (
|
||||
id integer NOT NULL,
|
||||
address character varying(256) NOT NULL,
|
||||
postcode character varying(16),
|
||||
phone character varying(16),
|
||||
district_id integer,
|
||||
latitude real,
|
||||
longitude real
|
||||
);
|
||||
--;;
|
||||
|
||||
ALTER TABLE public.addresses OWNER TO youyesyet;
|
||||
--;;
|
||||
--
|
||||
-- Name: addresses_id_seq; Type: SEQUENCE; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
CREATE SEQUENCE addresses_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
--;;
|
||||
|
||||
ALTER TABLE public.addresses_id_seq OWNER TO youyesyet;
|
||||
--;;
|
||||
--
|
||||
-- Name: addresses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER SEQUENCE addresses_id_seq OWNED BY addresses.id;
|
||||
--;;
|
||||
|
||||
--
|
||||
-- Name: authorities; Type: TABLE; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS authorities (
|
||||
id character varying(32) NOT NULL
|
||||
);
|
||||
--;;
|
||||
|
||||
ALTER TABLE public.authorities OWNER TO youyesyet;
|
||||
--;;
|
||||
--
|
||||
-- Name: canvassers; Type: TABLE; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS canvassers (
|
||||
id serial,
|
||||
username character varying(32) NOT NULL,
|
||||
fullname character varying(64) NOT NULL,
|
||||
elector_id integer,
|
||||
address_id integer NOT NULL,
|
||||
phone character varying(16),
|
||||
email character varying(128),
|
||||
authority_id character varying(32) NOT NULL,
|
||||
introduced_by int references canvassers(id),
|
||||
authorised boolean
|
||||
);
|
||||
--;;
|
||||
|
||||
ALTER TABLE public.canvassers OWNER TO youyesyet;
|
||||
--;;
|
||||
--
|
||||
-- Name: districts; Type: TABLE; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS districts (
|
||||
id integer NOT NULL,
|
||||
name character varying(64) NOT NULL
|
||||
);
|
||||
--;;
|
||||
|
||||
ALTER TABLE public.districts OWNER TO youyesyet;
|
||||
--;;
|
||||
--
|
||||
-- Name: electors; Type: TABLE; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS electors (
|
||||
id integer NOT NULL,
|
||||
name character varying(64) NOT NULL,
|
||||
address_id integer NOT NULL,
|
||||
phone character varying(16),
|
||||
email character varying(128)
|
||||
);
|
||||
--;;
|
||||
|
||||
ALTER TABLE public.electors OWNER TO youyesyet;
|
||||
--;;
|
||||
--
|
||||
-- Name: followupactions; Type: TABLE; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS followupactions (
|
||||
id integer NOT NULL,
|
||||
request_id integer NOT NULL,
|
||||
actor integer NOT NULL,
|
||||
date timestamp with time zone DEFAULT now() NOT NULL,
|
||||
notes text,
|
||||
closed boolean
|
||||
);
|
||||
--;;
|
||||
|
||||
ALTER TABLE public.followupactions OWNER TO youyesyet;
|
||||
|
||||
--
|
||||
-- Name: followupactions_id_seq; Type: SEQUENCE; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
CREATE SEQUENCE followupactions_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
--;;
|
||||
|
||||
ALTER TABLE public.followupactions_id_seq OWNER TO youyesyet;
|
||||
--;;
|
||||
--
|
||||
-- Name: followupactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER SEQUENCE followupactions_id_seq OWNED BY followupactions.id;
|
||||
--;;
|
||||
|
||||
--
|
||||
-- Name: followupmethods; Type: TABLE; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS followupmethods (
|
||||
id character varying(32) NOT NULL
|
||||
);
|
||||
--;;
|
||||
|
||||
ALTER TABLE public.followupmethods OWNER TO youyesyet;
|
||||
--;;
|
||||
--
|
||||
-- Name: followuprequests; Type: TABLE; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
insert into followupmethods values ('Telephone');
|
||||
--;;
|
||||
insert into followupmethods values ('eMail');
|
||||
--;;
|
||||
insert into followupmethods values ('Post');
|
||||
--;;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS followuprequests (
|
||||
id integer NOT NULL,
|
||||
elector_id integer NOT NULL,
|
||||
visit_id integer NOT NULL,
|
||||
issue_id character varying(32) NOT NULL,
|
||||
method_id character varying(32) NOT NULL
|
||||
);
|
||||
--;;
|
||||
|
||||
ALTER TABLE public.followuprequests OWNER TO youyesyet;
|
||||
--;;
|
||||
|
||||
--
|
||||
-- Name: followuprequests_id_seq; Type: SEQUENCE; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
CREATE SEQUENCE followuprequests_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
--;;
|
||||
|
||||
|
||||
ALTER TABLE public.followuprequests_id_seq OWNER TO youyesyet;
|
||||
--;;
|
||||
|
||||
--
|
||||
-- Name: followuprequests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER SEQUENCE followuprequests_id_seq OWNED BY followuprequests.id;
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: issueexpertise; Type: TABLE; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS issueexpertise (
|
||||
canvasser_id integer NOT NULL,
|
||||
issue_id character varying(32) NOT NULL,
|
||||
method_id character varying(32) NOT NULL
|
||||
);
|
||||
--;;
|
||||
|
||||
|
||||
ALTER TABLE public.issueexpertise OWNER TO youyesyet;
|
||||
--;;
|
||||
|
||||
--
|
||||
-- Name: issues; Type: TABLE; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS issues (
|
||||
id character varying(32) NOT NULL,
|
||||
url character varying(256)
|
||||
);
|
||||
--;;
|
||||
|
||||
|
||||
ALTER TABLE public.issues OWNER TO youyesyet;
|
||||
--;;
|
||||
|
||||
--
|
||||
-- Name: options; Type: TABLE; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS options (
|
||||
id character varying(32) NOT NULL
|
||||
);
|
||||
--;;
|
||||
|
||||
|
||||
ALTER TABLE public.options OWNER TO youyesyet;
|
||||
--;;
|
||||
|
||||
--
|
||||
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS schema_migrations (
|
||||
id bigint NOT NULL
|
||||
);
|
||||
--;;
|
||||
|
||||
|
||||
ALTER TABLE public.schema_migrations OWNER TO youyesyet;
|
||||
--;;
|
||||
|
||||
--
|
||||
-- Name: visits; Type: TABLE; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS visits (
|
||||
id integer NOT NULL,
|
||||
address_id integer NOT NULL,
|
||||
canvasser_id integer NOT NULL,
|
||||
date timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--;;
|
||||
|
||||
|
||||
ALTER TABLE public.visits OWNER TO youyesyet;
|
||||
--;;
|
||||
|
||||
--
|
||||
-- Name: visits_id_seq; Type: SEQUENCE; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
CREATE SEQUENCE visits_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
--;;
|
||||
|
||||
|
||||
ALTER TABLE public.visits_id_seq OWNER TO youyesyet;
|
||||
--;;
|
||||
|
||||
--
|
||||
-- Name: visits_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER SEQUENCE visits_id_seq OWNED BY visits.id;
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY addresses ALTER COLUMN id SET DEFAULT nextval('addresses_id_seq'::regclass);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY followupactions ALTER COLUMN id SET DEFAULT nextval('followupactions_id_seq'::regclass);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY followuprequests ALTER COLUMN id SET DEFAULT nextval('followuprequests_id_seq'::regclass);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: id; Type: DEFAULT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY visits ALTER COLUMN id SET DEFAULT nextval('visits_id_seq'::regclass);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: addresses_address_key; Type: CONSTRAINT; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY addresses
|
||||
ADD CONSTRAINT addresses_address_key UNIQUE (address);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY addresses
|
||||
ADD CONSTRAINT addresses_pkey PRIMARY KEY (id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: authorities_pkey; Type: CONSTRAINT; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY authorities
|
||||
ADD CONSTRAINT authorities_pkey PRIMARY KEY (id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: canvassers_pkey; Type: CONSTRAINT; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY canvassers
|
||||
ADD CONSTRAINT canvassers_pkey PRIMARY KEY (id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: districts_pkey; Type: CONSTRAINT; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY districts
|
||||
ADD CONSTRAINT districts_pkey PRIMARY KEY (id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: electors_pkey; Type: CONSTRAINT; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY electors
|
||||
ADD CONSTRAINT electors_pkey PRIMARY KEY (id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: followupactions_pkey; Type: CONSTRAINT; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY followupactions
|
||||
ADD CONSTRAINT followupactions_pkey PRIMARY KEY (id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: followupmethods_pkey; Type: CONSTRAINT; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY followupmethods
|
||||
ADD CONSTRAINT followupmethods_pkey PRIMARY KEY (id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: followuprequests_pkey; Type: CONSTRAINT; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY followuprequests
|
||||
ADD CONSTRAINT followuprequests_pkey PRIMARY KEY (id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: issues_pkey; Type: CONSTRAINT; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY issues
|
||||
ADD CONSTRAINT issues_pkey PRIMARY KEY (id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: options_pkey; Type: CONSTRAINT; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY options
|
||||
ADD CONSTRAINT options_pkey PRIMARY KEY (id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: schema_migrations_id_key; Type: CONSTRAINT; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
--ALTER TABLE ONLY schema_migrations
|
||||
-- ADD CONSTRAINT schema_migrations_id_key UNIQUE (id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: visits_pkey; Type: CONSTRAINT; Schema: public; Owner: youyesyet; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY visits
|
||||
ADD CONSTRAINT visits_pkey PRIMARY KEY (id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: addresses_district_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY addresses
|
||||
ADD CONSTRAINT addresses_district_id_fkey FOREIGN KEY (district_id) REFERENCES districts(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: canvassers_address_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY canvassers
|
||||
ADD CONSTRAINT canvassers_address_id_fkey FOREIGN KEY (address_id) REFERENCES addresses(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: canvassers_authority_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY canvassers
|
||||
ADD CONSTRAINT canvassers_authority_id_fkey FOREIGN KEY (authority_id) REFERENCES authorities(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: canvassers_elector_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY canvassers
|
||||
ADD CONSTRAINT canvassers_elector_id_fkey FOREIGN KEY (elector_id) REFERENCES electors(id);
|
||||
--;;
|
||||
|
||||
create unique index canvassers_username_ix on canvassers (username);
|
||||
create unique index canvassers_email_ix on canvassers(email);
|
||||
|
||||
--
|
||||
-- Name: electors_address_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY electors
|
||||
ADD CONSTRAINT electors_address_id_fkey FOREIGN KEY (address_id) REFERENCES addresses(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: followupactions_actor_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY followupactions
|
||||
ADD CONSTRAINT followupactions_actor_fkey FOREIGN KEY (actor) REFERENCES canvassers(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: followupactions_request_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY followupactions
|
||||
ADD CONSTRAINT followupactions_request_id_fkey FOREIGN KEY (request_id) REFERENCES followuprequests(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: followuprequests_elector_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY followuprequests
|
||||
ADD CONSTRAINT followuprequests_elector_id_fkey FOREIGN KEY (elector_id) REFERENCES electors(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: followuprequests_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY followuprequests
|
||||
ADD CONSTRAINT followuprequests_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: followuprequests_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY followuprequests
|
||||
ADD CONSTRAINT followuprequests_method_id_fkey FOREIGN KEY (method_id) REFERENCES followupmethods(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: followuprequests_visit_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY followuprequests
|
||||
ADD CONSTRAINT followuprequests_visit_id_fkey FOREIGN KEY (visit_id) REFERENCES visits(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: issueexpertise_canvasser_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY issueexpertise
|
||||
ADD CONSTRAINT issueexpertise_canvasser_id_fkey FOREIGN KEY (canvasser_id) REFERENCES canvassers(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: issueexpertise_issue_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY issueexpertise
|
||||
ADD CONSTRAINT issueexpertise_issue_id_fkey FOREIGN KEY (issue_id) REFERENCES issues(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: issueexpertise_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY issueexpertise
|
||||
ADD CONSTRAINT issueexpertise_method_id_fkey FOREIGN KEY (method_id) REFERENCES followupmethods(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: visits_address_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY visits
|
||||
ADD CONSTRAINT visits_address_id_fkey FOREIGN KEY (address_id) REFERENCES addresses(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: visits_canvasser_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: youyesyet
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY visits
|
||||
ADD CONSTRAINT visits_canvasser_id_fkey FOREIGN KEY (canvasser_id) REFERENCES canvassers(id);
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- Name: public; Type: ACL; Schema: -; Owner: postgres
|
||||
--
|
||||
|
||||
REVOKE ALL ON SCHEMA public FROM PUBLIC;
|
||||
--;;
|
||||
|
||||
REVOKE ALL ON SCHEMA public FROM postgres;
|
||||
--;;
|
||||
|
||||
GRANT ALL ON SCHEMA public TO postgres;
|
||||
--;;
|
||||
|
||||
GRANT ALL ON SCHEMA public TO PUBLIC;
|
||||
--;;
|
||||
|
||||
|
||||
--
|
||||
-- PostgreSQL database dump complete
|
||||
--
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
drop table teammemberships;
|
||||
|
||||
drop table teamorganiserships;
|
||||
|
||||
drop index ix_teams_name;
|
||||
|
||||
drop table teams;
|
||||
|
||||
drop table rolememberships;
|
||||
|
||||
drop index ix_roles_name;
|
||||
|
||||
drop table roles;
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
create table if not exists roles (
|
||||
id serial primary key,
|
||||
name varchar(64) not null
|
||||
);
|
||||
|
||||
create unique index ix_roles_name on roles(name);
|
||||
|
||||
create table if not exists rolememberships (
|
||||
role_id integer not null references roles(id),
|
||||
canvasser_id integer not null references canvassers(id)
|
||||
);
|
||||
|
||||
create table if not exists teams (
|
||||
id serial primary key,
|
||||
name varchar(64) not null,
|
||||
district_id integer not null references districts(id),
|
||||
latitude real,
|
||||
longitude real
|
||||
);
|
||||
|
||||
create unique index ix_teams_name on teams(name);
|
||||
|
||||
create table if not exists teammemberships (
|
||||
team_id integer not null references teams(id),
|
||||
canvasser_id integer not null references canvassers(id)
|
||||
);
|
||||
|
||||
create table if not exists teamorganiserships (
|
||||
team_id integer not null references teams(id),
|
||||
canvasser_id integer not null references canvassers(id)
|
||||
);
|
||||
|
||||
alter table roles owner to youyesyet;
|
||||
|
||||
alter table rolememberships owner to youyesyet;
|
||||
|
||||
alter table teams owner to youyesyet;
|
||||
|
||||
alter table teammemberships owner to youyesyet;
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
-- this is just a teardown of everything set up in the corresponding .up.sql file
|
||||
|
||||
delete from roles where name = 'Expert';
|
||||
delete from roles where name = 'Administrator';
|
||||
delete from roles where name = 'Recruiter';
|
||||
delete from roles where name = 'Organiser';
|
||||
delete from roles where name = 'Editor';
|
||||
|
||||
alter table issues drop column content;
|
||||
alter table issues drop column current;
|
||||
|
||||
delete from issues where id = 'Currency';
|
||||
delete from issues where id = 'Monarchy';
|
||||
delete from issues where id = 'Defence';
|
||||
|
||||
delete from options where id = 'Yes';
|
||||
delete from options where id = 'No';
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
|
||||
-- We don't explicitly instantiate the 'Canvasser' role since every user is
|
||||
-- deemed to be a canvasser.
|
||||
|
||||
|
||||
-- an 'Expert' is someone with expertise in one or more issues, who is
|
||||
-- trusted to discuss those issues in detail with electors.
|
||||
insert into roles (name) values ('Expert');
|
||||
|
||||
|
||||
-- an 'Administrator' is someone entitled to broadly alter reference data
|
||||
-- throughout the system.
|
||||
insert into roles (name) values ('Administrator');
|
||||
|
||||
|
||||
-- a 'Recruiter' is someone entitled to invite other people to become users
|
||||
-- ('Canvassers'). A Recruiter is entitled to lock the account of anyone they
|
||||
-- have recruited, recursively.
|
||||
insert into roles (name) values ('Recruiter');
|
||||
|
||||
|
||||
-- an 'Organiser' is someone who organises one or more local teams. An Organiser
|
||||
-- is entitled to exclude any Canvasser from any team they organise.
|
||||
insert into roles (name) values ('Organiser');
|
||||
|
||||
|
||||
-- an 'Editor' is someone entitled to add and edit issues.
|
||||
insert into roles (name) values ('Editor');
|
||||
|
||||
-- issue text is local; there may still in addition be a further link to more
|
||||
-- information, but the basic issue text should be part of the issue record.
|
||||
-- The text should fit on a phone screen without scrolling, so is reasonably
|
||||
-- short.
|
||||
alter table issues add column content varchar(1024);
|
||||
|
||||
-- an issue may be current or not current; when not current it is not deleted
|
||||
-- from the system but kept because it may become current again later. Only
|
||||
-- current issues are shown in the app. Typically not fewer than three and not
|
||||
-- more than about seven issues should be current at any time.
|
||||
alter table issues add column current boolean default false;
|
||||
|
||||
insert into issues (id, content, current) values ('Currency',
|
||||
'Scotland could keep the Pound, or use the Euro. But we could also set up a new currency of our own.',
|
||||
true);
|
||||
|
||||
insert into issues (id, content, current) values ('Monarchy',
|
||||
'Scotland could keep the Queen. This is an issue to be decided after independence.',
|
||||
true);
|
||||
|
||||
insert into issues (id, content, current) values ('Defence',
|
||||
'Scotland will not have nuclear weapons, and will probably not choose to engage in far-off wars. But we could remain members of NATO.',
|
||||
true);
|
||||
|
||||
|
||||
insert into options (id) values ('Yes');
|
||||
|
||||
insert into options (id) values ('No');
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
drop view if exists roles_by_canvasser;
|
||||
|
||||
drop view if exists teams_by_canvasser;
|
||||
|
||||
drop view if exists canvassers_by_team;
|
||||
|
||||
drop view if exists canvassers_by_introducer;
|
||||
|
||||
drop view if exists teams_by_organiser;
|
||||
|
||||
drop view if exists organisers_by_team;
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
|
||||
create view roles_by_canvasser as
|
||||
select canvassers.id as canvasser, roles.name
|
||||
from roles, rolememberships, canvassers
|
||||
where roles.id = rolememberships.role_id
|
||||
and canvassers.id = rolememberships.canvasser_id
|
||||
and canvassers.authorised = true;
|
||||
|
||||
create view teams_by_canvasser as
|
||||
select canvassers.id as canvasser, teams.id, teams.name, teams.latitude, teams.longitude
|
||||
from teams, teammemberships, canvassers
|
||||
where teams.id = teammemberships.team_id
|
||||
and canvassers.id = teammemberships.canvasser_id;
|
||||
|
||||
create view canvassers_by_team as
|
||||
select teams.id as team,
|
||||
canvassers.id,
|
||||
canvassers.username,
|
||||
canvassers.fullname,
|
||||
canvassers.email,
|
||||
canvassers.phone
|
||||
from teams, teammemberships, canvassers
|
||||
where teams.id = teammemberships.team_id
|
||||
and canvassers.id = teammemberships.canvasser_id
|
||||
and canvassers.authorised = true;
|
||||
|
||||
create view canvassers_by_introducer as
|
||||
select introducers.id as introducer,
|
||||
canvassers.id as canvasser,
|
||||
canvassers.username,
|
||||
canvassers.fullname,
|
||||
canvassers.email,
|
||||
canvassers.phone,
|
||||
canvassers.authorised
|
||||
from canvassers, canvassers as introducers
|
||||
where introducers.id = canvassers.introduced_by;
|
||||
|
||||
create view teams_by_organiser as
|
||||
select canvassers.id as organiser,
|
||||
teams.id,
|
||||
teams.name,
|
||||
teams.latitude,
|
||||
teams.longitude
|
||||
from teams, teamorganiserships, canvassers
|
||||
where teams.id = teamorganiserships.team_id
|
||||
and canvassers.id = teamorganiserships.canvasser_id
|
||||
and canvassers.authorised = true;
|
||||
|
||||
create view organisers_by_team as
|
||||
select teams.id as team,
|
||||
canvassers.id,
|
||||
canvassers.username,
|
||||
canvassers.fullname,
|
||||
canvassers.email,
|
||||
canvassers.phone
|
||||
from teams, teamorganiserships, canvassers
|
||||
where teams.id = teamorganiserships.team_id
|
||||
and canvassers.id = teamorganiserships.canvasser_id
|
||||
and canvassers.authorised = true;
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
--------------------------------------------------------------------------------
|
||||
----
|
||||
---- 20170721084900.up.sql: add dwellings table, to deal with flatted addresses.
|
||||
----
|
||||
---- This program is free software; you can redistribute it and/or
|
||||
---- modify it under the terms of the GNU General Public License
|
||||
---- as published by the Free Software Foundation; either version 2
|
||||
---- of the License, or (at your option) any later version.
|
||||
----
|
||||
---- This program is distributed in the hope that it will be useful,
|
||||
---- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
---- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
---- GNU General Public License for more details.
|
||||
----
|
||||
---- You should have received a copy of the GNU General Public License
|
||||
---- along with this program; if not, write to the Free Software
|
||||
---- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
---- USA.
|
||||
----
|
||||
---- Copyright (C) 2017 Simon Brooke for Radical Independence Campaign
|
||||
----
|
||||
--------------------------------------------------------------------------------
|
||||
----
|
||||
---- NOTE
|
||||
---- This file is essentially a Postgres schema dump of a database schema which was
|
||||
---- created with the function initdb! in the file src/clj/youyesyet/db/schema.clj.
|
||||
---- This file has then been mildly massaged to work with Migratus.
|
||||
---- Either this file or src/clj/youyesyet/db/schema.clj is redundant; schema.clj
|
||||
---- represents the older, Korma, way of doing things but does not readily allow
|
||||
---- for migrations; this file represents the newer Migratus/HugSQL way. I'm not
|
||||
---- certain which of these paths I'm going to go down.
|
||||
----
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
alter table canvassers add column address_id integer references addresses(id);
|
||||
--;;
|
||||
alter table electors add column address_id integer references addresses(id);
|
||||
--;;
|
||||
alter table visits add column address_id integer references addresses(id);
|
||||
--;;
|
||||
|
||||
update canvassers set address_id =
|
||||
(select address_id from dwellings where id = canvassers.dwelling_id);
|
||||
--;;
|
||||
|
||||
update electors set address_id =
|
||||
(select address_id from dwellings where id = electors.dwelling_id);
|
||||
--;;
|
||||
|
||||
update visits set address_id =
|
||||
(select address_id from dwellings where id = visits.dwelling_id);
|
||||
--;;
|
||||
|
||||
alter table canvassers alter column address_id set not null;
|
||||
--;;
|
||||
alter table electors alter column address_id set not null;
|
||||
--;;
|
||||
alter table visits alter column address_id set not null;
|
||||
--;;
|
||||
|
||||
alter table canvassers drop column dwelling_id;
|
||||
--;;
|
||||
alter table electors drop column dwelling_id;
|
||||
--;;
|
||||
alter table visits drop column dwelling_id;
|
||||
--;;
|
||||
|
||||
drop table if exists dwellings;
|
||||
--;;
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
--------------------------------------------------------------------------------
|
||||
----
|
||||
---- 20170721084900.up.sql: add dwellings table, to deal with flatted addresses.
|
||||
----
|
||||
---- This program is free software; you can redistribute it and/or
|
||||
---- modify it under the terms of the GNU General Public License
|
||||
---- as published by the Free Software Foundation; either version 2
|
||||
---- of the License, or (at your option) any later version.
|
||||
----
|
||||
---- This program is distributed in the hope that it will be useful,
|
||||
---- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
---- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
---- GNU General Public License for more details.
|
||||
----
|
||||
---- You should have received a copy of the GNU General Public License
|
||||
---- along with this program; if not, write to the Free Software
|
||||
---- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
---- USA.
|
||||
----
|
||||
---- Copyright (C) 2017 Simon Brooke for Radical Independence Campaign
|
||||
----
|
||||
--------------------------------------------------------------------------------
|
||||
----
|
||||
---- NOTE
|
||||
---- This file is essentially a Postgres schema dump of a database schema which was
|
||||
---- created with the function initdb! in the file src/clj/youyesyet/db/schema.clj.
|
||||
---- This file has then been mildly massaged to work with Migratus.
|
||||
---- Either this file or src/clj/youyesyet/db/schema.clj is redundant; schema.clj
|
||||
---- represents the older, Korma, way of doing things but does not readily allow
|
||||
---- for migrations; this file represents the newer Migratus/HugSQL way. I'm not
|
||||
---- certain which of these paths I'm going to go down.
|
||||
----
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS dwellings (
|
||||
id serial NOT NULL primary key,
|
||||
address_id integer NOT NULL references addresses(id),
|
||||
sub_address varchar(16)
|
||||
);
|
||||
--;;
|
||||
|
||||
ALTER TABLE public.dwellings OWNER TO youyesyet;
|
||||
--;;
|
||||
|
||||
INSERT INTO dwellings (address_id, sub_address)
|
||||
SELECT DISTINCT id, '' FROM addresses;
|
||||
--;;
|
||||
|
||||
alter table canvassers add column dwelling_id integer references dwellings(id);
|
||||
--;;
|
||||
alter table electors add column dwelling_id integer references dwellings(id);
|
||||
--;;
|
||||
alter table visits add column dwelling_id integer references dwellings(id);
|
||||
--;;
|
||||
|
||||
update canvassers set dwelling_id =
|
||||
(select id from dwellings where address_id = canvassers.address_id);
|
||||
--;;
|
||||
|
||||
update electors set dwelling_id =
|
||||
(select id from dwellings where address_id = electors.address_id);
|
||||
--;;
|
||||
|
||||
update visits set dwelling_id =
|
||||
(select id from dwellings where address_id = visits.address_id);
|
||||
--;;
|
||||
|
||||
alter table canvassers alter column dwelling_id set not null;
|
||||
--;;
|
||||
alter table electors alter column dwelling_id set not null;
|
||||
--;;
|
||||
alter table visits alter column dwelling_id set not null;
|
||||
--;;
|
||||
|
||||
alter table canvassers drop constraint canvassers_address_id_fkey;
|
||||
--;;
|
||||
alter table electors drop constraint electors_address_id_fkey;
|
||||
--;;
|
||||
alter table visits drop constraint visits_address_id_fkey;
|
||||
--;;
|
||||
|
||||
alter table canvassers drop column address_id;
|
||||
--;;
|
||||
alter table electors drop column address_id;
|
||||
--;;
|
||||
alter table visits drop column address_id;
|
||||
--;;
|
||||
9
resources/motd.md
Normal 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.
|
||||
|
|
@ -28,6 +28,12 @@ h1 {
|
|||
margin-top: 0;
|
||||
}
|
||||
|
||||
#signature-pad {
|
||||
width: 300px;
|
||||
border: thin solid white;
|
||||
min-height: 150px;
|
||||
}
|
||||
|
||||
/* desktops and laptops, primarily. Adapted to mouse; targets may be small */
|
||||
@media all and (min-device-width: 1025px) {
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ del {
|
|||
}
|
||||
|
||||
div.content, form, p, pre, h1, h2, h3, h4, h5 {
|
||||
padding: 0.25em 5%;
|
||||
padding: 0.25em 2.5%;
|
||||
}
|
||||
|
||||
dl, menu, ol, table, ul {
|
||||
|
|
@ -78,6 +78,7 @@ header {
|
|||
margin-top: 0;
|
||||
width:100%;
|
||||
max-width: 100%;
|
||||
min-height: 96px; /* yes, we don't approve of pixel values; but this is to ensure the logo fits. */
|
||||
background-color: rgb(7, 57, 106);
|
||||
color: white;
|
||||
}
|
||||
|
|
@ -103,7 +104,7 @@ input, select {
|
|||
padding: 0.25em 1.25em;
|
||||
}
|
||||
|
||||
input.action {
|
||||
input.action, input.action-safe {
|
||||
color: white;
|
||||
background-color: rgb( 50, 109, 177);
|
||||
font-size: 125%;
|
||||
|
|
@ -112,6 +113,7 @@ input.action {
|
|||
input.action-dangerous {
|
||||
color: white;
|
||||
background-color: red;
|
||||
font-size: 125%;
|
||||
}
|
||||
|
||||
input.required:after {
|
||||
|
|
@ -163,7 +165,7 @@ th {
|
|||
#main-container{
|
||||
}
|
||||
|
||||
#back-link, .back-link {
|
||||
.back-link {
|
||||
min-width: 8em;
|
||||
padding: 0.25em 1em;
|
||||
background-color: gray;
|
||||
|
|
@ -173,26 +175,26 @@ th {
|
|||
border-bottom-right-radius: 0.5em;
|
||||
}
|
||||
|
||||
#back-link:hover, #back-link:active, .back-link:hover, .back-link:active, {
|
||||
.back-link:hover, .back-link:active, {
|
||||
text-decoration: none;
|
||||
background-color: rgb(160, 160, 160);
|
||||
}
|
||||
|
||||
#back-link:hover::before, #back-link:active::before {
|
||||
.back-link:hover::before, .back-link:active::before {
|
||||
content: "< ";
|
||||
}
|
||||
|
||||
#back-link-container {
|
||||
.back-link-container {
|
||||
float: left;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#back-link-container, .big-link-container {
|
||||
.back-link-container, .big-link-container {
|
||||
font-size: 200%;
|
||||
padding: 0.5em 0;
|
||||
}
|
||||
|
||||
#back-link-container > #back-link:hover::before, #back-link-container > #back-link:active::before {
|
||||
.back-link-container > .back-link:hover::before, .back-link-container > .back-link:active::before {
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -238,6 +240,11 @@ th {
|
|||
border-bottom: thin solid white;
|
||||
}
|
||||
|
||||
#site-logo {
|
||||
padding: 0.5em;
|
||||
float: left;
|
||||
}
|
||||
|
||||
/* but magically appears on mouseover */
|
||||
#cookies:hover #more-about-cookies {
|
||||
display: block;
|
||||
|
|
@ -248,6 +255,10 @@ th {
|
|||
border: thin solid silver;
|
||||
}
|
||||
|
||||
.editor-toolbar {
|
||||
background-color: silver;
|
||||
}
|
||||
|
||||
.error {
|
||||
width: 100%;
|
||||
background-color: red;
|
||||
|
|
@ -335,7 +346,7 @@ th {
|
|||
/* desktops and laptops, primarily. Adapted to mouse; targets may be small */
|
||||
@media all and (min-device-width: 1025px) {
|
||||
#content {
|
||||
width: 80%;
|
||||
width: 90%;
|
||||
float: right;
|
||||
padding-bottom: 5em;
|
||||
}
|
||||
|
|
|
|||
BIN
resources/public/img/ProjectHopeLogo.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
resources/public/img/ProjectHopeLogo4.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
resources/public/img/authorities/GitHub.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
resources/public/img/authorities/GitHub.xcf
Normal file
BIN
resources/public/img/authorities/Twitter.jpg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
resources/public/img/authorities/Twitter.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
resources/public/img/authorities/Twitter.xcf
Normal file
|
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 983 B After Width: | Height: | Size: 983 B |
|
Before Width: | Height: | Size: 511 B After Width: | Height: | Size: 511 B |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
|
@ -1,6 +1,6 @@
|
|||
--------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------;
|
||||
----
|
||||
---- 20161014170335-basic-setup.down.sql: database schema for youyesyet.
|
||||
---- locality-trigger.sql: compute localities for addresses
|
||||
----
|
||||
---- This program is free software; you can redistribute it and/or
|
||||
---- modify it under the terms of the GNU General Public License
|
||||
|
|
@ -19,32 +19,17 @@
|
|||
----
|
||||
---- Copyright (C) 2016 Simon Brooke for Radical Independence Campaign
|
||||
----
|
||||
--------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------;
|
||||
|
||||
-- intended to reverse out the database changes made in
|
||||
-- 20161014170335-basic-setup.up.sql
|
||||
---- See also: src/cljc/locality.cljc
|
||||
|
||||
drop table addresses cascade;
|
||||
--;;
|
||||
drop table authorities cascade;
|
||||
--;;
|
||||
drop table canvassers cascade;
|
||||
--;;
|
||||
drop table districts cascade;
|
||||
--;;
|
||||
drop table electors cascade;
|
||||
--;;
|
||||
drop table followupactions cascade;
|
||||
--;;
|
||||
drop table followupmethods cascade;
|
||||
--;;
|
||||
drop table followuprequests cascade;
|
||||
--;;
|
||||
drop table issueexpertise cascade;
|
||||
--;;
|
||||
drop table issues cascade;
|
||||
--;;
|
||||
drop table options cascade;
|
||||
--;;
|
||||
drop table visits cascade;
|
||||
--;;
|
||||
CREATE FUNCTION compute_locality() RETURNS trigger AS $compute_locality$
|
||||
BEGIN
|
||||
NEW.locality = (1000 * floor(NEW.latitude * 100)) -
|
||||
floor(NEW.longitude * 100);
|
||||
RETURN NEW;
|
||||
END;
|
||||
$compute_locality$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER compute_locality BEFORE INSERT OR UPDATE ON addresses
|
||||
FOR EACH ROW EXECUTE PROCEDURE compute_locality();
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
------------------------------------------------------------------------------;
|
||||
----
|
||||
---- youyesyet.routes.authenticated: routes and pages for authenticated users.
|
||||
---- queries.sql: manually maintained queries.
|
||||
----
|
||||
---- This program is free software; you can redistribute it and/or
|
||||
---- modify it under the terms of the GNU General Public License
|
||||
|
|
@ -23,322 +23,40 @@
|
|||
|
||||
-- This file gets slurped in and converted into simple functions by the line
|
||||
-- in youyesyet.db.core.clj:
|
||||
-- (conman/bind-connection *db* "sql/queries.sql")
|
||||
-- (conman/bind-connection *db* "sql/queries-auto.sql" "sql/queries.sql")
|
||||
-- the functions then appeare in the youyesyet.db.core namespace.
|
||||
|
||||
-- :name create-address! :! :n
|
||||
-- :doc creates a new address record
|
||||
INSERT INTO addresses
|
||||
(address, postcode, district_id, latitude, longitude)
|
||||
VALUES (:address, :postcode, :district, :latitude, :longitude)
|
||||
RETURNING id
|
||||
|
||||
-- :name update-address! :! :n
|
||||
-- :doc update an existing address record
|
||||
UPDATE addresses
|
||||
SET address = :address, postcode = :postcode, latitude = :latitude, longitude = :longitude
|
||||
WHERE id = :id
|
||||
|
||||
-- :name get-address :? :1
|
||||
-- :doc retrieve a address given the id.
|
||||
SELECT * FROM addresses
|
||||
WHERE id = :id
|
||||
|
||||
-- :name get-addresses-by-postcode
|
||||
|
||||
-- :name delete-address! :! :n
|
||||
-- :doc delete a address given the id
|
||||
DELETE FROM addresses
|
||||
WHERE id = :id
|
||||
|
||||
|
||||
-- :name create-authority! :! :n
|
||||
-- :doc creates a new authority record
|
||||
INSERT INTO authorities
|
||||
(id)
|
||||
VALUES (:id)
|
||||
RETURNING id
|
||||
|
||||
-- :name update-authority! :! :n
|
||||
-- :doc update an existing authority record
|
||||
UPDATE authorities
|
||||
SET id = :id
|
||||
WHERE id = :id
|
||||
|
||||
-- :name get-authority :? :1
|
||||
-- :doc retrieve a authority given the id.
|
||||
SELECT * FROM authorities
|
||||
WHERE id = :id
|
||||
|
||||
-- :name get-authorities :? :0
|
||||
-- :doc retrieve all authorities
|
||||
SELECT id FROM authorities
|
||||
|
||||
-- :name delete-authority! :! :n
|
||||
-- :doc delete a authority given the id
|
||||
DELETE FROM authorities
|
||||
WHERE id = :id
|
||||
|
||||
|
||||
-- :name create-canvasser! :! :n
|
||||
-- :doc creates a new canvasser record
|
||||
INSERT INTO canvassers
|
||||
(username, fullname, elector_id, dwelling_id, phone, email, authority_id, authorised)
|
||||
VALUES (:username, :fullname, :elector_id, :dwelling_id, :phone, :email, :authority_id, :authorised)
|
||||
RETURNING id
|
||||
|
||||
-- :name update-canvasser! :! :n
|
||||
-- :doc update an existing canvasser record
|
||||
UPDATE canvassers
|
||||
SET username = :username, fullname = :fullname, elector_id = :elector_id, dwelling_id = :dwelling_id, phone = :phone, email = :email, authority_id = :authority_id, authorised = :authorised
|
||||
WHERE id = :id
|
||||
|
||||
-- :name get-canvasser :? :1
|
||||
-- :doc retrieve a canvasser given the id.
|
||||
SELECT * FROM canvassers
|
||||
WHERE id = :id
|
||||
|
||||
-- :name get-canvasser-by-username :? :1
|
||||
-- :doc rerieve a canvasser given the username.
|
||||
SELECT * FROM canvassers
|
||||
WHERE username = :username
|
||||
|
||||
-- :name get-canvasser-by-email :? :1
|
||||
-- :doc rerieve a canvasser given the email address.
|
||||
SELECT * FROM canvassers
|
||||
WHERE email = :email
|
||||
|
||||
-- :name delete-canvasser! :! :n
|
||||
-- :doc delete a canvasser given the id
|
||||
DELETE FROM canvassers
|
||||
WHERE id = :id
|
||||
|
||||
|
||||
-- :name create-district! :! :n
|
||||
-- :doc creates a new district record
|
||||
INSERT INTO districts
|
||||
(id, name)
|
||||
VALUES (:id, :name)
|
||||
RETURNING id
|
||||
|
||||
-- :name update-district! :! :n
|
||||
-- :doc update an existing district record
|
||||
UPDATE districts
|
||||
SET name = :name
|
||||
WHERE id = :id
|
||||
|
||||
-- :name get-district :? :1
|
||||
-- :doc retrieve a district given the id.
|
||||
SELECT * FROM districts
|
||||
WHERE id = :id
|
||||
|
||||
-- :name delete-district! :! :n
|
||||
-- :doc delete a district given the id
|
||||
DELETE FROM districts
|
||||
WHERE id = :id
|
||||
|
||||
|
||||
-- :name get-dwelling :? :1
|
||||
-- :doc retrieve a dwelling given the id.
|
||||
SELECT * FROM dwellings
|
||||
WHERE id = :id
|
||||
|
||||
-- :name delete-dwelling! :! :n
|
||||
-- :doc delete a dwelling given the id
|
||||
DELETE FROM dwellings
|
||||
WHERE id = :id
|
||||
|
||||
-- :name create-dwelling! :! :n
|
||||
-- :doc creates a new dwelling record
|
||||
INSERT INTO dwellings
|
||||
(id, address_id, sub_address)
|
||||
VALUES (:id, :address_id, :sub_address)
|
||||
RETURNING id
|
||||
|
||||
-- :name update-dwelling! :! :n
|
||||
-- :doc update an existing dwelling record
|
||||
UPDATE dwellings
|
||||
SET address_id = :address_id,
|
||||
sub_address = :sub_address
|
||||
WHERE id = :id
|
||||
|
||||
-- :name get-dwelling :? :1
|
||||
-- :doc retrieve a dwelling given the id.
|
||||
SELECT * FROM dwellings
|
||||
WHERE id = :id
|
||||
|
||||
-- :name delete-dwelling! :! :n
|
||||
-- :doc delete a dwelling given the id
|
||||
DELETE FROM dwellings
|
||||
WHERE id = :id
|
||||
|
||||
|
||||
-- :name create-elector! :! :n
|
||||
-- :doc creates a new elector record
|
||||
INSERT INTO electors
|
||||
(name, dwelling_id, phone, email)
|
||||
VALUES (:name, :dwelling_id, :phone, :email)
|
||||
RETURNING id
|
||||
|
||||
-- :name update-elector! :! :n
|
||||
-- :doc update an existing elector record
|
||||
UPDATE electors
|
||||
SET name = :name, dwelling_id = :dwelling_id, phone = :phone, email = :email
|
||||
WHERE id = :id
|
||||
|
||||
-- :name get-elector :? :1
|
||||
-- :doc retrieve a elector given the id.
|
||||
SELECT * FROM electors
|
||||
WHERE id = :id
|
||||
|
||||
-- :name delete-elector! :! :n
|
||||
-- :doc delete a elector given the id
|
||||
DELETE FROM electors
|
||||
WHERE id = :id
|
||||
|
||||
|
||||
-- :name create-followupaction! :! :n
|
||||
-- :doc creates a new followupaction record
|
||||
INSERT INTO followupactions
|
||||
(request_id, actor, date, notes, closed)
|
||||
VALUES (:request_id, :actor, :date, :notes, :closed)
|
||||
RETURNING id
|
||||
|
||||
-- We don't update followup actions. They're permanent record.
|
||||
|
||||
-- :name get-followupaction :? :1
|
||||
-- :doc retrieve a followupaction given the id.
|
||||
SELECT * FROM followupactions
|
||||
WHERE id = :id
|
||||
|
||||
-- We don't delete followup actions. They're permanent record.
|
||||
|
||||
|
||||
-- followup methods are reference data, do not need to be programmatically maintained.
|
||||
|
||||
|
||||
-- :name create-followuprequest! :! :n
|
||||
-- :doc creates a new followupaction record
|
||||
INSERT INTO followuprequests
|
||||
(elector_id, visit_id, issue_id, method_id)
|
||||
VALUES (:elector_id, :visit_id, :issue_id, :method_id)
|
||||
RETURNING id
|
||||
|
||||
-- We don't update followup requests. They're permanent record.
|
||||
|
||||
-- :name get-followuprequest :? :1
|
||||
-- :doc retrieve a followupaction given the id.
|
||||
SELECT * FROM followuprequests
|
||||
WHERE id = :id
|
||||
|
||||
-- We don't delete followup requests. They're permanent record.
|
||||
|
||||
|
||||
-- :name create-issueexpertise! :! :n
|
||||
-- :doc creates a new issueexpertise record
|
||||
INSERT INTO issueexpertise
|
||||
(canvasser_id, issue_id, method_id)
|
||||
VALUES (:canvasser_id, :issue_id, :method_id)
|
||||
-- issueexertise is a link table, doesn't have an id field.
|
||||
|
||||
-- :name update-issueexpertise! :! :n
|
||||
-- :doc update an existing issueexpertise record
|
||||
UPDATE issueexpertise
|
||||
SET canvasser_id = :canvasser_id, issue_id = :issue_id, method_id = :method_id
|
||||
WHERE id = :id
|
||||
|
||||
-- :name get-issueexpertise :? :1
|
||||
-- :doc retrieve a issueexpertise given the canvasser_id -
|
||||
-- getting it by its own id is unlikely to be interesting or useful.
|
||||
SELECT * FROM issueexpertise
|
||||
WHERE canvasser_id = :canvasser_id
|
||||
|
||||
-- :name delete-issueexpertise! :! :n
|
||||
-- :doc delete a issueexpertise given the id
|
||||
DELETE FROM issueexpertise
|
||||
WHERE id = :id
|
||||
|
||||
|
||||
-- :name create-issue! :! :n
|
||||
-- :doc creates a new issue record
|
||||
INSERT INTO issues
|
||||
(id, url, content, current)
|
||||
VALUES (:id, :url, :content, :current)
|
||||
RETURNING id
|
||||
|
||||
|
||||
-- :name update-issue! :! :n
|
||||
-- :doc update an existing issue record
|
||||
UPDATE issues
|
||||
SET url = :url, content = :content, current = :current
|
||||
WHERE id = :id
|
||||
|
||||
-- :name get-issue :? :1
|
||||
-- :doc retrieve a issue given the id -
|
||||
SELECT * FROM issues
|
||||
WHERE id = :id
|
||||
|
||||
-- :name delete-issue! :! :n
|
||||
-- :doc delete a issue given the id
|
||||
DELETE FROM issues
|
||||
WHERE id = :id
|
||||
|
||||
|
||||
-- options is virtually reference data; it's not urgent to create a programmatic means of editing
|
||||
|
||||
-- :name create-visit! :! :n
|
||||
-- :doc creates a new visit record
|
||||
INSERT INTO visits
|
||||
(dwelling_id, canvasser_id)
|
||||
VALUES (:dwelling_id, :canvasser_id)
|
||||
RETURNING id
|
||||
|
||||
-- visits is audit data; we don't update it.
|
||||
|
||||
-- :name get-visit :? :1
|
||||
-- :doc retrieve a visit given the id.
|
||||
SELECT * FROM visits
|
||||
WHERE id = :id
|
||||
|
||||
-- visits is audit data; we don't delete it.
|
||||
|
||||
|
||||
-- views are select only
|
||||
|
||||
-- :name get-roles-by-canvasser :? :*
|
||||
-- :doc Get the role names for the canvasser with the specified id
|
||||
select name from roles_by_canvasser
|
||||
where canvasser = :canvasser
|
||||
|
||||
-- :name get-teams-by-canvasser :? :*
|
||||
-- :doc Get details of the teams which the canvasser with the specified id is member of.
|
||||
select * from teams_by_canvasser
|
||||
where canvasser = :canvasser_id
|
||||
|
||||
-- :name get-canvassers-by-team :? :*
|
||||
-- :doc Get details of all canvassers who are members of the team with the specified id
|
||||
select * from canvassers_by_team
|
||||
where team = :team_id
|
||||
|
||||
-- :name get-canvassers-by-team :? :*
|
||||
-- :doc Get details of all authorised canvassers who are members of this team.
|
||||
select * from canvassers_by_introducer
|
||||
where introducer = :introducer_id
|
||||
|
||||
-- :name get-canvassers-by-search :? :*
|
||||
-- :doc Get details of all authorised canvassers whose details match this search string.
|
||||
select * from canvassers
|
||||
where name like '%' || :search || '%'
|
||||
or username like '%' || :search || '%'
|
||||
or email like '%' || :search || '%'
|
||||
|
||||
-- :name get-teams_by_organiser :? :*
|
||||
-- :doc Get details of all the teams organised by the canvasser with the specified id
|
||||
select * from teams_by_organiser
|
||||
where organiser = :organiser_id
|
||||
|
||||
-- :name get-organisers-by-team :? :*
|
||||
-- :doc Get details of all organisers of the team with the specified id
|
||||
select * from organisers_by_team
|
||||
where team = :team_id
|
||||
-- Note that queries generated by ADL are in the file
|
||||
-- resources/sql/queries-auto.sql; they do not have to be (and should not be)
|
||||
-- redefined here.
|
||||
|
||||
-- :name list-addresses-by-locality :? :*
|
||||
-- :doc lists all existing address records in a given locality
|
||||
SELECT *
|
||||
FROM addresses
|
||||
WHERE locality = :locality
|
||||
|
||||
|
||||
-- :name list-open-requests :? :*
|
||||
-- :doc lists all existing followuprequest records which have not been closed and which the :expert has expertise to answer.
|
||||
SELECT DISTINCT request.*,
|
||||
electors.name ||', '|| electors.gender AS elector_id_expanded,
|
||||
addresses.address ||', '|| addresses.postcode ||', '|| visits.date AS visit_id_expanded,
|
||||
request.issue_id as issue_id_expanded,
|
||||
request.method_id AS method_id_expanded,
|
||||
visits.date
|
||||
FROM followuprequests as request,
|
||||
ln_experts_issues_canvassers as expertise,
|
||||
canvassers as experts,
|
||||
electors,
|
||||
addresses,
|
||||
visits
|
||||
where not exists (select * from followupactions as action
|
||||
where action.request_id = request.id
|
||||
and action.closed = true)
|
||||
and request.elector_id = electors.id
|
||||
and request.visit_id = visits.id
|
||||
and visits.address_id = addresses.id
|
||||
and request.issue_id = expertise.issue_id
|
||||
and expertise.canvasser_id = :expert
|
||||
ORDER BY visits.date desc
|
||||
|
||||
|
|
|
|||
65
resources/sql/test-canvassers.sql
Normal 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'));
|
||||
|
||||
1133
resources/sql/youyesyet.postgres.sql
Normal file
7
resources/templates/about.html
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
{% block big-links %}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
{{motd|safe}}
|
||||
{% endblock %}
|
||||
|
||||
|
|
@ -1,4 +1,13 @@
|
|||
{% extends "base-authenticated.html" %}
|
||||
{% extends "base.html" %}
|
||||
{% block head %}
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<link rel="stylesheet" type="text/css" href="css/yyy-common.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/yyy-app.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/spinner.css" />
|
||||
<link href="https://fonts.googleapis.com/css?family=Archivo+Black|Archivo+Narrow" rel="stylesheet"/>
|
||||
<title>{{site-title}}: {{title}}</title>
|
||||
{% endblock %}
|
||||
{% block whole-page %}
|
||||
<div id="app">
|
||||
<div class="splash-screen">
|
||||
|
|
@ -24,12 +33,21 @@
|
|||
</div>
|
||||
{% endblock %}
|
||||
{% block extra-script %}
|
||||
var user = {
|
||||
"username": "{{user.username}}",
|
||||
"fullname": "{{user.fullname}}",
|
||||
"id": {{user.id|default:-1}},
|
||||
"authorised": {{user.authorised|default:false}}
|
||||
};
|
||||
{% endblock %}
|
||||
{% block extra-tail %}
|
||||
<!-- scripts and styles -->
|
||||
<!-- ATTENTION \/ -->
|
||||
<!-- Leaflet -->
|
||||
<link rel="stylesheet" href="vendor/leaflet/dist/leaflet.css" />
|
||||
<script src="vendor/leaflet/dist/leaflet.js"></script>
|
||||
<!-- ATTENTION /\ -->
|
||||
<!-- Leaflet -->
|
||||
<link rel="stylesheet" href="js/lib/node_modules/leaflet/dist/leaflet.css" />
|
||||
{% script "js/lib/node_modules/signature_pad/dist/signature_pad.min.js" %}
|
||||
{% script "js/lib/node_modules/leaflet/dist/leaflet.js" %}
|
||||
{% script "/js/app.js" %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" type="text/css" href="css/yyy-common.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/yyy-site.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/spinner.css" />
|
||||
<link href="https://fonts.googleapis.com/css?family=Archivo+Black|Archivo+Narrow" rel="stylesheet"/>
|
||||
<title>{{title}}</title>
|
||||
</head>
|
||||
<body>
|
||||
{% block whole-page %}
|
||||
<header>
|
||||
<div id="nav">
|
||||
<img id="nav-icon" src="img/threelines.png" alt="Menu"/>
|
||||
<menu id="nav-menu" class="nav">
|
||||
<li class=""><a href="index.html">Home</a></li>
|
||||
<li class=""><a href="library.html">Library</a></li>
|
||||
<li class=""><a href="register.html">Register</a></li>
|
||||
<li class="">{% if user %}<a href="logout.html">Logout</a>
|
||||
{% else %}<a href="login.html">Login</a>{% endif %}</li>
|
||||
<li class=""><a href="about.html">About</a></li>
|
||||
{% if user %}
|
||||
<li id="user"><a href="profile">Logged in as {{user.username}}</a></li>
|
||||
{% endif %}
|
||||
</menu>
|
||||
</div>
|
||||
|
||||
<h1>
|
||||
{{title}}
|
||||
</h1>
|
||||
</header>
|
||||
|
||||
<div id="main-container" class="container">
|
||||
<div id="big-links">
|
||||
{% block big-links %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div if="#content">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div id="back-link-container">
|
||||
<a href="javascript:history.back()" id="back-link">Back</a>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<div id="credits">
|
||||
<div>
|
||||
<img src="img/credits/ric-logo.png" width="24" height="24"/>
|
||||
A project of the
|
||||
<a href="https://radical.scot/">Radical Independence Campaign</a> ||
|
||||
Version {{version}}
|
||||
</div>
|
||||
<div>
|
||||
<img height="16" width="16" alt="Clojure" src="img/credits/luminus-logo.png"/>Built with <a href="http://www.luminusweb.net/">LuminusWeb</a> ||
|
||||
<img height="16" width="16" alt="Clojure" src="img/credits/clojure-icon.gif"/> Powered by <a href="http://clojure.org">Clojure</a> ||
|
||||
<img height="16" width="16" alt="GitHub" src="img/credits/github-logo-transparent.png"/>Find me/fork me on <a href="https://github.com/simon-brooke/smeagol">Github</a> ||
|
||||
<img height="16" width="16" alt="Free Software Foundation" src="img/credits/gnu.small.png"/>Licensed under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License version 2.0</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
{% endblock %}
|
||||
<script type="text/javascript">
|
||||
var context = "{{servlet-context}}";
|
||||
var csrfToken = "{{csrf-token}}";
|
||||
</script>
|
||||
{% block extra-script %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" type="text/css" href="css/yyy-common.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/yyy-site.css" />
|
||||
<link href="https://fonts.googleapis.com/css?family=Archivo+Black|Archivo+Narrow" rel="stylesheet"/>
|
||||
<title>{% block title %}{% endblock %}{{title}}</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div id="nav">
|
||||
<img id="nav-icon" src="img/threelines.png" alt="Menu"/>
|
||||
<menu id="nav-menu" class="nav">
|
||||
<li class=""><a href="home">Home</a></li>
|
||||
<li class=""><a href="auth">Login</a></li>
|
||||
<li class=""><a href="about">About</a></li>
|
||||
</menu>
|
||||
</div>
|
||||
|
||||
<h1>
|
||||
{{title}}
|
||||
</h1>
|
||||
</header>
|
||||
|
||||
<div id="main-container" class="container">
|
||||
<div id="big-links">
|
||||
{% block big-links %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div if="#content">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<div id="credits">
|
||||
<div>
|
||||
<img src="img/credits/ric-logo.png" width="24" height="24"/>
|
||||
A project of the
|
||||
<a href="https://radical.scot/">Radical Independence Campaign</a> ||
|
||||
Version {{version}}
|
||||
</div>
|
||||
<div>
|
||||
<img height="16" width="16" alt="Clojure" src="img/credits/luminus-logo.png"/>Built with <a href="http://www.luminusweb.net/">LuminusWeb</a> ||
|
||||
<img height="16" width="16" alt="Clojure" src="img/credits/clojure-icon.gif"/> Powered by <a href="http://clojure.org">Clojure</a> ||
|
||||
<img height="16" width="16" alt="GitHub" src="img/credits/github-logo-transparent.png"/>Find me/fork me on <a href="https://github.com/simon-brooke/smeagol">Github</a> ||
|
||||
<img height="16" width="16" alt="Free Software Foundation" src="img/credits/gnu.small.png"/>Licensed under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License version 2.0</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<script type="text/javascript">
|
||||
var context = "{{servlet-context}}";
|
||||
var csrfToken = "{{csrf-token}}";
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
104
resources/templates/base.html
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
{% block head %}
|
||||
<!-- head: if you want entire custom head content, override this block. -->
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
{% style "/css/yyy-common.css" %}
|
||||
{% style "/css/yyy-site.css" %}
|
||||
{% style "/css/spinner.css" %}
|
||||
<link href="https://fonts.googleapis.com/css?family=Archivo+Black|Archivo+Narrow" rel="stylesheet"/>
|
||||
{% script "/js/lib/node_modules/jquery/dist/jquery.min.js" %}
|
||||
<title>{{site-title}}: {{title}}</title>
|
||||
{% endblock %}
|
||||
{% block extra-head %}
|
||||
<!-- extra-head: put any additional markup to go into the head of your document into this block -->
|
||||
<!-- e.g. script tags, link tags -->
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% block whole-page %}
|
||||
<!-- whole-page: if you want an entire custom page layout, override this block. -->
|
||||
{% block top %}
|
||||
<header>
|
||||
<div id="nav">
|
||||
<img id="nav-icon" src="{{servlet-context}}/img/threelines.png" alt="Menu"/>
|
||||
<menu id="nav-menu" class="nav">
|
||||
<li class=""><a href="{{servlet-context}}/home">Home</a></li>
|
||||
<li class=""><a href="{{servlet-context}}/library">Library</a></li>
|
||||
<li class=""><a href="{{servlet-context}}/register">Register</a></li>
|
||||
<li class="">{% if user %}<a href="{{servlet-context}}/logout">Logout</a>
|
||||
{% else %}<a href="{{servlet-context}}/login">Login</a>{% endif %}</li>
|
||||
<li class=""><a href="{{servlet-context}}/about">About</a></li>
|
||||
{% if user %}
|
||||
<li id="user"><a href="{{servlet-context}}/profile">Logged in as {{user.username}}</a></li>
|
||||
{% endif %}
|
||||
</menu>
|
||||
</div>
|
||||
<h1>{{title}}</h1>
|
||||
{% if message|not-empty %}
|
||||
<div class="message">
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if error|not-empty %}
|
||||
<div class="error">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</header>
|
||||
{% endblock %}
|
||||
<div id="main-container" class="container">
|
||||
<div class="back-link-container">
|
||||
<a href="javascript:history.back()" class="back-link">Back</a>
|
||||
</div>
|
||||
<div id="big-links">
|
||||
{% block big-links %}
|
||||
<!-- big-links: put any main navigation links into this block -->
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div id="content">
|
||||
{% block content %}
|
||||
<!-- content: put your main page content into this block -->
|
||||
{% endblock %}
|
||||
</div>
|
||||
<br clear="both"/>
|
||||
</div>
|
||||
{% block foot %}
|
||||
<!-- foot: override this block if you don't want the standard footer -->
|
||||
<footer>
|
||||
<div id="credits">
|
||||
<div>
|
||||
<img src="{{servlet-context}}/img/credits/ric-logo.png" width="24" height="24"/>
|
||||
A project of the
|
||||
<a href="https://radical.scot/">Radical Independence Campaign</a> ||
|
||||
Version {{version}}
|
||||
</div>
|
||||
<div>
|
||||
<img height="16" width="16" alt="Clojure" src="{{servlet-context}}/img/credits/luminus-logo.png"/>Built with <a href="http://www.luminusweb.net/">LuminusWeb</a> ||
|
||||
<img height="16" width="16" alt="Clojure" src="{{servlet-context}}/img/credits/clojure-icon.gif"/> Powered by <a href="http://clojure.org">Clojure</a> ||
|
||||
<img height="16" width="16" alt="GitHub" src="{{servlet-context}}/img/credits/github-logo-transparent.png"/>Find me/fork me on <a href="https://github.com/simon-brooke/youyesyet">Github</a> ||
|
||||
<img height="16" width="16" alt="Free Software Foundation" src="{{servlet-context}}/img/credits/gnu.small.png"/>Licensed under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License version 2.0</a>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
<script type="text/javascript">
|
||||
var context = "{{servlet-context}}";
|
||||
var csrfToken = "{{csrf-token}}";
|
||||
{% block extra-script %}
|
||||
/* extra-script: put any actual javascript source text you need into this block */
|
||||
{% endblock %}
|
||||
</script>
|
||||
{% block extra-tail %}
|
||||
<!-- extra-tail: put markup here which needs to be at the very end of the body -->
|
||||
<!-- e.g. some javascript script tags, some link tags -->
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,41 +1,15 @@
|
|||
{% extends "base-unauthenticated.html" %}
|
||||
{% extends "base.html" %}
|
||||
{% block big-links %}
|
||||
<div id="back-link-container">
|
||||
<a href="javascript:history.back()" id="back-link">Back</a>
|
||||
</div>
|
||||
<div class="big-link-container">
|
||||
<a href="library" class="big-link" id="library-link">Browse the issues</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<h2>
|
||||
We'll be in touch!
|
||||
</h2>
|
||||
<p>
|
||||
Thank you, {{name}}. Someone will call you shortly on {{phone}} to talk to you about
|
||||
{{concern}}.
|
||||
</p>
|
||||
<form action="call-me" method="post">
|
||||
<p class="widget">
|
||||
<label for="name">Your name</label>
|
||||
<input type="text" id="name" name="name"/>
|
||||
</p>
|
||||
<p class="widget">
|
||||
<label for="postcode">Your post-code</label>
|
||||
<input type="text" id="postcode" name="postcode"/>
|
||||
</p>
|
||||
<p class="widget">
|
||||
<label for="phone">Your phone number</label>
|
||||
<input type="text" id="phone" name="phone"/>
|
||||
</p>
|
||||
<p class="widget">
|
||||
<label for="concern">Your concerns</label>
|
||||
<select name="concern" id="concern">
|
||||
{% for concern in concerns %}
|
||||
<option>{{concern.title}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</p>
|
||||
<p class="widget">
|
||||
<label for="submit"> </label>
|
||||
<input name="submit" id="submit" type="submit" class="action" value="Call me!"/>
|
||||
</p>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
{% extends "base-unauthenticated.html" %}
|
||||
{% block big-links %}
|
||||
<div id="back-link-container">
|
||||
<a href="javascript:history.back()" id="back-link">Back</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<p>
|
||||
Use this form to request someone to phone you to discuss your concerns about independence.
|
||||
</p>
|
||||
<form action="call-me" method="post">
|
||||
{% csrf-field %}
|
||||
<p class="widget">
|
||||
<label for="name">Your name</label>
|
||||
<input type="text" id="name" name="name"/>
|
||||
|
|
@ -25,7 +21,7 @@
|
|||
<label for="concern">Your concerns</label>
|
||||
<select name="concern" id="concern">
|
||||
{% for concern in concerns %}
|
||||
<option>{{concern.title}}</option>
|
||||
<option>{{concern.id}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
{% extends "base-authenticated.html" %}
|
||||
{% block title %}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<form action="edit-canvasser" method="post">
|
||||
{% if canvasser %}
|
||||
<input type="hidden" name="id" id="id" value="{{canvasser.id}}"/>
|
||||
{% endif %}
|
||||
<p class="widget">
|
||||
<label for="fullname">Full name</label>
|
||||
<input type="text" name="fullname" id="fullname" value="{{canvasser.fullname}}"/>
|
||||
</p>
|
||||
<p class="widget">
|
||||
(TODO: Not absolutely sure what I'm going to do for an elector id widget yet.)
|
||||
</p>
|
||||
<p class="widget">
|
||||
<label for="address">Address</label>
|
||||
{% if address.id %}
|
||||
<!-- if we already have an address, just show it with a link to edit it -->
|
||||
<span class="pseudo-widget" id="address">
|
||||
{{address.address}}
|
||||
</span>
|
||||
{% else %}
|
||||
(TODO: Some sort of address lookup widget goes here.)
|
||||
{% endif %}
|
||||
</p>
|
||||
<p class="widget">
|
||||
<label for="phone">Phone number</label>
|
||||
<input type="tel" name="phone" id="phone" value="{{canvasser.phone}}"/>
|
||||
</p>
|
||||
<p class="widget">
|
||||
<label for="email">Email address</label>
|
||||
<input type="email" name="email" id="email" value="{{canvasser.email}}"/>
|
||||
</p>
|
||||
<p class="widget">
|
||||
<label for="authority_id">Authorised by</label>
|
||||
<select name="authority_id" id="authority_id">
|
||||
{% for authority in authorities %}
|
||||
<option value="{{authority.id}}"
|
||||
{% ifequal authority.id canvasser.authority_id %}selected {% endifequal %}>
|
||||
{{authority.id}}
|
||||
</option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
</p>
|
||||
id serial,
|
||||
username character varying(32) NOT NULL,
|
||||
fullname character varying(64) NOT NULL,
|
||||
elector_id integer,
|
||||
address_id integer NOT NULL,
|
||||
phone character varying(16),
|
||||
email character varying(128),
|
||||
authority_id character varying(32) NOT NULL,
|
||||
introduced_by int references canvassers(id),
|
||||
authorised boolean
|
||||
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -1,38 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Something bad happened</title>
|
||||
<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>
|
||||
{% extends "base.html" %}
|
||||
{% block big-links %}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
|
|
@ -52,5 +21,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
{% extends "base-unauthenticated.html" %}
|
||||
{% extends "base.html" %}
|
||||
{% block big-links %}
|
||||
<div class="big-link-container">
|
||||
<a href="supporter" class="big-link" id="yes-link">Yes</a>
|
||||
</div>
|
||||
<div class="big-link-container">
|
||||
<a href="notyet" class="big-link" id="not-yet-link">No</a>
|
||||
</div>
|
||||
<div class="big-link-container">
|
||||
<a href="supporter" class="big-link" id="yes-link">Yes</a>
|
||||
</div>
|
||||
<div class="big-link-container">
|
||||
<a href="notyet" class="big-link" id="not-yet-link">No</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<img id="site-logo" src="img/ProjectHopeLogo4.png" alt="{{site-title}}" style="float: left;" height="345" width="345"/>
|
||||
{{motd|safe}}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
|||
146
resources/templates/issue-expert/list.html
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
{% extends "base.html" %}
|
||||
<!-- File list-followuprequests-Followuprequests.html generated 2018-07-17T07:58:11.329Z by adl.to-selmer-templates.
|
||||
See [Application Description Language](https://github.com/simon-brooke/adl).-->
|
||||
|
||||
|
||||
{% block back-links %}
|
||||
<div>
|
||||
<div class='back-link-container'>
|
||||
<a id='prev-selector' class='back-link'>
|
||||
Previous
|
||||
</a>
|
||||
</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 %}
|
||||
<div class='big-link-container'>
|
||||
<a href='{{servlet-context}}/form-followuprequests-Followuprequest' class='big-link'>
|
||||
Add a new Followuprequest
|
||||
</a>
|
||||
</div>
|
||||
{% endifmemberof %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<form id='list-followuprequests-Followuprequests' class='list' action='{{servlet-context}}/list-followuprequests-Followuprequests' method='POST'>
|
||||
{% csrf-field %}
|
||||
<input id='offset' name='offset' type='hidden' value='{{params.offset|default:0}}'/>
|
||||
<input id='limit' name='limit' type='hidden' value='{{params.limit|default:50}}'/>
|
||||
<table caption='followuprequests'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Id
|
||||
</th>
|
||||
<th>
|
||||
Elector_id
|
||||
</th>
|
||||
<th>
|
||||
Visit_id
|
||||
</th>
|
||||
<th>
|
||||
Issue_id
|
||||
</th>
|
||||
<th>
|
||||
Method_id
|
||||
</th>
|
||||
<th>
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<input id='id' type='text' name='id' value='{{ params.id }}'/>
|
||||
</th>
|
||||
<th>
|
||||
<input id='elector_id' type='text' name='elector_id' value='{{ params.elector_id }}'/>
|
||||
</th>
|
||||
<th>
|
||||
<input id='visit_id' type='text' name='visit_id' value='{{ params.visit_id }}'/>
|
||||
</th>
|
||||
<th>
|
||||
<input id='issue_id' type='text' name='issue_id' value='{{ params.issue_id }}'/>
|
||||
</th>
|
||||
<th>
|
||||
<input id='method_id' type='text' name='method_id' value='{{ params.method_id }}'/>
|
||||
</th>
|
||||
<th>
|
||||
<input type='submit' id='search-widget' value='Search'/>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for record in records %}
|
||||
<tr>
|
||||
<td>
|
||||
{{ record.id }}
|
||||
</td>
|
||||
<td>
|
||||
<a href='{{servlet-context}}/form-electors-Elector?id={{ record.elector_id }}'>
|
||||
{{ record.elector_id_expanded }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href='{{servlet-context}}/form-visits-Visit?id={{ record.visit_id }}'>
|
||||
{{ record.visit_id_expanded }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href='{{servlet-context}}/form-issues-Issue?id={{ record.issue_id }}'>
|
||||
{{ record.issue_id_expanded }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href='{{servlet-context}}/form-followupmethods-Followupmethod?id={{ record.method_id }}'>
|
||||
{{ record.method_id_expanded }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href='{{servlet-context}}/issue-expert/followup-request?id={{ record.id }}'>
|
||||
View
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
{% block extra-script %}
|
||||
|
||||
var form = document.getElementById('list-followuprequests-Followuprequests');
|
||||
var ow = document.getElementById('offset');
|
||||
var lw = document.getElementById('limit');
|
||||
form.addEventListener('submit', function() {
|
||||
ow.value='0';
|
||||
});
|
||||
|
||||
var prevSelector = document.getElementById('prev-selector');
|
||||
if (prevSelector != null) {
|
||||
prevSelector.addEventListener('click', function () {
|
||||
if (parseInt(ow.value)===0) {
|
||||
window.location = '{{servlet-context}}/admin';
|
||||
} else {
|
||||
ow.value=(parseInt(ow.value)-parseInt(lw.value));
|
||||
console.log('Updated offset to ' + ow.value);
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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 %}
|
||||
157
resources/templates/issue-expert/request.html
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
{% extends "base.html" %}
|
||||
<!--
|
||||
Form for issue experts to handle a request from an elector.
|
||||
-->
|
||||
|
||||
|
||||
{% 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}}/issue-expert/followup-action' method='POST'>
|
||||
{% csrf-field %}
|
||||
<input id='id' name='id' type='hidden' value='{{record.id}}'/>
|
||||
<p class='widget'>
|
||||
<label for='elector_id'>
|
||||
Elector
|
||||
</label>
|
||||
{% ifmemberof canvassers teamorganisers issueexperts analysts issueeditors admin %}
|
||||
<span id='elector_id' name='elector_id' class='pseudo-widget disabled'>
|
||||
{{elector.name}} ({{elector.gender}})
|
||||
</span>
|
||||
{% else %}
|
||||
<span id='elector_id' name='elector_id' class='pseudo-widget not-authorised'>
|
||||
You are not permitted to view elector of followuprequests
|
||||
</span>
|
||||
{% endifmemberof %}
|
||||
</p>
|
||||
<p class='widget'>
|
||||
<label for='visit'>
|
||||
Visit
|
||||
</label>
|
||||
{% ifmemberof issueexperts analysts issueeditors admin %}
|
||||
<span id='visit' name='visit' class='pseudo-widget disabled'>
|
||||
by {{visit.canvasser_id_expanded}} at {{visit.date}}
|
||||
</span>
|
||||
{% else %}
|
||||
<span id='visit_id' name='visit_id' class='pseudo-widget not-authorised'>
|
||||
You are not permitted to view visit of followuprequests
|
||||
</span>
|
||||
{% endifmemberof %}
|
||||
</p>
|
||||
<p class='widget'>
|
||||
<label for='issue_id'>
|
||||
{{issue.id}}
|
||||
</label>
|
||||
{% ifmemberof issueexperts admin %}
|
||||
<div id="issue-brief">
|
||||
{{issue.brief|safe}}
|
||||
</div>
|
||||
{% else %}
|
||||
<span id='issue_id' name='issue_id' class='pseudo-widget not-authorised'>
|
||||
You are not permitted to view issue of followuprequests
|
||||
</span>
|
||||
{% endifmemberof %}
|
||||
</p>
|
||||
<p class='widget'>
|
||||
<label for='method_id'>
|
||||
{{record.method_id}}
|
||||
</label>
|
||||
{% ifmemberof issueexperts admin %}
|
||||
<span id='method_id' name='method_id' class='pseudo-widget disabled'>
|
||||
{% ifequal record.method_id "Phone" %}{{elector.phone}}{% endifequal %}
|
||||
{% ifequal record.method_id "eMail" %}<a href="mailto:{{elector.email}}">{{elector.email}}</a>{% endifequal %}
|
||||
</span>
|
||||
{% else %}
|
||||
<span id='method_id' name='method_id' class='pseudo-widget not-authorised'>
|
||||
You are not permitted to view method of followuprequests
|
||||
</span>
|
||||
{% endifmemberof %}
|
||||
</p>
|
||||
{% if actions|length > 0 %}
|
||||
<p>
|
||||
<label for='history'>
|
||||
History
|
||||
</label>
|
||||
<table id='history'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
Actor
|
||||
</th>
|
||||
<th>
|
||||
Date
|
||||
</th>
|
||||
<th>
|
||||
Closed?
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for action in actions %}
|
||||
<tr>
|
||||
<td>{{action.actor}}</td>
|
||||
<td>{{action.date}}</td>
|
||||
<td>{{action.closed}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">{{action.notes|safe}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
{% endif %}
|
||||
<p class='widget'>
|
||||
<label for='notes'>
|
||||
Your notes
|
||||
</label>
|
||||
{% ifmemberof admin issueexperts %}
|
||||
<textarea rows='8' cols='60' id='notes' name='notes'>
|
||||
</textarea>
|
||||
{% endifmemberof %}
|
||||
</p>
|
||||
<p class='widget'>
|
||||
<label for='closed'>
|
||||
Has the elector's query been satisfied?
|
||||
</label>
|
||||
{% ifmemberof admin issueexperts %}
|
||||
<input id='closed' name='closed' type='checkbox' maxlength='' size='16'/>
|
||||
{% endifmemberof %}
|
||||
</p>
|
||||
|
||||
{% ifmemberof admin issueexperts %}
|
||||
<p class='widget action-safe'>
|
||||
<label for='save-button' class='action-safe'>
|
||||
To save this followuprequests record
|
||||
</label>
|
||||
<input id='save-button' name='save-button' class='action-safe' type='submit' value='Save!'/>
|
||||
</p>
|
||||
{% endifmemberof %}
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
{% block extra-tail %}
|
||||
<script type='text/javascript'>
|
||||
var simplemde = new SimpleMDE({
|
||||
autosave: {
|
||||
enabled: true,
|
||||
uniqueId: "adl-generated-{{page}}",
|
||||
delay: 1000,
|
||||
},
|
||||
indentWithTabs: true,
|
||||
insertTexts: {
|
||||
horizontalRule: ["", "\n\n-----\n\n"],
|
||||
image: [""],
|
||||
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 %}
|
||||
|
|
@ -1,11 +1,26 @@
|
|||
{% extends "base-unauthenticated.html" %}
|
||||
{% extends "base.html" %}
|
||||
{% block big-links %}
|
||||
{% for authority in authorities %}
|
||||
<div class="big-link-container">
|
||||
<a href="auth?authority={{authority.id}}" class="big-link" id="{{authority.id}}-link">
|
||||
<img src="img/authorities/{{authority.id}}.png" width="32" height="32" alt="{{authority.id}}"/>
|
||||
{{authority.id}}
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<p>
|
||||
We're not going to do login in the long term; we're going to use oauth.
|
||||
This is a temporary login form.
|
||||
</p>
|
||||
<form action="auth" method="post">
|
||||
<form action="login" method="post">
|
||||
{% csrf-field %}
|
||||
<h2>
|
||||
Or use a test username and password
|
||||
</h2>
|
||||
<p>
|
||||
We're not going to do login in the long term; we're going to use
|
||||
<a href="https://oauth.net/2/">oauth</a>.
|
||||
This is a temporary login form.
|
||||
</p>
|
||||
<p class="widget">
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="username"/>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "base-unauthenticated.html" %}
|
||||
{% extends "base.html" %}
|
||||
{% block big-links %}
|
||||
<div id="back-link-container">
|
||||
<a href="javascript:history.back()" id="back-link">Back</a>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
{% extends "base-authenticated.html" %}
|
||||
{% extends "base.html" %}
|
||||
{% block title %}
|
||||
{{ user }}
|
||||
{% endblock %}
|
||||
{% block big-links %}
|
||||
<div class="big-link-container">
|
||||
<a href="app" class="big-link" id="big-link">Canvasser</a>
|
||||
</div>
|
||||
{% for role in roles %}
|
||||
<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>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
1
resources/templates/roles/analyst.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
|
||||
9
resources/templates/roles/canvasser.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{% extends "base.html" %}
|
||||
{% block big-links %}
|
||||
<div class="big-link-container">
|
||||
<a href="{{servlet-context}}/profile" class="big-link" id="profile-link">Your profile</a>
|
||||
</div>
|
||||
<div class="big-link-container">
|
||||
<a href="{{servlet-context}}/app" class="big-link" id="app-link">App</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -1,10 +1,7 @@
|
|||
{% extends "base-unauthenticated.html" %}
|
||||
{% extends "base.html" %}
|
||||
{% block big-links %}
|
||||
<div id="back-link-container">
|
||||
<a href="javascript:history.back()" id="back-link">Back</a>
|
||||
</div>
|
||||
<div class="big-link-container">
|
||||
<a href="auth" class="big-link" id="yes-link">Yes</a>
|
||||
<div class="big-link-container">
|
||||
<a href="login" class="big-link" id="yes-link">Yes</a>
|
||||
</div>
|
||||
<div class="big-link-container">
|
||||
<a href="register" class="big-link" id="signup-link">No</a>
|
||||
|
|
|
|||