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? %>
<%= toggle_link l(:button_reply), "reply", :focus => 'message_content', :scroll => "message_content" %>
+<% end %> <% @replies.each do |message| %>
<%= 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? %>