</li>
</ul>
<p class="text-muted mb-0">
- <%= friendly_date_ago(trace.timestamp) %>
- <%= t ".by" %> <%= link_to trace.user.display_name, trace.user %>
- <% if !trace.tags.empty? %>
- <%= t ".in" %>
- <%= safe_join(trace.tags.collect { |tag| link_to_tag tag.tag }, ", ") %>
+ <% if trace.tags.empty? %>
+ <%= t ".details_without_tags_html", :time_ago => friendly_date_ago(trace.timestamp),
+ :user => link_to(trace.user.display_name, trace.user) %>
+ <% else %>
+ <%= t ".details_with_tags_html", :time_ago => friendly_date_ago(trace.timestamp),
+ :user => link_to(trace.user.display_name, trace.user),
+ :tags => safe_join(trace.tags.collect { |tag| link_to_tag tag.tag }, ", ") %>
<% end %>
</p>
<p class="fst-italic mb-0">
<%= link_to t(".my_traces"), { :action => "mine" }, { :class => "nav-link active" } %>
</li>
<% else %>
- <!-- public_traces_from @target_user -->
+ <!-- traces_from @target_user -->
<li class="nav-item">
<%= link_to t(".all_traces"), { :controller => "traces", :action => "index", :display_name => nil }, { :class => "nav-link" } %>
</li>
</li>
<% end %>
<li class="nav-item">
- <%= link_to t(".public_traces_from", :user => @target_user&.display_name), { :action => "mine" }, { :class => "nav-link active" } %>
+ <%= link_to t(".traces_from", :user => @target_user&.display_name), { :controller => "traces", :action => "index", :display_name => @target_user&.display_name }, { :class => "nav-link active" } %>
</li>
<% end %>
# Check the index of traces for a specific user
def test_index_user
user = create(:user)
+ checked_user_traces_path = url_for :only_path => true, :controller => "traces", :action => "index", :display_name => user.display_name
second_user = create(:user)
third_user = create(:user)
create(:trace)
# Test the user with the traces - should see only public ones
get traces_path(:display_name => user.display_name)
check_trace_index [trace_b]
+ assert_dom ".nav-tabs" do
+ assert_dom "a[href='#{traces_path}']", :text => "All Traces", :count => 1
+ assert_dom "a[href='#{traces_mine_path}']", :text => "My Traces", :count => 0
+ assert_dom "a[href='#{checked_user_traces_path}']", :text => Regexp.new(Regexp.escape(user.display_name)), :count => 1
+ end
session_for(third_user)
# Should still see only public ones when authenticated as another user
get traces_path(:display_name => user.display_name)
check_trace_index [trace_b]
+ assert_dom ".nav-tabs" do
+ assert_dom "a[href='#{traces_path}']", :text => "All Traces", :count => 1
+ assert_dom "a[href='#{traces_mine_path}']", :text => "My Traces", :count => 1
+ assert_dom "a[href='#{checked_user_traces_path}']", :text => Regexp.new(Regexp.escape(user.display_name)), :count => 1
+ end
session_for(user)
# Should see all traces when authenticated as the target user
get traces_path(:display_name => user.display_name)
check_trace_index [trace_c, trace_b]
+ assert_dom ".nav-tabs" do
+ assert_dom "a[href='#{traces_path}']", :text => "All Traces", :count => 1
+ assert_dom "a[href='#{traces_mine_path}']", :text => "My Traces", :count => 1
+ assert_dom "a[href='#{checked_user_traces_path}']", :text => Regexp.new(Regexp.escape(user.display_name)), :count => 0
+ end
# Should only see traces with the correct tag when a tag is specified
get traces_path(:display_name => user.display_name, :tag => "London")