<% focus_on = logged_in? ? 'title' : 'name' %> <% edition_mode = (defined? edition_mode) ? edition_mode : false %>
<% if display_link %>

<%= content_tag('a', '', :name => 'comment_form') + _('Post a comment') %>

<% end %> <% if !edition_mode && !pass_without_comment_captcha? %> <% end %> <% remote_form_for(:comment, comment, :url => {:profile => profile.identifier, :controller => 'comment', :action => (edition_mode ? 'update' : 'create'), :id => (edition_mode ? comment.id : @page.id)}, :html => { :class => 'comment_form' } ) do |f| %> <% if comment && comment.errors.any? %> <%= error_messages_for :comment %> <% end %> <%= hidden_field_tag(:confirm, 'false') %> <%= required_fields_message %> <% unless logged_in? %> <%= required labelled_form_field(_('Name'), f.text_field(:name)) %> <%= required labelled_form_field(_('e-mail'), f.text_field(:email)) %>

<%= _('If you are a registered user, you can login and be automatically recognized.') %>

<% end %> <% if !edition_mode && !pass_without_comment_captcha? %> <%= hidden_field_tag(:recaptcha_response_field, nil, :id => nil) %> <%= hidden_field_tag(:recaptcha_challenge_field, nil, :id => nil) %> <% end %> <%= labelled_form_field(_('Title'), f.text_field(:title)) %> <%= required labelled_form_field(_('Enter your comment'), f.text_area(:body, :rows => 5)) %> <%= f.hidden_field(:reply_of_id) %> <% button_bar do %> <%= submit_button('add', _('Post comment'), :onclick => "if(check_captcha(this)) { save_comment(this) } else { check_captcha(this, save_comment)};return false;") %> <%= button_to_function :cancel, _('Cancel'), "jQuery.colorbox.close();f=jQuery(this).parents('.post_comment_box'); f.removeClass('opened'); f.addClass('closed'); return false" %> <% end %> <% end %>