-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show parent collections on collection show pages
- Loading branch information
Showing
13 changed files
with
153 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app/views/hyrax/collections/_show_parent_collections.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<% if @parent_collections.nil? || @parent_collections.empty? %> | ||
<div class="alert alert-warning" role="alert"><%= t('hyrax.collections.show.no_visible_parent_collections') %></div> | ||
<% else %> | ||
<div class="media-body"> | ||
<h4 class="media-heading"> | ||
<% @parent_collections.each do |document| %> | ||
<ul> | ||
<li> | ||
<%= link_to document, [hyrax, document], id: "src_copy_link_#{document.id}" %> | ||
</li> | ||
</ul> | ||
<% end %> | ||
</h4> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app/views/hyrax/dashboard/collections/_show_parent_collections.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<% if @parent_collections.nil? || @parent_collections.empty? %> | ||
<div class="alert alert-warning" role="alert"><%= t('hyrax.collections.show.no_visible_parent_collections') %></div> | ||
<% else %> | ||
<div class="media-body"> | ||
<h4 class="media-heading"> | ||
<% @parent_collections.each do |document| %> | ||
<ul> | ||
<li> | ||
<%= link_to document, [hyrax, :dashboard, document], id: "src_copy_link_#{document.id}" %> | ||
</li> | ||
</ul> | ||
<% end %> | ||
</h4> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
spec/views/hyrax/collections/_show_parent_collections.html.erb_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
RSpec.describe 'hyrax/collections/_show_parent_collections.html.erb', type: :view do | ||
let(:collection) { build(:named_collection, id: '123') } | ||
|
||
context 'when parent collection list is empty' do | ||
let(:parentcollection) { nil } | ||
|
||
before do | ||
assign(:parent_collections, parentcollection) | ||
end | ||
|
||
it "posts a warning message" do | ||
render('show_parent_collections.html.erb', collection: parentcollection) | ||
expect(rendered).to have_text("There are no visible parent collections.") | ||
end | ||
end | ||
|
||
context 'when parent collection list is not empty' do | ||
let(:parentcollection) { [collection] } | ||
|
||
before do | ||
assign(:parent_collections, parentcollection) | ||
assign(:document, collection) | ||
allow(collection).to receive(:title_or_label).and_return(collection.title) | ||
allow(collection).to receive(:persisted?).and_return true | ||
render('show_parent_collections.html.erb', collection: parentcollection) | ||
end | ||
|
||
it "posts the collection's title with a link to the collection" do | ||
expect(rendered).to have_link(collection.title.first) | ||
end | ||
|
||
xit 'includes a count of the parent collections' do | ||
# TODO: add test when actual count is added to page | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
spec/views/hyrax/dashboard/collections/_show_parent_collections.html.erb_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
RSpec.describe 'hyrax/dashboard/collections/_show_parent_collections.html.erb', type: :view do | ||
let(:collection) { build(:named_collection, id: '123') } | ||
|
||
context 'when parent collection list is empty' do | ||
let(:parentcollection) { nil } | ||
|
||
before do | ||
assign(:parent_collections, parentcollection) | ||
end | ||
|
||
it "posts a warning message" do | ||
render('show_parent_collections.html.erb', collection: parentcollection) | ||
expect(rendered).to have_text("There are no visible parent collections.") | ||
end | ||
end | ||
|
||
context 'when parent collection list is not empty' do | ||
let(:parentcollection) { [collection] } | ||
|
||
before do | ||
assign(:parent_collections, parentcollection) | ||
assign(:document, collection) | ||
allow(collection).to receive(:title_or_label).and_return(collection.title) | ||
allow(collection).to receive(:persisted?).and_return true | ||
render('show_parent_collections.html.erb', collection: parentcollection) | ||
end | ||
|
||
it "posts the collection's title with a link to the collection" do | ||
expect(rendered).to have_link(collection.title.first) | ||
end | ||
|
||
xit 'includes a count of the parent collections' do | ||
# TODO: add test when actual count is added to page | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters