- content_for :javascript do
  initialize_signup_form("#{I18n.locale}","#{t("people.new.username_is_in_use")}","#{t("people.new.username_is_invalid")}","#{email_not_accepted_message}", "#{t("people.new.invalid_invitation_code")}", #{@current_community.real_name_required?}, #{@current_community.join_with_invite_only?} );

- content_for :title_header do
  %h1= t('.sign_up')

.signup-form.centered-section

  - if @community_customization && @community_customization.signup_info_content
    %p
      = @community_customization.signup_info_content.html_safe
  - elsif @current_community.allowed_emails
    %p
      = t('.email_restriction_instructions',
            :community_name => @current_community.name(I18n.locale),
            :allowed_emails => @current_community.allowed_emails,
            :count => (@current_community.allowed_emails.split(",").count))

  - unless !facebook_connect_in_use? || params[:no_fb]
    = render :partial => "layouts/facebook_connect_button", :locals => { :button_text => t(".create_account_with_facebook") }

    .signup-horizontal-line
      .signup-horizontal-line-text=t(".OR")

    %h3=t(".signup_with_email")

  = form_for @person, :url => APP_CONFIG.login_domain.to_s + people_path do |form|

    -# Invite code
    - if @current_community.join_with_invite_only?
      .inline-label-container
        = label_tag :invitation_code, t('.invitation_code'), :class => "inline"
        = link_to(t('common.what_is_this'), "#", :tabindex => "-1", :id => "help_invitation_code_link", :class => "label-info")
      = text_field_tag "invitation_code", nil, :class => :text_field, :maxlength => "20", :value => (params[:code] || "")
    - elsif params[:code]
      = hidden_field_tag "invitation_code", params[:code]

    -# Honey pot: hidden field to detect spammers
    = form.label :input_again, "You should not see this field, if CSS is working. If you see this, please send feedback!", :class => "unwanted_text_field"
    = form.text_field :input_again, :class => "unwanted_text_field", :id => "error_regristration_unwanted_email2", :autocomplete => "off"

    -# Email
    = form.label :email, t('.email')
    = form.text_field :email, :class => :text_field, :maxlenght => "255"

    -# Name
    = form.label :given_name, t('.given_name')
    = form.text_field :given_name, :class => :text_field, :maxlength => "30"
    = form.label :family_name, t('.family_name')
    = form.text_field :family_name, :class => :text_field, :maxlength => "30"

    -# Username
    = form.label :username, username_label
    = form.text_field :username, :class => :text_field, :maxlength => "20", :id => "person_username1"

    -# Password
    = form.label :password, t('common.password')
    = form.password_field :password, :class => :text_field, :maxlength => "255", :id => "person_password1"
    = form.label :password2, t('.password_again')
    = form.password_field :password2, :class => :text_field, :maxlength => "255"

    -# Terms
    .outer-checkbox-container
      .checkbox-container
        - unless @skip_terms_checkbox
          %input{:type => "checkbox", :id => "person_terms", :name => "person[terms]"}
          = form.label :terms, t('.i_accept_the'), :class => "checkbox"
          = link_to t(".terms"), "#", :tabindex => "-1", :id => "terms_link", :class => "form"

    = form.hidden_field :consent, :value => @current_community.consent

    = button_tag t('.create_new_account')

= render :partial => "help_texts", :collection => ["terms", "help_invitation_code"], :as => :field
