<div class="container">
  <div class="row justify-content-lg-center">
    <div class="col-lg-9">
      <h1>Editor profile</h1>

      <%= render partial: "home/profiles_menu" %>

      <div class="generic-content-item">

        <%= link_to "View papers you have edited &rarr;".html_safe, papers_by_editor_url(@editor.login)%>

        <%= form_for(@editor, url: update_editor_profile_path) do |f| %>

        <div class="form-group">
          <% if @editor.errors.any? %>
            <div class="alert alert-danger %>">
              <p><strong>Your profile could not be saved.</strong></p>
              <ul>
              <% @editor.errors.each do |error| -%>
                <li><%= error.attribute.to_s.humanize %>: <%= error.message %></li>
              <% end -%>
              </ul>
            </div>
          <% end %>
        </div>

        <div class="form-group">
          <div class="row">
            <div class="col">
              <%= f.label :max_assignments, "Max number of assignments" %>
              <%= f.text_field :max_assignments, class: "form-control" %>
            </div>
            <div class="col">
              <%= f.label :availability_comment, "Comment on availability" %>
              <%= f.text_field :availability_comment, class: "form-control" %>
            </div>
          </div>
        </div>

        <div class="form-group">
          <div class="row">
            <div class="col">
              <%= f.label :first_name %>
              <%= f.text_field :first_name, class: "form-control" %>
            </div>

            <div class="col">
              <%= f.label :last_name %>
              <%= f.text_field :last_name, class: "form-control" %>
            </div>
          </div>
        </div>

        <div class="form-group">
          <div class="row">
            <div class="col">
              <%= f.label :avatar_url %>
              <%= f.text_field :avatar_url, class: "form-control" %>
            </div>

            <div class="col">
              <%= f.label :category_list, "Categories (comma or space separated)" %>
              <%= f.text_field :category_list, class: "form-control" %>
            </div>
          </div>
        </div>

        <div class="form-group">
          <div class="row">
            <div class="col">
              <%= f.label :url %>
              <%= f.text_field :url, class: "form-control" %>
            </div>
            <div class="col">
              <%= f.label :email %>
              <%= f.text_field :email, class: "form-control" %>
            </div>
          </div>
        </div>

        <% if JournalFeatures.tracks? %>
        <div class="form-group">
          <%= f.label :tracks %>
          <div class="row">
            <div class="col">
              <%= f.collection_check_boxes(:track_ids, Track.all, :id, :name_with_short_name)  do |b|
                    b.label(class: "label-container-check-box") { b.check_box(class: "form-check-inline") + "#{b.text}" }
                  end %>
            </div>
          </div>
        </div>
        <% end %>

        <div class="form-group">
          <%= f.label :affiliation, "Affiliation (institution, city, country — displayed publicly on the about page)" %>
          <%= f.text_field :affiliation, placeholder: "e.g., University of Cambridge, Cambridge, UK", class: "form-control" %>
        </div>

        <div class="form-group">
          <%= f.label :description %>
          <%= f.text_area :description, rows: 4, class: "form-control" %>
        </div>

        <div class="form-actions">
          <%= f.submit "Update editor profile", class: "btn action-btn" %>
        </div>
        <% end %>
      </div>

    </div>
  </div>
</div>