Browse Source

Add appeals page

main
Adrian Short 5 years ago
parent
commit
ace123b461
3 changed files with 86 additions and 0 deletions
  1. +18
    -0
      lib/site.rb
  2. +65
    -0
      views/appeals.haml
  3. +3
    -0
      views/layout.haml

+ 18
- 0
lib/site.rb View File

@@ -20,6 +20,24 @@ class Site
# Latest decisions page
apps = ScraperWiki.select("* from `applications` order by date_decision desc limit 30")
Petrify.page('decisions', 'decisions', { apps: apps })
# Appeals page
summary = ScraperWiki.select("
authority_name, appeal_status, appeal_decision, count(*) as applications
from applications
where appeal_status is not null
and appeal_status != 'Unknown'
group by authority_name, appeal_status, appeal_decision
")
apps = ScraperWiki.select("
* from applications
where appeal_status is not null
and appeal_status != 'Unknown'
")
Petrify.page('appeals', 'appeals', { summary: summary, apps: apps })
Petrify.csv('appeals', 'inlink-appeals', apps)

# Page and CSV file for each authority
auths = ScraperWiki.select("distinct(authority_name) as authority_name from applications")


+ 65
- 0
views/appeals.haml View File

@@ -0,0 +1,65 @@
%h1 Appeals

.warning
%p
The applicant has the right to appeal against a council's decision to refuse planning permission. An independent planning inspector reviews the case and decides whether to uphold the original decision or to overturn it.

%p
Appeals are decided by the
%a( href = "https://www.gov.uk/government/organisations/planning-inspectorate")<
Planning Inspectorate for England and Wales,
the
%a( href = "https://www.dpea.scotland.gov.uk")<
Planning and Environmental Appeals Division of the Scottish government,
and the
%a( href = "https://www.pacni.gov.uk")<
Planning Appeals Commission for Northern Ireland.

%h2 Summary

%table#summary
%thead
%tr
%th Authority name
%th Appeal status
%th Appeal decision
%th Applications appealed
%tbody
- summary.each do |row|
%tr
%td.nowrap
%a{ href: authority_url(row['authority_name']) }
= row['authority_name']
%td= cleanup(row['appeal_status'])
%td= cleanup(row['appeal_decision'])
%td.right= row['applications']

%h2 Appealed applications

%p
- csv_fn = 'inlink-appeals.csv'
%a.button{ :href => csv_fn, :download => csv_fn }
Download CSV data

%table#applications
%thead
%tr
%th Authority
%th Reference
%th Council decision
%th Address
%th Appeal status
%th Appeal decision
%tbody
- apps.each do |app|
%tr
%td.nowrap
%a{ href: authority_url(app['authority_name']) }
= app['authority_name']
%td
%a{ href: app['info_url']}
= app['council_reference']
%td.nowrap= short_date(app['date_decision'])
%td= app['address']
%td= cleanup(app['appeal_status'])
%td= cleanup(app['appeal_decision'])

+ 3
- 0
views/layout.haml View File

@@ -18,6 +18,9 @@
%li
%a{ :href => '/decisions/' }<
Latest decisions
%li
%a{ :href => '/appeals/' }<
Appeals
= yield
%footer


Loading…
Cancel
Save