Planning applications tracker for InLinkUK from BT kiosks. https://kiosks.adrianshort.org/
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

helpers.rb 604 B

6 년 전
6 년 전
6 년 전
1234567891011121314151617181920212223242526
  1. def short_date(s)
  2. return if s.nil?
  3. Date.parse(s).strftime("%e %b %Y")
  4. end
  5. def cleanup(s)
  6. return if s.nil?
  7. s.sub!('Unknown', '')
  8. s.sub!('Not Available', '')
  9. s.sub!('Not Applicable', '')
  10. s = "<span class=grant>#{s}</span>" if s.match(/(approve|grant|permitted)/i)
  11. s = "<span class=refuse>#{s}</span>" if s.match(/refus/i)
  12. s
  13. end
  14. def slug(s)
  15. s.downcase.gsub(' ', '-')
  16. end
  17. def authority_url(authority_name)
  18. "/authorities/#{slug(authority_name)}/"
  19. end
  20. def download_button(filename, label='Download CSV data')
  21. "<a class=button href=#{filename} download=#{filename}>#{label}</a>"
  22. end