<%= simple_form_for [current_project, @node, @evidence],
  html: {
    data: {
      behavior: 'local-auto-save',
      auto_save_key: @auto_save_key
    }
  } do |f| %>

  <%= f.error_notification %>

  <div class="form-inputs">
    <%= f.association :issue, collection: current_project.issues.sort, label_method: :title, include_blank: 'Auto-generate a new issue' %>

    <%= label_tag :evidence_content, 'Evidence content', class: 'visually-hidden' %>
    <%=
      f.input :content,
      label: false,
      input_html: {
        class: 'textile',
        data: {
          allow_dropdown: @evidence.new_record?,
          behavior: 'auto-save rich-toolbar drop-zone',
          paths: editor_paths,
          'rich-toolbar': 'defaults field image',
          'rich-toolbar-uploader': '[data-behavior~=jquery-upload]',
        },
        rows: 20
      }
    %>
  </div>

  <% if @evidence.persisted? %>
    <%= hidden_field :evidence, :original_updated_at, value: @evidence.updated_at.to_i %>
  <% end %>

  <div class="form-actions sticky">
    <%= hidden_field_tag :return_to, :issue if params[:return_to] == 'issue' %>
    <%= f.button :submit, nil, class: 'btn btn-primary' %> or
    <%=
      link_to 'Cancel',
      evidence_redirect_path(params[:return_to]),
      data: {
        behavior: 'clear-local-auto-save'
      }
    %>
  </div>
<% end %>
