<%= 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: (_('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><%= _('Error!')%></strong> <%= _('You must enter a valid email address.')%>
</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: _('First name'), :as => :string, :class => 'text_field' %>
</li>
<li>
<%= f.text_field :surname, placeholder: _('Last name'), :as => :string, :class => 'text_field' %>
</li>
<% end %>
<% if resource.user_identifiers.count > 0 %>
<% scheme = resource.user_identifiers.identifier_scheme.name %>
<%= f.hidden_field "user_identifiers[#{scheme}]", value: resource.user_identifiers.first.identifier%>
<% end %>
<li>
<%= collection_select(:user, :org_id, Org.where("parent_id IS NULL").order("sort_name ASC, name ASC"), :id, :name, {include_blank: _('Organisation')}, { :class => 'typeahead org_sign_up' }) %>
</li>
<div id="other-org-link"><a href="#"><%= _("My organisation isn't listed.") %></a></div>
<% other_organisations = Array.new %>
<% Org.where("parent_id IS ? AND is_other = ?", nil, true).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: ( _('Organisation 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: (_('Password') + ' *'), :autocomplete => "off", :required => true, :as => :password, :class => 'text_field has-tooltip reg-input', 'data-toggle' => "tooltip", 'data-container' => "body", 'title' => _('Your password must contain at least 8 characters.') %>
<div class="alert alert-error" style="display:none">
<strong><%= _('Error!')%></strong> <%= _('Your password must contain at least 8 characters.')%>
</div>
</li>
<li>
<%= f.password_field :password_confirmation, placeholder: (_('Password confirmation') + ' *'), :required => true, :as => :password, :class => 'text_field has-tooltip reg-input', 'data-toggle' => "tooltip", 'data-container' => "body", 'title' => _('Your password must contain at least 8 characters.') %>
<div class="alert alert-error" style="display:none">
<strong><%= _('Error!')%></strong> <%= _('This must match what you entered in the previous field.')%>
</div>
</li>
<li class="remember_me_li">
<%= f.check_box :accept_terms, :required => true %> <%= f.label :accept_terms, :class => "remember_div" do %>
<%= raw _(' I accept the <a href="/%{current_locale}/terms" target="_blank">terms and conditions</a> *') % { :current_locale => FastGettext.locale } %>
<%end%>
</li>
<li>
<%= f.submit _('Sign up'), :class => "btn btn-primary" %>
</li>
</ul>
<% end %>