Skip to content

Commit

Permalink
Use presenters to deliver the document url and title
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Jan 13, 2020
1 parent 9837fc1 commit 72e2638
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
12 changes: 2 additions & 10 deletions app/helpers/blacklight/maps_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def sidebar_template
<div class='media'>
<div class='media-body'>
<h3 class='media-heading'>
<a href=\"#{document_path}\"}>
{#{blacklight_config.index.title_field}}
<a href=\"{url}\"}>
{title}
</a>
</h3>
</div>
Expand All @@ -34,14 +34,6 @@ def sidebar_template

private

##
# Document path used for creating client side links to documents from a
# template
# @return String
def document_path
"#{search_catalog_path}/{#{blacklight_config.document_unique_id_param}}"
end

##
# Data attributes used in displaying the index map
# @return Hash
Expand Down
5 changes: 5 additions & 0 deletions app/views/catalog/index.heatmaps.jbuilder
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
presenter = Blacklight::JsonPresenter.new(@response, blacklight_config)

json.response do
json.docs(presenter.documents) do |document|
json.url polymorphic_url(url_for_document(document))
json.title index_presenter(document).heading
end

json.facet_heatmaps @response['facet_counts']['facet_heatmaps']
json.pages presenter.pagination_info
end

0 comments on commit 72e2638

Please sign in to comment.