From 555b1d146b774771a4b082c82257f8e9664da20a Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Sat, 22 Sep 2018 14:11:26 +0100 Subject: [PATCH] Generate latest decisions page --- bin/build | 5 +++++ views/decisions.haml | 22 ++++++++++++++++++++++ views/layout.haml | 7 +++++++ 3 files changed, 34 insertions(+) create mode 100644 views/decisions.haml diff --git a/bin/build b/bin/build index e519e00..fe92065 100755 --- a/bin/build +++ b/bin/build @@ -56,6 +56,10 @@ def gen_new apps = ScraperWiki.select("* from `applications` order by date_received desc limit 30") write_page('new', 'new', { apps: apps }) end + +def gen_decisions + apps = ScraperWiki.select("* from `applications` order by date_decision desc limit 30") + write_page('decisions', 'decisions', { apps: apps }) end def gen_authorities @@ -89,4 +93,5 @@ puts @working_dir create_output_dir gen_homepage gen_new +gen_decisions gen_authorities diff --git a/views/decisions.haml b/views/decisions.haml new file mode 100644 index 0000000..4257827 --- /dev/null +++ b/views/decisions.haml @@ -0,0 +1,22 @@ +%h1 Latest decisions +%table + %thead + %tr + %th Authority + %th Reference + %th Decided + %th Address + %th Decision + %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_decision']) + %td= app['address'] + %td= app['decision'] + \ No newline at end of file diff --git a/views/layout.haml b/views/layout.haml index e8dd6ae..5b7cf7b 100644 --- a/views/layout.haml +++ b/views/layout.haml @@ -12,9 +12,16 @@ %li %a{ :href => '/' } Home + -# + %li + %a{ :href => '/authorities/' } + Authorities %li %a{ :href => '/new/' } New applications + %li + %a{ :href => '/decisions/' } + Latest decisions = yield #footer