Browse Source

Create download button helper

main
Adrian Short 5 years ago
parent
commit
32513faf30
4 changed files with 7 additions and 12 deletions
  1. +4
    -0
      lib/helpers.rb
  2. +1
    -4
      views/appeals.haml
  3. +1
    -4
      views/authority.haml
  4. +1
    -4
      views/index.haml

+ 4
- 0
lib/helpers.rb View File

@@ -21,6 +21,10 @@ def authority_url(authority_name)
"/authorities/#{slug(authority_name)}/" "/authorities/#{slug(authority_name)}/"
end end


def download_button(filename, label='Download CSV data')
"<a class=button href=#{filename} download=#{filename}>#{label}</a>"
end

def normalise_decision(d) def normalise_decision(d)
# https://schemas.opendata.esd.org.uk/PlanningApplications/LocalOpenDataIncentiveSchemePlanningApplicationsSchemaGuidance.pdf # https://schemas.opendata.esd.org.uk/PlanningApplications/LocalOpenDataIncentiveSchemePlanningApplicationsSchemaGuidance.pdf


+ 1
- 4
views/appeals.haml View File

@@ -36,10 +36,7 @@


%h2 Appealed applications %h2 Appealed applications


%p
- csv_fn = 'inlink-appeals.csv'
%a.button{ :href => csv_fn, :download => csv_fn }
Download CSV data
%p= download_button('inlink-appeals.csv')


%table#applications %table#applications
%thead %thead


+ 1
- 4
views/authority.haml View File

@@ -23,10 +23,7 @@


%h2 Applications %h2 Applications


%p
- csv_fn = slug(auth['authority_name']) + '.csv'
%a.button{ :href => csv_fn, :download => csv_fn }
Download CSV data
%p= download_button(slug(auth['authority_name']) + '.csv')


%table#applications %table#applications
%thead %thead


+ 1
- 4
views/index.haml View File

@@ -2,10 +2,7 @@


%p.warning There are typically two applications per kiosk: one for full planning permission or telecoms prior approval, and one for advertisement consent. So the number of kiosks applied for is half the number of applications. %p.warning There are typically two applications per kiosk: one for full planning permission or telecoms prior approval, and one for advertisement consent. So the number of kiosks applied for is half the number of applications.


%p
- csv_fn = 'inlink-summary.csv'
%a.button{ :href => csv_fn, :download => csv_fn }
Download summary CSV data
%p= download_button('inlink-summary.csv')


%table#summary %table#summary
%thead %thead


Loading…
Cancel
Save