Skip to content

Commit

Permalink
updates for collection views
Browse files Browse the repository at this point in the history
  • Loading branch information
eliotjordan committed Feb 15, 2016
1 parent 3112ba9 commit 577cc2c
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 13 deletions.
10 changes: 7 additions & 3 deletions app/helpers/geoblacklight_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,18 @@ def render_web_services(reference)
render partial: 'web_services_default', locals: { reference: reference }
end

def psearch
def collection_parent?(document)
document['dc_type_s'] == 'Collection'
end

def collection_search?
params['f'] && params['f']['dct_isPartOf_sm']
end

def collection_badge(document)
return unless document['dc_type_s'] == 'Collection'
return unless collection_parent?(document)
path = path_for_facet('dct_isPartOf_sm', document['dc_identifier_s'])
if psearch
if collection_search?
content_tag(:span, 'Collection', class: 'label label-warning')
else
link_to content_tag(:span,
Expand Down
6 changes: 4 additions & 2 deletions app/views/catalog/_index_split_default.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<% # header bar for doc items in index view -%>
<%= content_tag :div, class: 'documentHeader row', data: { layer_id: document[:uuid], bbox: document.bounding_box_as_wsen } do %>
<div class='status-icons'>
<% if document['dc_type_s'] != 'Collection' %>
<% if collection_parent?(document) %>
<span class="glyphicon glyphicon-list geoblacklight-icon" title="Collection"></span>
<% else %>
<%= geoblacklight_icon(document['layer_geom_type_s']) %>
<% end %>
<%= geoblacklight_icon(document['dct_provenance_s']) %>
Expand All @@ -18,7 +20,7 @@
</h3>
<div class='col-md-12 more-info-area'>
<div class='collapse' data-collapse-target="<%= document['uuid'] %>">
<div class="collapse <%= 'in' if collection_search? && collection_parent?(document) %>" data-collapse-target="<%= document['uuid'] %>">
<small>
<%= document['solr_year_i'] %>. <i><%= document['dc_creator_sm'].nil?? '' : document['dc_creator_sm'].join(', ') %></i>. <%= snippit(document['dc_description_s']) %>. <%= document['dc_publisher_s'] %>.
</small>
Expand Down
6 changes: 5 additions & 1 deletion app/views/catalog/_show_header_default.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<h2>
<span itemprop="name"><%= document_heading(document) %></span>
<small>
<%= geoblacklight_icon(document['layer_geom_type_s']) %>
<% if document['dc_type_s'] == 'Collection' %>
<span class="glyphicon glyphicon-list geoblacklight-icon" title="Collection"></span>
<% else %>
<%= geoblacklight_icon(document['layer_geom_type_s']) %>
<% end %>
<%= geoblacklight_icon(document['dct_provenance_s']) %>
<%= geoblacklight_icon(document['dc_rights_s']) %>
</small>
Expand Down
4 changes: 4 additions & 0 deletions app/views/catalog/_upper_metadata.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@
<dt>More details at</dt>
<dd itemprop="url"><%= link_to @document.references.url.endpoint, @document.references.url.endpoint %></dd>
<% end %>
<% if collection_parent?(document) %>
<dt>Items in:</dt>
<dd itemprop="url"><%= collection_badge(document) %></dd>
<% end %>
</dl>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ class CatalogController < ApplicationController
config.add_show_field 'dc_creator_sm', label: 'Author(s)', itemprop: 'author'
config.add_show_field 'dc_description_s', label: 'Description', itemprop: 'description', helper_method: :render_value_as_truncate_abstract
config.add_show_field 'dc_publisher_s', label: 'Publisher', itemprop: 'publisher'
config.add_show_field 'dct_isPartOf_sm', label: 'Collection', itemprop: 'isPartOf'
config.add_show_field 'dct_spatial_sm', label: 'Place(s)', itemprop: 'spatial', link_to_search: true
config.add_show_field 'dc_subject_sm', label: 'Subject(s)', itemprop: 'keywords', link_to_search: true
config.add_show_field 'dct_temporal_sm', label: 'Year', itemprop: 'temporal'
config.add_show_field 'dct_provenance_s', label: 'Held by', link_to_search: true
config.add_show_field 'dct_isPartOf_sm', label: 'Collection', itemprop: 'isPartOf', link_to_search: true

# "fielded" search configuration. Used by pulldown among other places.
# For supported keys in hash, see rdoc for Blacklight::SearchFields
Expand Down
2 changes: 1 addition & 1 deletion spec/features/home_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
end
scenario 'find by category' do
expect(page).to have_css '.category-block', count: 4
expect(page).to have_css '.home-facet-link', count: 32
expect(page).to have_css '.home-facet-link', count: 33
expect(page).to have_css 'a.more_facets_link', count: 4
click_link 'Elevation'
expect(page).to have_css '.filterName', text: 'Subject'
Expand Down
36 changes: 36 additions & 0 deletions spec/fixtures/solr_documents/1-princeton-fk4h70np6t.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"uuid": "http://arks.princeton.edu/ark:/88435/fk4h70np6t",
"dc_creator_sm": [
"Sanborn Map Company"
],
"dc_description_s": "This a Sanborn map of Princeton",
"dc_format_s": "Scanned Map",
"dc_identifier_s": "fk4h70np6t",
"dc_language_s": "English",
"dc_publisher_s": "New York: Sanborn Map Company",
"dc_rights_s": "Public",
"dct_provenance_s": "Princeton",
"dct_references_s": "{}",
"layer_id_s": "fk4h70np6t",
"layer_slug_s": "princeton-fk4h70np6t",
"layer_geom_type_s": "Image",
"layer_modified_dt": "2015-01-18T17:01:38Z",
"dc_subject_sm": [
"Boundaries",
"Structure",
"Fire Insurance",
"Sanborn"
],
"dc_title_s": "Fire Insurance Map of Princeton, New Jersey, 1911",
"dc_type_s": "Collection",
"dct_spatial_sm": [
"New Jersey",
"Princeton"
],
"dct_temporal_sm": [
"1911"
],
"georss_box_s": "40.330188 -74.683192 40.357893 -74.634633",
"solr_geom": "ENVELOPE(-74.683192, -74.634633, 40.357893, 40.330188)",
"solr_year_i": 1911
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"Sanborn"
],
"dc_title_s": "Fire Insurance Map of Princeton, New Jersey (Sheet 1) (1911)",
"dc_type_s": "Collection",
"dc_type_s": "Image",
"dct_spatial_sm": [
"New Jersey",
"Princeton"
Expand All @@ -32,5 +32,6 @@
],
"georss_box_s": "40.330188 -74.683192 40.357893 -74.634633",
"solr_geom": "ENVELOPE(-74.683192, -74.634633, 40.357893, 40.330188)",
"solr_year_i": 1911
"solr_year_i": 1911,
"dct_isPartOf_sm": ["fk4h70np6t"]
}
2 changes: 1 addition & 1 deletion spec/fixtures/solr_documents/3-princeton-dz010r862.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
],
"georss_box_s": "40.347917827 -74.6666479111 40.3525457014 -74.6614980698",
"solr_geom": "ENVELOPE(-74.6666479111, -74.6614980698, 40.3525457014, 40.347917827)",
"dct_isPartOf_sm": ["pc289k875"]
"dct_isPartOf_sm": ["fk4h70np6t"]
}
2 changes: 1 addition & 1 deletion spec/fixtures/solr_documents/4-princeton-9593tw937.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
"georss_box_s": "40.3545897145 -74.6667981148 40.3577619 -74.6613585949",
"solr_geom": "ENVELOPE(-74.6667981148, -74.6613585949, 40.3577619, 40.3545897145)",
"solr_year_i": 1911,
"dct_isPartOf_sm": ["pc289k875"]
"dct_isPartOf_sm": ["fk4h70np6t"]
}
2 changes: 1 addition & 1 deletion spec/fixtures/solr_documents/5-princeton-5d86p201g.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
"georss_box_s": "40.3516626686 -74.6647167206 40.3555217638 -74.6604681015",
"solr_geom": "ENVELOPE(-74.6647167206, -74.6604681015, 40.3555217638, 40.3516626686)",
"solr_year_i": 1911,
"dct_isPartOf_sm": ["pc289k875"]
"dct_isPartOf_sm": ["fk4h70np6t"]
}

0 comments on commit 577cc2c

Please sign in to comment.