<!--Descriptive page name, messages and instructions-->
<h2 class="heading"><%= ts("Edit Multiple Works") %></h2>
<!--/descriptions-->

<!--subnav-->
<%= render "users/header_navigation" %>
<!--/subnav-->

<!--main content-->
<p class="caution notice">
  <%= ts("Your edits will be applied to") %> <strong><%= ts("all") %></strong> <%= ts("of the following works:") %>
</p>

<%= render "works/work_abbreviated_list", works: @works %>

<%= form_for :work, url: update_multiple_user_works_path(@user), method: :patch, html: { class: "verbose post" } do |form| %>
  <p class="required notice">
    <%= ts("* Required information") %>
    <% @works.each do |work| %>
      <%= hidden_field_tag "work_ids[]", work.id %>
    <% end %>
  </p>

  <%= render "work_form_tags", include_blank: true %>
  <fieldset class="preface" role="article">
    <legend><%= t("works.preface.title") %></legend>
    <h3 class="landmark heading"><%= t("works.preface.title") %></h3>
    <dl>
      <%= render "works/work_form_pseuds", form: form, works: @works %>
    </dl>
  </fieldset>

  <fieldset id="associations" role="article">
    <legend><%= t("works.associations.title") %></legend>
    <h3 class="landmark heading"><%= t("works.associations.title") %></h3>
    <dl>
      <%= render "collectibles/collectible_form", form: form, collectibles: @works %>
      <dt><%= form.label :language_id, t("works.associations.language.choose") %> <%= link_to_help "languages-help" %></dt>
      <dd>
        <%= form.select :language_id, language_options_for_select(sorted_languages, "id"), { include_blank: true } %>
      </dd>

      <dt><%= form.label :work_skin_id, t("works.skin.select") %> <%= link_to_help "work-skins" %></dt>
      <dd>
        <%= form.collection_select :work_skin_id, WorkSkin.approved_or_owned_by(current_user).order(:title), :id, :title,
              { include_blank: true } %>
      </dd>
    </dl>
  </fieldset>

  <fieldset class="privacy" role="article">
    <legend><%= t("works.permissions.privacy") %></legend>
    <h3 class="landmark heading"><%= t("works.permissions.privacy") %></h3>
    <dl>

      <dt><%= t("works.permissions.visibility.label") %> <%= link_to_help "registered-users" %></dt>
      <dd>
        <fieldset>
        <%= radio_button_list(form, :restricted, [
              ["", t("works.permissions.visibility.keep_current")],
              ["1", t("works.permissions.visibility.multiple_works_restricted")],
              ["0", t("works.permissions.visibility.unrestricted")]
            ])
          %>
        </fieldset>
      </dd>

      <dt><%= t("comments.commentable.permissions.moderated_commenting.label") %><%= link_to_help "comments-moderated" %></dt>
      <dd>
        <fieldset>
        <%= radio_button_list(form, :moderated_commenting_enabled, [
              ["", t("comments.commentable.permissions.moderated_commenting.keep_current")],
              ["1", t("comments.commentable.permissions.moderated_commenting.enable")],
              ["0", t("comments.commentable.permissions.moderated_commenting.disable")]
            ])
          %>
        </fieldset>
      </dd>

      <dt>
        <%= t("comments.commentable.permissions.options.multiple_works_label") %>
        <%= link_to_help "who-can-comment-on-this-work" %>
      </dt>
      <dd>
        <fieldset>
          <%= radio_button_list(form, :comment_permissions, [
                ["", t("comments.commentable.permissions.options.keep_current")],
                [:enable_all, t("comments.commentable.permissions.options.enable_all")],
                [:disable_anon, t("comments.commentable.permissions.options.disable_anon")],
                [:disable_all, t("comments.commentable.permissions.options.disable_all")]
              ]) %>
        </fieldset>
      </dd>
    </dl>
  </fieldset>

  <p class="caution notice">
    <%= ts("Your edits will") %> <strong><%= ts("replace") %></strong> <%= ts("the existing values!
    (If you leave a field blank it will remain unchanged.)") %>
  </p>

  <p class="submit actions"><%= submit_tag ts("Update All Works"), data: { confirm: ts("Are you sure? Remember this will replace all existing values!") } %></p>

<% end %>
<!--/content-->
