瀏覽代碼

Create download button helper

main
Adrian Short 6 年之前
父節點
當前提交
32513faf30
共有 4 個檔案被更改,包括 7 行新增12 行删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

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


Loading…
取消
儲存