Simplify changeset/element-related link_to calls
This commit is contained in:
parent
56600b2931
commit
0dae690c06
8 changed files with 21 additions and 11 deletions
|
@ -3,7 +3,7 @@ module ChangesetsHelper
|
|||
if changeset.user.status == "deleted"
|
||||
t("users.no_such_user.deleted")
|
||||
elsif changeset.user.data_public?
|
||||
link_to(changeset.user.display_name, user_path(changeset.user))
|
||||
link_to changeset.user.display_name, changeset.user
|
||||
else
|
||||
t("browse.anonymous")
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<li><%= linked_name = link_to printable_element_name(containing_relation.relation), relation_path(containing_relation.relation)
|
||||
<li><%= linked_name = link_to printable_element_name(containing_relation.relation), containing_relation.relation
|
||||
if containing_relation.member_role.blank?
|
||||
t ".entry_html", :relation_name => linked_name
|
||||
else
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<% linked_name = link_to printable_element_name(relation_member.member), { :controller => relation_member.member_type.downcase.pluralize, :action => :show, :id => relation_member.member_id.to_s }, { :rel => link_follow(relation_member.member) }
|
||||
<% linked_name = link_to printable_element_name(relation_member.member), relation_member.member, { :rel => link_follow(relation_member.member) }
|
||||
type_str = t ".type.#{relation_member.member_type.downcase}" %>
|
||||
<%= element_list_item relation_member.member_type.downcase, relation_member.member do %>
|
||||
<%= if relation_member.member_role.blank?
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
<%= user_thumbnail changeset.user %>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h2><%= link_to title, changeset_path(changeset) %></h2>
|
||||
<h2><%= link_to title, changeset %></h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<small class='text-muted'>
|
||||
<%= t(".created_by_html", :link_user => link_to(changeset.user.display_name, user_path(changeset.user)), :created => l(changeset.created_at, :format => :blog)) %>
|
||||
<%= t(".created_by_html", :link_user => link_to(changeset.user.display_name, changeset.user), :created => l(changeset.created_at, :format => :blog)) %>
|
||||
</small>
|
||||
</div>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<small class='text-muted'>
|
||||
<%= t comment.visible ? ".comment_by_html" : ".hidden_comment_by_html",
|
||||
:time_ago => friendly_date_ago(comment.created_at),
|
||||
:user => link_to(comment.author.display_name, user_path(comment.author)) %>
|
||||
:user => link_to(comment.author.display_name, comment.author) %>
|
||||
<% if current_user&.moderator? %>
|
||||
—
|
||||
<%= tag.button t("javascripts.changesets.show.#{comment.visible ? 'hide' : 'unhide'}_comment"),
|
||||
|
@ -125,7 +125,7 @@
|
|||
<% if @next_by_user || @prev_by_user %>
|
||||
<div class='secondary-actions'>
|
||||
<% if @prev_by_user %>
|
||||
<%= link_to({ :id => @prev_by_user.id }, :class => "icon-link") do %>
|
||||
<%= link_to @prev_by_user, :class => "icon-link" do %>
|
||||
<%= previous_page_svg_tag :height => 11 %>
|
||||
<%= @prev_by_user.id %>
|
||||
<% end %>
|
||||
|
@ -135,7 +135,7 @@
|
|||
link_to tag.bdi(user), :controller => "changesets", :action => "index", :display_name => user %>
|
||||
<% if @next_by_user %>
|
||||
·
|
||||
<%= link_to({ :id => @next_by_user.id }, :class => "icon-link") do %>
|
||||
<%= link_to @next_by_user, :class => "icon-link" do %>
|
||||
<%= @next_by_user.id %>
|
||||
<%= next_page_svg_tag :height => 11 %>
|
||||
<% end %>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</div>
|
||||
<div class="col">
|
||||
<p class='text-muted mb-0'>
|
||||
<%= link_to contact.display_name, user_path(contact) %>
|
||||
<%= link_to contact.display_name, contact %>
|
||||
<% if @user.home_location? and contact.home_location? %>
|
||||
<% distance = @user.distance(contact) %>
|
||||
<% if distance < 1 %>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<% if changeset %>
|
||||
<%= t(".latest_edit_html", :ago => friendly_date_ago(changeset.created_at)) %>
|
||||
<% comment = changeset.tags["comment"].to_s == "" ? t("browse.no_comment") : changeset.tags["comment"] %>
|
||||
<q><%= link_to comment, changeset_path(changeset), :title => t("changesets.changeset.view_changeset_details") %></q>
|
||||
<q><%= link_to comment, changeset, :title => t("changesets.changeset.view_changeset_details") %></q>
|
||||
<% else %>
|
||||
<%= t "changesets.changeset.no_edits" %>
|
||||
<% end %>
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
</div>
|
||||
<div class="col mx-1">
|
||||
<p><%= t(".#{type}") %></p>
|
||||
<p><%= link_to popup.display_name, user_path(popup) %></p>
|
||||
<p><%= link_to popup.display_name, popup %></p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -266,6 +266,7 @@ class ChangesetsControllerTest < ActionDispatch::IntegrationTest
|
|||
assert_dom "p", :text => "tested-changeset-comment"
|
||||
assert_dom "li#c#{changeset_comment.id}" do
|
||||
assert_dom "> small", :text => /^Comment from #{commenting_user.display_name}/
|
||||
assert_dom "a[href='#{user_path(commenting_user)}']"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -316,6 +317,15 @@ class ChangesetsControllerTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
end
|
||||
|
||||
def test_show_adjacent_changesets
|
||||
user = create(:user)
|
||||
changesets = create_list(:changeset, 3, :user => user)
|
||||
|
||||
sidebar_browse_check :changeset_path, changesets[1].id, "changesets/show"
|
||||
assert_dom "a[href='#{changeset_path changesets[0]}']", :count => 1
|
||||
assert_dom "a[href='#{changeset_path changesets[2]}']", :count => 1
|
||||
end
|
||||
|
||||
##
|
||||
# This should display the last 20 non-empty changesets
|
||||
def test_feed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue