From: Andy Allan Date: Wed, 24 Nov 2021 10:51:58 +0000 (+0000) Subject: Add a user link to the heading of the diary comments page X-Git-Tag: live~1401^2 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/18c70fa2ded1fbad78d108794800be0309bbf499 Add a user link to the heading of the diary comments page Fixes #3369 This makes the heading match the layout of the user's Notes page, which also has a short heading and a subheading with a link. Additionally, add a page title, again for consistency --- diff --git a/app/controllers/diary_entries_controller.rb b/app/controllers/diary_entries_controller.rb index 12f31bad2..312e1e54c 100644 --- a/app/controllers/diary_entries_controller.rb +++ b/app/controllers/diary_entries_controller.rb @@ -235,6 +235,8 @@ class DiaryEntriesController < ApplicationController end def comments + @title = t ".title", :user => @user.display_name + conditions = { :user_id => @user } conditions[:visible] = true unless can? :unhidecomment, DiaryEntry diff --git a/app/views/diary_entries/comments.html.erb b/app/views/diary_entries/comments.html.erb index 5f08f8d30..e3a7ff23e 100644 --- a/app/views/diary_entries/comments.html.erb +++ b/app/views/diary_entries/comments.html.erb @@ -1,5 +1,6 @@ <% content_for :heading do %> -

<%= t(".has_commented_on", :display_name => @user.display_name) %>

+

<%= t ".heading", :user => @user.display_name %>

+

<%= t ".subheading_html", :user => link_to(@user.display_name, user_path(@user)) %>

<% end %> <% if @comments.empty? %> diff --git a/config/locales/en.yml b/config/locales/en.yml index caee480d9..25e3b8e1a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -504,7 +504,9 @@ en: title: "OpenStreetMap diary entries" description: "Recent diary entries from users of OpenStreetMap" comments: - has_commented_on: "%{display_name} has commented on the following diary entries" + title: "Diary Comments added by %{user}" + heading: "%{user}'s Diary Comments" + subheading_html: "Diary Comments added by %{user}" no_comments: "No diary comments" post: Post when: When