Ver a proveniência

Generate new applications page

main
Adrian Short há 6 anos
ascendente
cometimento
6a058023db
4 ficheiros alterados com 32 adições e 2 eliminações
  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 Ver ficheiro

@@ -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 Ver ficheiro

@@ -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 Ver ficheiro

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


+ 20
- 0
views/new.haml Ver ficheiro

@@ -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']

Carregando…
Cancelar
Guardar