1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-08 16:41:31 +00:00

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
This commit is contained in:
Jean-Philippe Lang 2017-04-09 09:39:59 +00:00
parent d3b70f5eb9
commit 3bfc5e42da
3 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -35,6 +35,9 @@
<% unless @replies.empty? %>
<h3 class="comments icon icon-comments"><%= l(:label_reply_plural) %> (<%= @reply_count %>)</h3>
<% if !@topic.locked? && authorize_for('messages', 'reply') && @replies.size >= 3 %>
<p><%= toggle_link l(:button_reply), "reply", :focus => 'message_content', :scroll => "message_content" %></p>
<% end %>
<% @replies.each do |message| %>
<div class="message reply" id="<%= "message-#{message.id}" %>">
<div class="contextual">

View File

@ -33,6 +33,9 @@
<div id="comments" style="margin-bottom:16px;">
<h3 class="comments"><%= l(:label_comment_plural) %></h3>
<% if @news.commentable? && @comments.size >= 3 %>
<p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments", :scroll => "comment_comments" %></p>
<% end %>
<% @comments.each do |comment| %>
<% next if comment.new_record? %>
<div class="contextual">