Skip to content

Commit

Permalink
Renders collection names as links (#449)
Browse files Browse the repository at this point in the history
* Renders collection names as links

* Use collection_path instead of collection_url
  • Loading branch information
hectorcorrea authored Sep 29, 2022
1 parent f27890c commit fac0401
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/views/users/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
<% if @user.super_admin? %>
<!-- not sure we want to display the collections here, it's pointless -->
<% elsif @user.curator? %>
<p>Curator for: <%= @user.admin_collections.map(&:title).to_sentence %></p>
<p>Curator for:
<%= @user.admin_collections.map do |collection|
link_to(collection.title, collection_path(collection))
end.to_sentence.html_safe %></p>
<% end %>
<% if @my_dashboard %>
Expand Down
9 changes: 9 additions & 0 deletions spec/system/user_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
describe "Sort by last edited uses the proper value" do
let(:user_admin) { FactoryBot.create :super_admin_user }
let(:work) { FactoryBot.create(:draft_work) }
let(:moderator_user) { FactoryBot.create :pppl_moderator }

it "renders the proper date value for sorting by last edited", js: true do
work_last_edited = work.updated_at.strftime("%Y-%m-%d %H:%M:%S %Z")
Expand All @@ -12,5 +13,13 @@
visit user_path(user_admin)
expect(page.html.include?(sort_value)).to be true
end

it "renders the collection names as links", js: true do
sign_in moderator_user
visit user_path(moderator_user)
pppl_url = collection_path(Collection.plasma_laboratory)
expected_link = "<a href=\"#{pppl_url}\">#{Collection.plasma_laboratory.title}</a>"
expect(page.html.include?(expected_link)).to be true
end
end
end

0 comments on commit fac0401

Please sign in to comment.