class Object

Public Instance Methods

clean_comment() click to toggle source
# File set/all/comment.rb, line 21
def clean_comment
  comment.split(/\n/).map do |line|
    "<p>#{line.strip.empty? ? '&nbsp;' : line}</p>"
  end * "\n"
end
comment_author() click to toggle source
# File set/all/comment.rb, line 16
def comment_author
  @comment_author ||=
    Env.session[:comment_author] || Env.params[:comment_author] || "Anonymous"
end
comment_author_label() click to toggle source
# File set/all/comment.rb, line 74
def comment_author_label
  return if Auth.signed_in?

  %(<label>My Name is:</label> #{text_field :comment_author})
end
comment_box() click to toggle source
# File set/all/comment.rb, line 64
def comment_box
  text_area :comment, rows: 3
end
comment_buttons() click to toggle source
# File set/all/comment.rb, line 68
def comment_buttons
  wrap_with :div, class: "comment-buttons" do
    [comment_author_label, comment_submit_button]
  end
end
comment_signature() click to toggle source
# File set/all/comment.rb, line 32
def comment_signature
  wrap_with :div, class: "w-comment-author" do
    "#{comment_author}.....#{Time.zone.now}"
  end
end
comment_submit_button() click to toggle source
# File set/all/comment.rb, line 80
def comment_submit_button
  submit_button text: "Comment", type: :submit, disable_with: "Commenting"
end
comment_with_signature() click to toggle source
# File set/all/comment.rb, line 28
def comment_with_signature
  "#{card.clean_comment}\n#{comment_signature}"
end
commenting?() click to toggle source
# File set/all/comment.rb, line 1
def commenting?
  comment && action != :delete
end
hidden_comment_fields() click to toggle source
# File set/all/comment.rb, line 55
def hidden_comment_fields
  return unless card.new_card?

  hidden_field_tag "card[name]", card.name
  # FIXME: wish we had more generalized solution for names.
  # without this, nonexistent cards will often take left's linkname.
  # (needs test)
end