<%= form_for(resource, :as => "user", :url => registration_path("user"), :htmlb => {:autocomplete =>"off"}) do |f| %>
<ul>
<li>
<%= devise_error_messages! %>
</li>
<li>
<%= f.email_field :email, placeholder: (t('helpers.email') + ' *'), :required => true, :as => :email, :class => 'text_field has-tooltip reg-input', 'data-toggle' => "tooltip", 'data-container' => "body", 'title' => "This must be a valid email address - a message will be sent to it for confirmation." %>
<div class="alert alert-error" style="display:none">
<strong><%= t('helpers.error')%></strong> <%= t('helpers.valid_email')%>
</div>
</li>
<% if extended then %>
<% unless session[:shibboleth_data].nil? %>
<%= f.hidden_field :shibboleth_id, :value => session[:shibboleth_data][:uid] %>
<% end %>
<li>
<%= f.text_field :firstname, placeholder: t('helpers.first_name'), :as => :string, :class => 'text_field' %>
</li>
<li>
<%= f.text_field :surname, placeholder: t('helpers.last_name'), :as => :string, :class => 'text_field' %>
</li>
<% end %>
<li>
<%= collection_select(:user, :organisation_id, Organisation.where("parent_id IS NULL").order("sort_name ASC, name ASC"), :id, :name, {include_blank: t('helpers.org_type.organisation')}, { :class => 'typeahead org_sign_up' }) %>
</li>
<div id="other-org-link"><a href="#"><%= t("helpers.org_not_listed") %></a></div>
<% other_organisations = Array.new %>
<% Organisation.where("parent_id IS ? AND is_other = ?", nil, 1).each do |org| %>
<% other_organisations << org.id %>
<% end %>
<li id="other-organisation-name" style="display:none" data-orgs="<%= other_organisations.join(',') %>">
<%= f.text_field :other_organisation, placeholder: (t('helpers.org_type.org_name') + ' *'), :as => :string , :autocomplete => "off", :class => 'text_field has-tooltip reg-input', 'data-toggle' => "tooltip", 'data-container' => "body", 'title' => "Please enter the name of your organisation." %>
</li>
<li>
<%= f.password_field :password, placeholder: (t('helpers.password') + ' *'), :autocomplete => "off", :required => true, :as => :password, :class => 'text_field has-tooltip reg-input', 'data-toggle' => "tooltip", 'data-container' => "body", 'title' => "This must be at least 8 characters long." %>
<div class="alert alert-error" style="display:none">
<strong><%= t('helpers.error')%></strong> <%= t('helpers.password_too_small')%>
</div>
</li>
<li>
<%= f.password_field :password_confirmation, placeholder: (t('helpers.password_conf') + ' *'), :required => true, :as => :password, :class => 'text_field has-tooltip reg-input', 'data-toggle' => "tooltip", 'data-container' => "body", 'title' => "This must match what you entered in the previous field." %>
<div class="alert alert-error" style="display:none">
<strong><%= t('helpers.error')%></strong> <%= t('helpers.password_no_match')%>
</div>
</li>
<li class="remember_me_li">
<%= f.check_box :accept_terms, :required => true %> <%= f.label :accept_terms, :class => "remember_div" do %>
<%= raw t('helpers.accept_terms_html')%>
<%end%>
</li>
<li>
<%= f.submit t('helpers.sign_up'), :class => "btn btn-primary" %>
</li>
</ul>
<% end %>