Skip to content

Commit

Permalink
Add "CDC" badge to Jay Papers bib
Browse files Browse the repository at this point in the history
  • Loading branch information
marquis committed Feb 1, 2016
1 parent a12d0ee commit ed8478d
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 4 deletions.
Binary file added app/assets/images/icons/cdc-burst.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/icons/cdc1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions app/helpers/cul_catalog_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,22 @@ def law_requests_blurb

end

def get_badge_html(document)
# begin
badges = APP_CONFIG['badges']
# Lookup this doc to see if it's got a badge
return unless badge_id = badges['bibs'][document.id]
# use the badge id (e.g., "dcg") to fetch badge details
badge = badges[badge_id]
extra = {size: '50x80'}
if badge['tooltip'].present?
extra['data'] = {toggle: 'tooltip', placement: 'top'}
extra['title'] = badge['tooltip']
end
badge_html = image_tag('icons/' + badge['icon'], extra)
# rescue
# return nil
# end
end

end
6 changes: 5 additions & 1 deletion app/views/_formats/clio/_standard_browse_item.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
= render "/_formats/clio/catalog_list_details", document: document, show_title: show_title

.doc_bookjacket.col-sm-2.hidden-xs
=image_tag("spacer.png", :class => "list_view bookjacket " + extract_standard_bibkeys(document).listify.collect { |x| "id_" + x.to_s.gsub(':','')}.join(" "))
-# NEXT-1030, if badge applies, insert instead of bookjacket
- if badge = get_badge_html(document)
= badge
- else
=image_tag("spacer.png", :class => "list_view bookjacket " + extract_standard_bibkeys(document).listify.collect { |x| "id_" + x.to_s.gsub(':','')}.join(" "))


6 changes: 5 additions & 1 deletion app/views/_formats/clio/_standard_list_item.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
= render "/_formats/clio/catalog_list_details", document: document

.doc_bookjacket.col-sm-2.hidden-xs
=image_tag("spacer.png", :class => "list_view bookjacket " + extract_standard_bibkeys(document).listify.collect { |x| "id_" + x.to_s.gsub(':','')}.join(" "))
- if badge = get_badge_html(document)
-# - raise
= badge
- else
=image_tag("spacer.png", :class => "list_view bookjacket " + extract_standard_bibkeys(document).listify.collect { |x| "id_" + x.to_s.gsub(':','')}.join(" "))


4 changes: 2 additions & 2 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
# *** CACHING ***
# ***************
# Turn development caching on to test Caching, ClickTale, etc.
# config.action_controller.perform_caching = false
config.action_controller.perform_caching = true
config.action_controller.perform_caching = false
# config.action_controller.perform_caching = true

# Cache store details - disk or memory? How big? (50MB?)
# config.cache_store = :memory_store, { size: 50_000_000 }
Expand Down

0 comments on commit ed8478d

Please sign in to comment.