<% content_for :head do %>
  <%= javascript_include_tag "user" %>
<% end %>

<% content_for :heading do %>
  <h1><%= t ".my settings" %></h1>
<% end %>

<%= render :partial => "settings_menu", :locals => { :selected => "account" } %>

<%= bootstrap_form_for current_user, :url => { :action => :account }, :method => :post, :html => { :multipart => true, :id => "accountForm", :autocomplete => :off } do |f| %>

  <%= f.text_field :display_name %>
  <%= f.email_field :email, :disabled => true, :label => t(".current email address") %>
  <%= f.email_field :new_email, :autocomplete => "email" %>
  <%= f.password_field :pass_crypt, :value => "", :autocomplete => "new-password" %>
  <%= f.password_field :pass_crypt_confirmation, :value => "", :autocomplete => "new-password" %>

  <fieldset class="form-group">
    <label for="user_auth_provider"><%= t(".external auth") %></label>
    <div class="form-row">
      <%= f.select(:auth_provider, Auth.providers, :hide_label => true, :wrapper => { :class => "col-auto mb-0" }) %>
      <%= f.text_field(:auth_uid, :hide_label => true, :wrapper => { :class => "col mb-0" }) %>
    </div>
    <small class="form-text text-muted">(<a href="<%= t ".openid.link" %>" target="_new"><%= t ".openid.link text" %></a>)</small>
  </fieldset>

  <div class="form-group">
    <label><%= t ".public editing.heading" %></label>
    <span class="form-text text-muted">
      <% if current_user.data_public? %>
        <%= t ".public editing.enabled" %>
        (<a href="<%= t ".public editing.enabled link" %>" target="_new"><%= t ".public editing.enabled link text" %></a>)
      <% else %>
        <%= t ".public editing.disabled" %>
        (<a href="#public"><%= t ".public editing.disabled link text" %></a>)
      <% end %>
    </span>
  </div>

  <div class="form-group">
    <label><%= t ".contributor terms.heading" %></label>
    <span class="form-text text-muted">
      <% if current_user.terms_agreed? %>
        <%= t ".contributor terms.agreed" %>
        (<a href="<%= t ".contributor terms.link" %>" target="_new"><%= t ".contributor terms.link text" %></a>)
        <% if current_user.consider_pd? %>
          <%= t ".contributor terms.agreed_with_pd" %>
        <% end %>
      <% else %>
        <%= t ".contributor terms.not yet agreed" %>
        <%= link_to t(".contributor terms.review link text"), :controller => "users", :action => "terms" %>
      <% end %>
    </span>
  </div>

  <%= f.primary t(".save changes button") %>
<% end %>

<% unless current_user.data_public? %>
<a name="public"></a>
<h2><%= t ".public editing note.heading" %></h2>
<%= t ".public editing note.html" %>
  <%= button_to t(".make edits public button"), :action => :go_public %>
<% end %>
