Ver código fonte

Create download button helper

main
Adrian Short 6 anos atrás
pai
commit
32513faf30
4 arquivos alterados com 7 adições e 12 exclusões
  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 Ver arquivo

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

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

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


+ 1
- 4
views/appeals.haml Ver arquivo

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

%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
%thead


+ 1
- 4
views/authority.haml Ver arquivo

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

%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
%thead


+ 1
- 4
views/index.haml Ver arquivo

@@ -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
- 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
%thead


Carregando…
Cancelar
Salvar