Module: Card::Set::All::Comment::Format

Extended by:
Card::Set::AbstractFormat
Defined in:
tmpsets/set/mod021-standard/all/comment.rb

Instance Method Summary collapse

Instance Method Details

#comment_authorObject



43
44
45
46
47
48
49
# File 'tmpsets/set/mod021-standard/all/comment.rb', line 43

def comment_author
  if Auth.signed_in?
    "[[#{Auth.current.name}]]"
  else
    "#{card.comment_author} (Not signed in)"
  end
end

#comment_author_labelObject



78
79
80
81
# File 'tmpsets/set/mod021-standard/all/comment.rb', line 78

def comment_author_label
  return if Auth.signed_in?
  %(<label>My Name is:</label> #{text_field :comment_author})
end

#comment_boxObject



68
69
70
# File 'tmpsets/set/mod021-standard/all/comment.rb', line 68

def comment_box
  text_area :comment, rows: 3
end

#comment_buttonsObject



72
73
74
75
76
# File 'tmpsets/set/mod021-standard/all/comment.rb', line 72

def comment_buttons
  wrap_with :div, class: "comment-buttons" do
    [comment_author_label, comment_submit_button]
  end
end

#comment_signatureObject



37
38
39
40
41
# File 'tmpsets/set/mod021-standard/all/comment.rb', line 37

def comment_signature
  wrap_with :div, class: "w-comment-author" do
    "#{comment_author}.....#{Time.zone.now}"
  end
end

#comment_submit_buttonObject



83
84
85
# File 'tmpsets/set/mod021-standard/all/comment.rb', line 83

def comment_submit_button
  submit_button text: "Comment", type: :submit, disable_with: "Commenting"
end

#comment_with_signatureObject



33
34
35
# File 'tmpsets/set/mod021-standard/all/comment.rb', line 33

def comment_with_signature
  card.clean_comment + "\n" + comment_signature
end

#hidden_comment_fieldsObject



60
61
62
63
64
65
66
# File 'tmpsets/set/mod021-standard/all/comment.rb', line 60

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