_comment_form.rhtml
1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<%
comment_form_id = 'comment_form'+ rand(9999).to_s
%>
<% focus_on = logged_in? ? 'title' : 'name' %>
<%= error_messages_for :comment %>
<% @form_div ||= 'closed' %>
<div
class="post_comment_box <%= @form_div %>"
onclick="f=$('<%= comment_form_id %>');
this.className = this.className.replace(/closed/,'opened');
f.commit.focus(); f['comment[<%= focus_on %>]'].focus();
this.onclick=null">
<h4><%= content_tag('a', '', :name => 'comment_form') + _('Post a comment') %></h4>
<% form_tag( url_for(@page.view_url.merge({:only_path => true})), { :id => comment_form_id } ) do %>
<%= icaptcha_field() %>
<%= hidden_field_tag(:confirm, 'false') %>
<%= required_fields_message %>
<% unless logged_in? %>
<%= required labelled_form_field(_('Name'), text_field(:comment, :name)) %>
<%= required labelled_form_field(_('e-mail'), text_field(:comment, :email)) %>
<p>
<%= _('If you are a registered user, you can login and be automatically recognized.') %>
</p>
<% end %>
<%= required labelled_form_field(_('Title'), text_field(:comment, :title)) %>
<%= required labelled_form_field(_('Enter your comment'), text_area(:comment, :body, :rows => 5)) %>
<% button_bar do %>
<%= submit_button('add', _('Post comment'), :onclick => "$('confirm').value = 'true'") %>
<% end %>
<% end %>
</div><!-- end class="post_comment_box" -->