| @@ -51,6 +51,11 @@ end | |||||
| def gen_homepage | def gen_homepage | ||||
| decisions = ScraperWiki.select("* from `applications` order by date_decision desc limit 20") | decisions = ScraperWiki.select("* from `applications` order by date_decision desc limit 20") | ||||
| write_page('.', 'index', { decisions: decisions }) | 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 | end | ||||
| def gen_authorities | def gen_authorities | ||||
| @@ -83,4 +88,5 @@ puts @working_dir | |||||
| @pages = 0 | @pages = 0 | ||||
| create_output_dir | create_output_dir | ||||
| gen_homepage | gen_homepage | ||||
| gen_new | |||||
| gen_authorities | gen_authorities | ||||
| @@ -16,3 +16,7 @@ end | |||||
| def slug(s) | def slug(s) | ||||
| s.downcase.gsub(' ', '-') | s.downcase.gsub(' ', '-') | ||||
| end | end | ||||
| def authority_url(authority_name) | |||||
| "/authorities/#{slug(authority_name)}/" | |||||
| end | |||||
| @@ -13,8 +13,8 @@ | |||||
| %a{ :href => '/' } | %a{ :href => '/' } | ||||
| Home | Home | ||||
| %li | %li | ||||
| %a{ :href => '/authorities' } | |||||
| Authorities | |||||
| %a{ :href => '/new/' } | |||||
| New applications | |||||
| = yield | = yield | ||||
| #footer | #footer | ||||
| @@ -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'] | |||||