0002-For-3-comments-or-more-show-reply-link-at-top-of-com.patch

Jan from Planio www.plan.io, 2016-10-17 17:20

Download (2.25 KB)

View differences:

app/helpers/application_helper.rb
226 226
  def toggle_link(name, id, options={})
227 227
    onclick = "$('##{id}').toggle(); "
228 228
    onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ")
229
    onclick << "$(window).scrollTop($('##{options[:focus]}').position().top); " if options[:scroll]
229 230
    onclick << "return false;"
230 231
    link_to(name, "#", :onclick => onclick)
231 232
  end
app/views/messages/show.html.erb
35 35

  
36 36
<% unless @replies.empty? %>
37 37
<h3 class="comments"><%= l(:label_reply_plural) %> (<%= @reply_count %>)</h3>
38
<% if !@topic.locked? && authorize_for('messages', 'reply') && @replies.size >= 3 %>
39
  <p><%= toggle_link l(:button_reply), "reply", :focus => 'message_content', :scroll => "message_content" %></p>
40
<% end %>
38 41
<% @replies.each do |message| %>
39 42
  <div class="message reply" id="<%= "message-#{message.id}" %>">
40 43
    <div class="contextual">
app/views/news/show.html.erb
33 33

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