Feature #24089 » 0002-For-3-comments-or-more-show-reply-link-at-top-of-com.patch
| app/helpers/application_helper.rb | ||
|---|---|---|
|
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
|
||
| app/views/messages/show.html.erb | ||
|---|---|---|
|
<% unless @replies.empty? %>
|
||
|
<h3 class="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">
|
||
| app/views/news/show.html.erb | ||
|---|---|---|
|
<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">
|
||