From 3bfc5e42da61f742c5f781638cb8818ab2e5ba1e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 9 Apr 2017 09:39:59 +0000 Subject: [PATCH] For 3 comments or more, show reply link at top of comments as well (#24089). Patch by Jan Schulz-Hofen. git-svn-id: http://svn.redmine.org/redmine/trunk@16539 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 1 + app/views/messages/show.html.erb | 3 +++ app/views/news/show.html.erb | 3 +++ 3 files changed, 7 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5c593a06f..29bc54157 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -237,6 +237,7 @@ module ApplicationHelper def toggle_link(name, id, options={}) onclick = "$('##{id}').toggle(); " onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ") + onclick << "$(window).scrollTop($('##{options[:focus]}').position().top); " if options[:scroll] onclick << "return false;" link_to(name, "#", :onclick => onclick) end diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb index f1a4f9bbb..180a2ba7d 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -35,6 +35,9 @@ <% unless @replies.empty? %>

<%= l(:label_reply_plural) %> (<%= @reply_count %>)

+<% if !@topic.locked? && authorize_for('messages', 'reply') && @replies.size >= 3 %> +

<%= toggle_link l(:button_reply), "reply", :focus => 'message_content', :scroll => "message_content" %>

+<% end %> <% @replies.each do |message| %>
">
diff --git a/app/views/news/show.html.erb b/app/views/news/show.html.erb index 2178e1c14..09e14f61f 100644 --- a/app/views/news/show.html.erb +++ b/app/views/news/show.html.erb @@ -33,6 +33,9 @@

<%= l(:label_comment_plural) %>

+<% if @news.commentable? && @comments.size >= 3 %> +

<%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments", :scroll => "comment_comments" %>

+<% end %> <% @comments.each do |comment| %> <% next if comment.new_record? %>
-- 2.39.5