Skip to content

Commit

Permalink
Merge 750e34d into 4a230c1
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Aug 16, 2018
2 parents 4a230c1 + 750e34d commit cc0e61a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/views/catalog/index.json.jbuilder
Expand Up @@ -14,6 +14,7 @@ json.data do
json.array! @presenter.documents do |document|
document_url = polymorphic_url(url_for_document(document))
json.id document.id
json.type document[blacklight_config.view_config(:index).display_type_field]
json.attributes do
doc_presenter = index_presenter(document)

Expand Down
1 change: 1 addition & 0 deletions app/views/catalog/show.json.jbuilder
Expand Up @@ -6,6 +6,7 @@ end

json.data do
json.id @document.id
json.type @document[blacklight_config.view_config(:show).display_type_field]
json.attributes do
doc_presenter = show_presenter(@document)

Expand Down
8 changes: 5 additions & 3 deletions spec/views/catalog/index.json.jbuilder_spec.rb
Expand Up @@ -4,8 +4,8 @@
let(:response) { instance_double(Blacklight::Solr::Response, documents: docs, prev_page: nil, next_page: 2, total_pages: 3) }
let(:docs) do
[
SolrDocument.new(id: '123', title_tsim: 'Book1', author_tsim: 'Julie'),
SolrDocument.new(id: '456', title_tsim: 'Book2', author_tsim: 'Rosie')
SolrDocument.new(id: '123', title_tsim: 'Book1', author_tsim: 'Julie', format: 'Book'),
SolrDocument.new(id: '456', title_tsim: 'Article1', author_tsim: 'Rosie', format: 'Article')
]
end
let(:config) do
Expand Down Expand Up @@ -63,6 +63,7 @@
expect(hash).to include(data: [
{
id: '123',
type: 'Book',
attributes: {
'title': {
id: 'http://test.host/catalog/123#title',
Expand All @@ -77,12 +78,13 @@
},
{
id: '456',
type: 'Article',
attributes: {
'title': {
id: 'http://test.host/catalog/456#title',
type: 'document_value',
attributes: {
value: 'Book2',
value: 'Article1',
label: 'Title'
}
}
Expand Down
3 changes: 2 additions & 1 deletion spec/views/catalog/show.json.jbuilder_spec.rb
Expand Up @@ -2,7 +2,7 @@

RSpec.describe "catalog/show.json" do
let(:document) do
SolrDocument.new(id: '123', title_tsim: 'Book1', author_tsim: 'Julie')
SolrDocument.new(id: '123', title_tsim: 'Book1', author_tsim: 'Julie', format: 'Book')
end
let(:config) do
Blacklight::Configuration.new do |config|
Expand All @@ -24,6 +24,7 @@
expect(hash).to include(data:
{
id: '123',
type: 'Book',
attributes: { 'title_tsim' => 'Book1' }
})
end
Expand Down

0 comments on commit cc0e61a

Please sign in to comment.