<div class="container">
  <div class="row justify-content-lg-center">
    <div class="col-lg-9">
      <h1>Please complete your editor information</h1>

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

        <%= form_for(@editor ||= Editor.new, url: add_editor_onboardings_path, method: :post) do |f| %>
        <div class="form-group">
          <% if @editor.errors.any? %>
            <div id="error_explanation">
              <h2><%= pluralize(@editor.errors.count, "error") %> prohibited this editor from being saved:</h2>

              <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 :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 :email %>
              <%= f.email_field :email, class: "form-control" %>
            </div>

            <div class="col">
              <%= f.label :login, "GitHub username" %>
              <%= f.text_field :login, placeholder: "@username", 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 :category_list, "Categories <small>(comma and space separated: item1, item2, item3)</small>".html_safe %>
              <%= f.text_field :category_list, 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)  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 :description %>
          <%= f.text_area :description, rows: 4, class: "form-control" %>
        </div>

        <div class="form-actions">
          <%= hidden_field_tag "token", @onboarding.token %>
          <%= f.submit "Save editor data", class: "btn action-btn" %>
        </div>
        <% end %>
      </div>

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