bborn/communityengine

View on GitHub
app/views/comments/_comment_form.html.haml

Summary

Maintainability
Test Coverage
- if logged_in? || configatron.allow_anonymous_commenting

  = bootstrap_form_for(:comment, :url => commentable_comments_path(commentable.class.to_s.tableize, commentable), :remote => true, :layout => :horizontal, :html => {:id => 'comment'}) do |f|
    = f.text_area :comment, :rows => 5, :style => 'width: 99%', :class => "rich_text_editor", :help => :comment_character_limit.l

    - if !logged_in? && configatron.recaptcha_pub_key && configatron.recaptcha_priv_key
      = f.text_field :author_name
      = f.text_field :author_email, :required => true

      = f.form_group do
        =f.check_box :notify_by_email, :label => :notify_me_of_follow_ups_via_email.l
        -if commentable.respond_to?(:send_comment_notifications?) && !commentable.send_comment_notifications?
          %p.help-block= :comment_notifications_off.l

      = f.text_field :author_url, :label => :comment_web_site_label.l

      = f.form_group do
        = recaptcha_tags :ajax => true

    = f.form_group :submit_group do
      = f.primary :add_comment.l, data: { disable_with: "Please wait..." }

- else
  .btn-group
    = link_to :log_in_to_leave_a_comment.l, new_commentable_comment_path(commentable.class, commentable.id), :class => 'btn btn-primary'
    = link_to :create_an_account.l, signup_path, :class => 'btn btn-primary'