set/all/comment.rb in card-mod-comment-0.11.4 vs set/all/comment.rb in card-mod-comment-0.11.5
- old
+ new
@@ -3,10 +3,11 @@
end
event :add_comment, :prepare_to_store, on: :save, when: :comment do
Env.session[:comment_author] = comment_author if Env.session
return unless comment.present?
+
self.content =
[content, format.comment_with_signature].compact.join "\n<hr\>\n"
self.comment = nil
end
@@ -23,11 +24,11 @@
end * "\n"
end
format do
def comment_with_signature
- card.clean_comment + "\n" + comment_signature
+ "#{card.clean_comment}\n#{comment_signature}"
end
def comment_signature
wrap_with :div, class: "w-comment-author" do
"#{comment_author}.....#{Time.zone.now}"
@@ -51,10 +52,11 @@
end
end
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
@@ -69,9 +71,10 @@
end
end
def comment_author_label
return if Auth.signed_in?
+
%(<label>My Name is:</label> #{text_field :comment_author})
end
def comment_submit_button
submit_button text: "Comment", type: :submit, disable_with: "Commenting"