Ver a proveniência

Add media to authority pages

main
Adrian Short há 6 anos
ascendente
cometimento
e9c4301325
2 ficheiros alterados com 20 adições e 5 eliminações
  1. +7
    -5
      lib/site.rb
  2. +13
    -0
      views/authority.haml

+ 7
- 5
lib/site.rb Ver ficheiro

@@ -52,6 +52,10 @@ class Site
Petrify.page(path, 'appeals', { summary: summary, apps: apps })
Petrify.csv(path, 'inlink-appeals', apps)

# Media page
media_items = CSV.read('media.csv', :headers => true )
Petrify.page('media', 'media', { media_items: media_items })

# Authority pages
auths = ScraperWiki.select("distinct(authority_name) as authority_name from applications")

@@ -65,13 +69,11 @@ class Site

apps = ScraperWiki.select("* from applications where authority_name = ? order by date_received desc", auth['authority_name'])

stories = media_items.select { |s| s[4].match(auth['authority_name'])}

path = ['authorities', slug(auth['authority_name'])]
Petrify.page(path, 'authority', { apps: apps, auth: auth, summary: summary })
Petrify.page(path, 'authority', { apps: apps, auth: auth, summary: summary, stories: stories })
Petrify.csv(path, slug(auth['authority_name']), apps)
end
end
# Media page
media_items = CSV.read('media.csv', :headers => true )
Petrify.page('media', 'media', { media_items: media_items })
end

+ 13
- 0
views/authority.haml Ver ficheiro

@@ -21,6 +21,19 @@
%td= cleanup(row['appeal_decision'])
%td.right= row['qty']

- if stories.size > 0

%h2 Media

%table
- stories.each do |item|
%tr
%td.nowrap= short_date(item['publish_date'])
%td.nowrap= item['publication']
%td
%a{ :href => item['url'] }<
= item['title']

%h2 Applications

%p= download_button(slug(auth['authority_name']) + '.csv')


Carregando…
Cancelar
Guardar