diff --git a/bin/build b/bin/build index 45ea8fb..e519e00 100755 --- a/bin/build +++ b/bin/build @@ -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 diff --git a/lib/helpers.rb b/lib/helpers.rb index f3ee114..4ce171a 100644 --- a/lib/helpers.rb +++ b/lib/helpers.rb @@ -16,3 +16,7 @@ end def slug(s) s.downcase.gsub(' ', '-') end + +def authority_url(authority_name) + "/authorities/#{slug(authority_name)}/" +end diff --git a/views/layout.haml b/views/layout.haml index a679515..400ab36 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -13,8 +13,8 @@ %a{ :href => '/' } Home %li - %a{ :href => '/authorities' } - Authorities + %a{ :href => '/new/' } + New applications = yield #footer diff --git a/views/new.haml b/views/new.haml new file mode 100644 index 0000000..838caf3 --- /dev/null +++ b/views/new.haml @@ -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'] + \ No newline at end of file