From 18c70fa2ded1fbad78d108794800be0309bbf499 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 24 Nov 2021 10:51:58 +0000 Subject: [PATCH] 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 --- app/controllers/diary_entries_controller.rb | 2 ++ app/views/diary_entries/comments.html.erb | 3 ++- config/locales/en.yml | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) 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 -- 2.39.5