]> source.dussan.org Git - redmine.git/commitdiff
For 3 comments or more, show reply link at top of comments as well (#24089).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 9 Apr 2017 09:39:59 +0000 (09:39 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 9 Apr 2017 09:39:59 +0000 (09:39 +0000)
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
app/views/messages/show.html.erb
app/views/news/show.html.erb

index 5c593a06fc248dd0aaa4916742e6f0b7ed875dd3..29bc54157937cacede7c039e723aa5cfe5f741c9 100644 (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
index f1a4f9bbbffcb2ff8532e92c35d88aae6679f772..180a2ba7de8aed30f3b5b953db0074ce0aeae630 100644 (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">
index 2178e1c149c81e523c490d136848359e3d54d13c..09e14f61f097ede7b0ad741d5837b68af4f7a570 100644 (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">