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

  <%= f.error_notification %>

  <%= label_tag :issue_text, 'Issue source input', class: 'visually-hidden' %>
  <%=
    f.input :text,
      label: false,
      input_html: {
        class: 'textile',
        data: {
          allow_dropdown: @issue.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
      }
  %>

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

  <% if controller.class.name.deconstantize == 'QA' %>
    <%= hidden_field nil, :return_to, value: :qa %>
  <% end %>

  <%= render 'issues/tag_input', f: f %>

  <div class="form-actions sticky">
    <%= render partial: 'qa/state_button', locals: { f: f, record: @issue } %>
  </div>
  or
  <%=
    link_to 'Cancel',
    @form_cancel_path,
    class: 'cancel-link',
    data: {
      behavior: 'clear-local-auto-save'
    }
    %>
</div>
<% end %>
