| @@ -147,6 +147,30 @@ get '/about' do | |||||
| haml :about | haml :about | ||||
| end | end | ||||
| get '/scoreboard.csv' do | |||||
| @councils = Council.all( :order => ['name'] ) | |||||
| labels = %w[ | |||||
| id | |||||
| created_at | |||||
| updated_at | |||||
| name | |||||
| slug | |||||
| url | |||||
| data_url | |||||
| open_licence | |||||
| machine_readable | |||||
| start_d | |||||
| end_d | |||||
| ] | |||||
| headers "Content-Disposition" => "attachment;filename=armchair-auditor-scoreboard.csv", | |||||
| "Content-Type" => "text/csv" | |||||
| output = "" | |||||
| for council in @councils | |||||
| output += council.to_csv | |||||
| end | |||||
| labels.join(',') + "\n" + output | |||||
| end | |||||
| get '/scoreboard' do | get '/scoreboard' do | ||||
| @councils = Council.all( :order => ['name'] ) | @councils = Council.all( :order => ['name'] ) | ||||
| haml :scoreboard | haml :scoreboard | ||||
| @@ -100,7 +100,6 @@ class Council | |||||
| property :data_url, String, :length => 512 | property :data_url, String, :length => 512 | ||||
| property :open_licence, Boolean, :default => false | property :open_licence, Boolean, :default => false | ||||
| property :machine_readable, Boolean, :default => false | property :machine_readable, Boolean, :default => false | ||||
| property :grade, String, :length => 1 | |||||
| property :start_d, Date | property :start_d, Date | ||||
| property :end_d, Date | property :end_d, Date | ||||
| @@ -104,6 +104,12 @@ strong | |||||
| color: #000; | color: #000; | ||||
| } | } | ||||
| .strong | |||||
| { | |||||
| color: #000; | |||||
| font-weight: bold; | |||||
| } | |||||
| table | table | ||||
| { | { | ||||
| border-collapse: collapse; | border-collapse: collapse; | ||||
| @@ -1,6 +1,10 @@ | |||||
| .grid_12 | .grid_12 | ||||
| %h2= @page_title = "Council Spending Data Scoreboard" | %h2= @page_title = "Council Spending Data Scoreboard" | ||||
| %p.noprint.download | |||||
| %a{ :href => "/scoreboard.csv" } | |||||
| Download data as CSV | |||||
| %table | %table | ||||
| %tr | %tr | ||||
| %th Council | %th Council | ||||
| @@ -24,7 +28,19 @@ | |||||
| %td= council.start_d.strftime("%b %Y") | %td= council.start_d.strftime("%b %Y") | ||||
| %td= council.end_d.strftime("%b %Y") | %td= council.end_d.strftime("%b %Y") | ||||
| %td= council.updated_at.strftime("%d %b %Y") | %td= council.updated_at.strftime("%d %b %Y") | ||||
| %p.highlight.noprint | |||||
| This scoreboard data is free for you to use according to the | |||||
| %a{ :href => "http://creativecommons.org/licenses/by/3.0/"}< | |||||
| Creative Commons Attribution 3.0 Unported Licence. | |||||
| Please credit to | |||||
| %strong | |||||
| Adrian Short/Armchair Auditor | |||||
| and link back to | |||||
| %a{ :href => "http://armchairauditor.co.uk/scoreboard" }< | |||||
| http://armchairauditor.co.uk/scoreboard | |||||
| where possible. | |||||
| %h3 Notes | %h3 Notes | ||||
| %p | %p | ||||