Skip to content

Commit

Permalink
Add links to children of SubGuideCards
Browse files Browse the repository at this point in the history
closes #132

Co-authored-by: Anna Headley <hackartisan@users.noreply.github.com>
  • Loading branch information
leefaisonr and hackartisan committed Aug 25, 2023
1 parent 5b71b89 commit ac13242
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
11 changes: 8 additions & 3 deletions app/views/sub_guide_cards/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<h1>SubGuideCards#show</h1>
<p>Find me in app/views/sub_guide_cards/show.html.erb</p>
<%= @sub_guide_card.heading %>
<h2>SubGuide: <%= @sub_guide_card.heading %></h2>
<% if @sub_guide_card.children.present? %>
<ul>
<% @sub_guide_card.children.each do |sub_guide| %>
<li> <%= link_to sub_guide.heading, sub_guide_card_path(sub_guide.id) %> </li>
<% end %>
</ul>
<% end %>
<% @card_images.each do |image| %>
<%= image_tag(image.iiif_url) %>
<% end %>
7 changes: 6 additions & 1 deletion spec/system/subguide_cards_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@
end

describe 'show page' do
it 'displays card images as links' do
it 'displays card images' do
ci = CardImage.new
ci.path = SubGuideCard.find(2).path
ci.image_name = 'imagecat-disk1-0675-B1764-0000.0219.tif'
ci.save
visit '/sub_guide_cards/2'
expect(page).to have_selector('img')
end

it 'links to child SubGuideCards' do
visit '/sub_guide_cards/4'
expect(page).to have_link('(As author)')
end
end
end

0 comments on commit ac13242

Please sign in to comment.