<!--Descriptive page name, messages and instructions-->
<h2 class="heading"><%= t(".page_heading") %></h2>
<%= error_messages_for :preference %>

<!--/descriptions-->

<!--subnav-->
<h3 class="landmark heading"><%= t(".navigation.landmark") %></h3>
<ul class="navigation actions" role="navigation">
  <li><%= link_to t(".navigation.edit_my_profile"), edit_user_path(@user) %></li>
  <li><%= link_to t(".navigation.manage_my_pseuds"), user_pseuds_path(@user) %></li>
  <li><%= link_to t(".navigation.blocked_users"), user_blocked_users_path %></li>
  <li><%= link_to t(".navigation.muted_users"), user_muted_users_path %></li>
  <li><%= link_to t(".navigation.change_username"), change_username_user_path(@user) %></li>
  <li><%= link_to t(".navigation.change_password"), change_password_user_path(@user) %></li>
  <li><%= link_to t(".navigation.change_email"), change_email_user_path(@user) %></li>
</ul>
<!--/subnav-->

<!--main content-->
<%= form_for(@preference, url: user_preference_path(@user, @preference), autocomplete: "off") do |f| %>
  <fieldset>
    <legend><%= t(".privacy.legend") %></legend>
    <h4 class="heading"><%= t(".privacy.heading") %> <%= link_to_help "privacy-preferences" %></h4>
    <ul>
      <li>
        <%= f.check_box :minimize_search_engines %>
        <%= f.label :minimize_search_engines, t(".privacy.hide_work_from_search_engines") %>
      </li>
      <li>
        <%= f.check_box :disable_share_links %>
        <%= f.label :disable_share_links, t(".privacy.hide_share_buttons") %>
      </li>
      <li>
        <%= f.check_box :allow_cocreator %>
        <%= f.label :allow_cocreator, t(".privacy.allow_co_creator_invite") %>
      </li>
    </ul>
  </fieldset>
  <fieldset>
    <legend><%= t(".display.legend") %></legend>
    <h4 class="heading"><%= t(".display.heading") %> <%= link_to_help "display-preferences" %></h4>
    <ul>
      <li>
        <%= f.check_box :adult %>
        <%= f.label :adult, t(".display.show_adult_content") %>
      </li>
      <li>
        <%= f.check_box :view_full_works %>
        <%= f.label :view_full_works, t(".display.show_whole_work_default") %>
      </li>
      <li>
        <%= f.check_box :hide_warnings %>
        <%= f.label :hide_warnings, t(".display.hide_warnings") %>
      </li>
      <li>
        <%= f.check_box :hide_freeform %>
        <%= f.label :hide_freeform, t(".display.hide_additional_tags") %>
      </li>
      <li>
        <%= f.check_box :disable_work_skins %>
        <%= f.label :disable_work_skins, t(".display.hide_work_skins") %> <%= link_to_help "skins-basics" %>
      </li>
    </ul>
  </fieldset>
  <fieldset>
    <dl>
      <dt><%= f.label :skin_id, t(".your_site_skin") %> <%= link_to_help "skins-basics" %></dt>
      <dd>
        <span class="actions"><%= link_to t(".public_site_skins"), skins_path %></span>
        <%= f.select :skin_id, (@available_skins.collect { |s| [s.title, s.id] }) %>
      </dd>
      <dt><%= f.label :time_zone, t(".your_time_zone") %></dt>
      <dd><%= f.time_zone_select :time_zone, nil, default: Time.zone.name %></dd>
      <% if $rollout.active?(:set_locale_preference, @user) %>
        <dt><%= f.label :preferred_locale, t(".your_locale") %> <%= link_to_help "locale-preferences" %></dt>
        <dd><%= f.select :preferred_locale, locale_options_for_select(@available_locales, "id"),
                  default: @preference.preferred_locale %></dd>
      <% end %>
      <dt><%= f.label :work_title_format, t(".browser_page_title_format") %> <%= link_to_help "work_title_format" %></dt>
      <dd><%= f.text_field :work_title_format %></dd>
    </dl>
  </fieldset>
  <fieldset>
   <legend><%= t(".comments.legend") %></legend>
    <h4 class="heading"><%= t(".comments.heading") %> <%= link_to_help "comment-preferences" %></h4>
    <ul>
      <li>
        <%= f.check_box :comment_emails_off %>
        <%= f.label :comment_emails_off, t(".comments.turn_off_emails") %>
      </li>
      <li>
        <%= f.check_box :comment_inbox_off %>
        <%= f.label :comment_inbox_off, t(".comments.turn_off_inbox") %>
      </li>
      <li>
        <%= f.check_box :comment_copy_to_self_off %>
        <%= f.label :comment_copy_to_self_off, t(".comments.turn_off_copies_own_comments") %>
      </li>
      <li>
        <%= f.check_box :kudos_emails_off %>
        <%= f.label :kudos_emails_off, t(".comments.turn_off_kudos_emails") %>
      </li>
      <li>
        <%= f.check_box :guest_replies_off %>
        <%= f.label :guest_replies_off, t(".comments.guest_replies_off") %>
      </li>
    </ul>
  </fieldset>
  <fieldset>
    <legend><%= t(".collections_challenges_gifts.legend") %></legend>
    <h4 class="heading"><%= t(".collections_challenges_gifts.heading") %> <%= link_to_help "collection-preferences" %></h4>
    <ul>
      <li>
        <%= f.check_box :allow_collection_invitation %>
        <%= f.label :allow_collection_invitation, t(".collections_challenges_gifts.allow_collection_invitation") %>
      </li>
      <li>
        <%= f.check_box :allow_gifts %>
        <%= f.label :allow_gifts, t(".collections_challenges_gifts.allow_gifts") %>
      </li>
      <li>
        <%= f.check_box :collection_emails_off %>
        <%= f.label :collection_emails_off, t(".collections_challenges_gifts.turn_off_collection_emails") %>
      </li>
      <li>
        <%= f.check_box :collection_inbox_off %>
        <%= f.label :collection_inbox_off, t(".collections_challenges_gifts.turn_off_collection_inbox") %>
      </li>
      <li>
        <%= f.check_box :recipient_emails_off %>
        <%= f.label :recipient_emails_off, t(".collections_challenges_gifts.turn_off_gift_emails") %>
      </li>
    </ul>
  </fieldset>
  <fieldset>
    <legend><%= t(".misc.legend") %></legend>
    <h4 class="heading"><%= t(".misc.heading") %> <%= link_to_help "misc-preferences" %></h4>
    <ul>
      <li>
        <%= f.check_box :history_enabled %>
        <%= f.label :history_enabled, t(".misc.turn_on_history") %>
      </li>
      <li>
        <%= f.check_box :first_login %>
        <%= f.label :first_login, t(".misc.turn_on_new_user_help") %>
      </li>
      <li>
        <%= f.check_box :banner_seen %>
        <%= f.label :banner_seen, t(".misc.turn_off_banner_every_page") %>
      </li>
    </ul>
  </fieldset>
  <%= submit_fieldset(f) %>
<% end %>
<!--/content-->
