Browse Source

Generate new applications page

main
Adrian Short 6 years ago
parent
commit
6a058023db
4 changed files with 32 additions and 2 deletions
  1. +6
    -0
      bin/build
  2. +4
    -0
      lib/helpers.rb
  3. +2
    -2
      views/layout.haml
  4. +20
    -0
      views/new.haml

+ 6
- 0
bin/build View File

@@ -51,6 +51,11 @@ end
def gen_homepage
decisions = ScraperWiki.select("* from `applications` order by date_decision desc limit 20")
write_page('.', 'index', { decisions: decisions })

def gen_new
apps = ScraperWiki.select("* from `applications` order by date_received desc limit 30")
write_page('new', 'new', { apps: apps })
end
end

def gen_authorities
@@ -83,4 +88,5 @@ puts @working_dir
@pages = 0
create_output_dir
gen_homepage
gen_new
gen_authorities

+ 4
- 0
lib/helpers.rb View File

@@ -16,3 +16,7 @@ end
def slug(s)
s.downcase.gsub(' ', '-')
end

def authority_url(authority_name)
"/authorities/#{slug(authority_name)}/"
end

+ 2
- 2
views/layout.haml View File

@@ -13,8 +13,8 @@
%a{ :href => '/' }
Home
%li
%a{ :href => '/authorities' }
Authorities
%a{ :href => '/new/' }
New applications
= yield
#footer


+ 20
- 0
views/new.haml View File

@@ -0,0 +1,20 @@
%h1 New applications
%table
%thead
%tr
%th Authority
%th Reference
%th Received
%th Address
%tbody
- apps.each do |app|
%tr
%td
%a{ href: authority_url(app['authority_name']) }
= app['authority_name']
%td
%a{ href: app['info_url']}
= app['council_reference']
%td= short_date(app['date_received'])
%td= app['address']

Loading…
Cancel
Save