Sha256: 7be976f4c8d6fac715ba28d662d72d2d87cb044f2a507ccf1716349faefbe035

Contents?: true

Size: 1012 Bytes

Versions: 9

Compression:

Stored size: 1012 Bytes

Contents

<%=
  if @comment.parent.nil?
    partial = 'threads'
    extra_locals = {}
    id = "commontator-thread-#{@commontator_thread.id}-new-comment"
  else
    partial = 'comments'
    extra_locals = { comment: @comment.parent }
    id = "commontator-comment-#{@comment.parent.id}-reply"
  end

  render partial: "commontator/#{partial}/show", locals: extra_locals.merge(
    user: @commontator_user,
    thread: @commontator_thread,
    page: @commontator_page,
    show_all: @commontator_show_all
  )
%>

<% if @commontator_new_comment.nil? %>
  $("#<%= id %>").hide();

  $("#<%= id %>-link").fadeIn();
<% else %>
  $("#<%= id %>").html("<%= escape_javascript(
    render partial: 'form', locals: {
      comment: @commontator_new_comment, thread: @commontator_thread
    }
  ) %>");
<% end %>

var commontatorComment = $("#commontator-comment-<%= @comment.id %>").hide().fadeIn();
$('html, body').animate(
  { scrollTop: commontatorComment.offset().top - window.innerHeight/2 }, 'fast'
);

<%= javascript_proc %>

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
commontator-7.0.1 app/views/commontator/comments/create.js.erb
commontator-7.0.0 app/views/commontator/comments/create.js.erb
commontator-6.3.2 app/views/commontator/comments/create.js.erb
commontator-6.3.1 app/views/commontator/comments/create.js.erb
commontator-6.3.0 app/views/commontator/comments/create.js.erb
commontator-6.2.1 app/views/commontator/comments/create.js.erb
commontator-6.2.0 app/views/commontator/comments/create.js.erb
commontator-6.1.1 app/views/commontator/comments/create.js.erb
commontator-6.1.0 app/views/commontator/comments/create.js.erb