Sha256: 6685a7cb2bd4781cbd6d15542edb85a9c9b7da957be504f63b8462cd09aa5dff

Contents?: true

Size: 1.61 KB

Versions: 7

Compression:

Stored size: 1.61 KB

Contents

<%
	target ||= nil
	main ||= false

	formClass = "comment_form"
	namespace = nil
	namespace_space = ""

	if comment.parent and comment.new_record?
		namespace = "reply_to_#{comment.parent.id}"
		namespace_space = namespace + "_"
	end

	if main
		formClass += " main_comment_form"
	end
%>

<%
	random_number_1 = rand(4)+1
	random_number_2 = rand(4)+1
%>

<%= form_for comment, namespace: namespace, remote: true, format: :json, html: {class: formClass}, data: {target: target} do |f| %>
	<%= f.label :author %><br />
	<%= f.text_field :author %><br />
	<%= f.label :body %><br />
	<%= f.text_area :body, rows: 7, cols: 50 %><br />

	<% if comment.new_record? %>
		<%= label namespace_space+"antispam", "answer", "Spam bots can't do math. What is #{random_number_1} + #{random_number_2}?" %><br />
		<%= text_field "antispam", "answer", id: namespace_space+"antispam_answer" %><br />
		<%= hidden_field "antispam", "solution", value: random_number_1+random_number_2, id: namespace_space+"antispam_solution" %>
	<% end %>

	<%= label namespace_space+"subscription", "subscribe", "Notify me of other comments on this post" %><br />
	<%= check_box_tag "subscribe", "subscribe", false, {id: namespace_space+"subscription_subscribe", class: "subscription_subscribe"} %><br />

	<%= f.fields_for :subscription, Proclaim::Subscription.new do |f| %>
		<div class = "subscription_email" style = "display: none;">
			<%= f.label :email, "Email" %><br />
			<%= f.email_field :email %>
		</div>
	<% end %>

	<%= f.hidden_field :post_id %>
	<%= f.hidden_field :parent_id %>

	<%= f.submit "Comment" %>
	<%= f.button "Cancel", class: "cancel_comment" %>
<% end %>

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
proclaim-0.6.6 app/views/proclaim/comments/_form.html.erb
proclaim-0.6.5 app/views/proclaim/comments/_form.html.erb
proclaim-0.6.4 app/views/proclaim/comments/_form.html.erb
proclaim-0.6.3 app/views/proclaim/comments/_form.html.erb
proclaim-0.6.2 app/views/proclaim/comments/_form.html.erb
proclaim-0.6.1 app/views/proclaim/comments/_form.html.erb
proclaim-0.6.0 app/views/proclaim/comments/_form.html.erb