diff --git a/app/helpers/changesets_helper.rb b/app/helpers/changesets_helper.rb
index 3a26c2001c9..c1164a4264c 100644
--- a/app/helpers/changesets_helper.rb
+++ b/app/helpers/changesets_helper.rb
@@ -3,7 +3,7 @@ def changeset_user_link(changeset)
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))
+ truncated_user_link changeset.user
else
t("browse.anonymous")
end
diff --git a/app/helpers/user_helper.rb b/app/helpers/user_helper.rb
index 3554980b84f..cfcd56b874f 100644
--- a/app/helpers/user_helper.rb
+++ b/app/helpers/user_helper.rb
@@ -50,6 +50,16 @@ def user_image_url(user, options = {})
end
end
+ def truncated_user_link(user, **options)
+ classes = %w[d-inline-block align-bottom text-truncate]
+ if options[:width]
+ style = "max-width: #{options[:width]}"
+ else
+ classes <<= "mw-100"
+ end
+ link_to user.display_name, user_path(user), :class => classes, :style => style
+ end
+
# External authentication support
def openid_logo
diff --git a/app/views/messages/_message_summary.html.erb b/app/views/messages/_message_summary.html.erb
index 4a552e83e05..907c9d42753 100644
--- a/app/views/messages/_message_summary.html.erb
+++ b/app/views/messages/_message_summary.html.erb
@@ -1,5 +1,5 @@
">
- <%= link_to message_summary.sender.display_name, user_path(message_summary.sender) %> |
+ <%= truncated_user_link message_summary.sender, :width => "30em" %> |
<%= link_to message_summary.title, message_path(message_summary) %> |
<%= l message_summary.sent_on, :format => :friendly %> |
diff --git a/app/views/messages/_sent_message_summary.html.erb b/app/views/messages/_sent_message_summary.html.erb
index 24caba5ab0a..e06770cb432 100644
--- a/app/views/messages/_sent_message_summary.html.erb
+++ b/app/views/messages/_sent_message_summary.html.erb
@@ -1,5 +1,5 @@
|
- <%= link_to sent_message_summary.recipient.display_name, user_path(sent_message_summary.recipient) %> |
+ <%= truncated_user_link sent_message_summary.recipient, :width => "30em" %> |
<%= link_to sent_message_summary.title, message_path(sent_message_summary) %> |
<%= l sent_message_summary.sent_on, :format => :friendly %> |
diff --git a/app/views/user_blocks/_block.html.erb b/app/views/user_blocks/_block.html.erb
index f39efb571ec..77e6416e50f 100644
--- a/app/views/user_blocks/_block.html.erb
+++ b/app/views/user_blocks/_block.html.erb
@@ -1,9 +1,9 @@
|
<% if show_user_name %>
- <%= link_to block.user.display_name, user_path(block.user) %> |
+ <%= truncated_user_link block.user, :width => "30em" %> |
<% end %>
<% if show_creator_name %>
- <%= link_to block.creator.display_name, user_path(block.creator) %> |
+ <%= truncated_user_link block.creator, :width => "20em" %> |
<% end %>
<%= h truncate(block.reason) %> |
<%= h block_status(block) %> |