app/views/commontator/shared/_thread.html.erb in commontator-5.1.0 vs app/views/commontator/shared/_thread.html.erb in commontator-6.0.0.pre.1

- old
+ new

@@ -1,20 +1,32 @@ -<% # Clients of this partial must supply the following variables: - # thread - # user +<% + # Controllers that use this partial must supply the following variables: + # thread + # user + # per_page + # page + # show_all + # Additionally, they may override the following variable: + @commontator_thread_show ||= false %> -<% if thread.can_be_read_by?(user) %> - <div id="thread_<%= thread.id %>_div" class="thread" style="display: none;"> +<% if !thread.nil? && thread.can_be_read_by?(user) %> + <div id="commontator-thread-<%= thread.id %>" class="commontator thread"> <% if @commontator_thread_show %> - <%= render partial: 'commontator/threads/show', - locals: { thread: thread, - user: user, - page: @commontator_page, - per_page: @commontator_per_page } %> + <%= + render partial: 'commontator/threads/show', locals: { + thread: thread, + user: user, + page: page, + per_page: per_page, + show_all: show_all + } + %> <% else %> <% subscription = thread.subscription_for(user) %> - <%= link_to "#{t 'commontator.thread.actions.show'} (#{(subscription.unread_comments.count.to_s + '/') if subscription}#{thread.filtered_comments.count.to_s})", + <%= link_to "#{t 'commontator.thread.actions.show'} (#{ + (subscription.unread_comments.count.to_s + '/') if subscription + }#{thread.filtered_comments.count.to_s})", commontator.thread_path(thread), remote: true %> <% end %> </div> <% end %>