Skip to content

Commit

Permalink
Merge 7695168 into 2a23401
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Oct 31, 2018
2 parents 2a23401 + 7695168 commit 56327f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/helpers/blacklight/url_helper_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ def url_for_document(doc, options = {})
search_state.url_for_document(doc, options)
end

# link_to_document(doc, 'VIEW', :counter => 3)
# Use the catalog_path RESTful route to create a link to the show page for a specific item.
# Uses the catalog_path route to create a link to the show page for an item.
# catalog_path accepts a hash. The solr query params are stored in the session,
# so we only need the +counter+ param here. We also need to know if we are viewing to document as part of search results.
# TODO: move this to the IndexPresenter
# @param doc [SolrDocument] the document
# @param field_or_opts [Hash, String] either a string to render as the link text or options
# @param opts [Hash] the options to create the link with
# @option opts [Number] :counter (nil) the count to set in the session (for paging through a query result)
# @example Passing in an image
# link_to_document(doc, '<img src="thumbnail.png">', counter: 3) #=> "<a href=\"catalog/123\" data-tracker-href=\"/catalog/123/track?counter=3&search_id=999\"><img src="thumbnail.png"></a>
# @example With the default document link field
# link_to_document(doc, counter: 3) #=> "<a href=\"catalog/123\" data-tracker-href=\"/catalog/123/track?counter=3&search_id=999\">My Title</a>
def link_to_document(doc, field_or_opts = nil, opts = { counter: nil })
if field_or_opts.is_a? Hash
opts = field_or_opts
Expand Down
1 change: 1 addition & 0 deletions app/presenters/blacklight/thumbnail_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class ThumbnailPresenter

# @param [SolrDocument] document
# @param [ActionView::Base] view_context scope for linking and generating urls
# as well as for invoking "thumbnail_method"
# @param [Blacklight::Configuration::ViewConfig] view_config
def initialize(document, view_context, view_config)
@document = document
Expand Down

0 comments on commit 56327f1

Please sign in to comment.