<h2><%=l(:label_my_account)%></h2>
<%= error_messages_for 'user' %>
<%= labelled_form_for @user, :url => { :action => 'account' }, :html => {:multipart => true, :id => 'my_account_form', :class => 'form-box'}, :method => :post do |f| %>
  <%= hidden_field_tag 'back_url', params[:back_url] || url_for(params) %>
  <div class="splitcontent">
    <div class="splitcontentleft">
      <h3><%=l(:label_information_plural)%></h3>
      <div class="box tabular">
        <div class="splitcontent">
          <div class="splitcontentleft">
            <p><%= f.text_field :firstname, :required => true %></p>
          </div>
          <div class="splitcontentright">
            <p><%= f.text_field :lastname, :required => true %></p>
          </div>
        </div>
        <p><%= f.text_field :mail, :required => true %> <%= additional_emails_link(@user) %></p>
        <% unless @user.force_default_language? %>
          <p><%= f.select :language, lang_options_for_select %></p>
        <% end %>
        <% if Setting.openid? %>
          <p><%= f.text_field :identity_url  %></p>
        <% end %>

        <% @user.visible_custom_field_values.select(&:editable?).each do |value| %>
          <p><%= custom_field_tag_with_label :user, value %></p>
        <% end %>
        <%= call_hook(:view_my_account, :user => @user, :form => f) %>
      </div>
      <div class="contextual-my-acc">
        <%= call_hook(:view_my_account_contextual, :user => @user)%>
      </div>
    </div>
    <div class="splitcontentright">
      <h3><%=l(:field_mail_notification)%></h3>
      <div class="box">
        <%= render :partial => 'users/mail_notifications' %>
      </div>
      <h3><%=l(:label_preferences)%></h3>
      <div class="box tabular">
        <%= render :partial => 'users/preferences' %>
        <%= call_hook(:view_users_form_preferences, :user => @user, :form => f) %>
        <%= call_hook(:view_my_account_preferences, :user => @user, :form => f) %>
      </div>
    </div>
  </div>
  <div class="form-actions">
    <p class="mobile-hide"><%= submit_tag l(:button_save), :class => 'button-positive' %></p>
    <%= tag( :input, :type => 'button', :value => l(:button_change_password), :onclick => "window.location.href='#{url_for({ :action => 'password' })}'", :class => 'button') if @user.change_password_allowed? %>
    <% if @user.own_account_deletable? %>
      <%= link_to(l(:button_delete_my_account), {:action => 'destroy'}, :class => 'icon icon-del') %>
    <% end %>
  </div>
<% end %>

<% html_title(l(:label_my_account)) -%>
