From 9e46754c887e9dc2caa412942dc7e964aa48cfcf Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 14 Mar 2018 14:21:43 +0800 Subject: [PATCH] User user_path to generate links to users --- app/views/issues/_comments.html.erb | 4 ++-- app/views/issues/_reports.html.erb | 5 +++-- app/views/issues/index.html.erb | 4 ++-- config/locales/en.yml | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/views/issues/_comments.html.erb b/app/views/issues/_comments.html.erb index ec885aa8c..e42371465 100644 --- a/app/views/issues/_comments.html.erb +++ b/app/views/issues/_comments.html.erb @@ -2,9 +2,9 @@ <% comments.each do |comment| %>
- <%= link_to user_thumbnail(comment.user), :controller => :user, :action =>:view, :display_name => comment.user.display_name %> + <%= link_to user_thumbnail(comment.user), user_path(comment.user.display_name) %>
- <%= link_to comment.user.display_name, :controller => :user, :action =>:view, :display_name => comment.user.display_name %>
+ <%= link_to comment.user.display_name, user_path(comment.user.display_name) %>
<%= comment.body %>
diff --git a/app/views/issues/_reports.html.erb b/app/views/issues/_reports.html.erb index 01c34efe1..51643a6af 100644 --- a/app/views/issues/_reports.html.erb +++ b/app/views/issues/_reports.html.erb @@ -1,9 +1,10 @@ <% reports.each do |report| %>
- <%= link_to user_thumbnail(report.user), :controller => :user, :action =>:view, :display_name => report.user.display_name %> + <%= link_to user_thumbnail(report.user), user_path(report.user.display_name) %>
- <%= t(".reported_by_html", :category => report.category, :user_name => report.user.display_name, :user_url => url_for(:controller => :user, :action => :view, :display_name => report.user.display_name)) %>
+ <%= t ".reported_by_html", :category => report.category, :user => link_to(report.user.display_name, user_path(report.user.display_name)) %> +
<%= t(".updated_at", :datetime => l(report.updated_at.to_datetime, :format => :friendly)) %> diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 53927701e..30b283324 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -34,10 +34,10 @@ <%= t "issues.states.#{issue.status}" %> <%= link_to t(".reports_count", :count => issue.reports_count), issue %> <%= link_to reportable_title(issue.reportable), reportable_url(issue.reportable) %> - <%= link_to issue.reported_user.display_name, :controller => :user, :action => :view, :display_name => issue.reported_user.display_name if issue.reported_user %> + <%= link_to issue.reported_user.display_name, user_path(issue.reported_user.display_name) if issue.reported_user %> <% if issue.user_updated %> - <%= t ".last_updated_time_user_html", :user => link_to(issue.user_updated.display_name, :controller => :user, :action => :view, :display_name => issue.user_updated.display_name), + <%= t ".last_updated_time_user_html", :user => link_to(issue.user_updated.display_name, user_path(issue.user_updated.display_name)), :time => distance_of_time_in_words_to_now(issue.updated_at), :title => l(issue.updated_at) %> <% else %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 65c490e8d..2466561b4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1028,7 +1028,7 @@ en: created_at: "On %{datetime}" reports: updated_at: "On %{datetime}" - reported_by_html: "Reported as %{category} by %{user_name}" + reported_by_html: "Reported as %{category} by %{user}" resolved: Issue status has been set to 'Resolved' ignored: Issue status has been set to 'Ignored' reopened: Issue status has been set to 'Open' -- 2.39.5