<%= simple_form_for [collections, @form] do |f| %>

  <% if f.error_notification %>
    <div class="alert alert-danger fade in">
      <strong>Wait don't go!</strong> There was a problem with your submission. Please review the errors below:
      <a class="close" data-dismiss="alert" href="#">&times;</a>
    </div>
  <% end %>

  <%= render 'form_descriptive_fields', f: f %>
  <%= render 'form_permission', f: f %>
  <%= render "curation_concerns/base/form_media", f: f %>

  <div class="row">
    <div class="col-md-12 form-actions">
      <%= f.submit class: 'btn btn-primary require-contributor-agreement' %>
      <% if %w(new create).include?(action_name) %>
        <%= link_to 'Cancel', main_app.root_path, class: 'btn btn-link' %>
      <% else %>
        <%= link_to 'Cancel', collections.collection_path(@form), class: 'btn btn-link' %>
      <% end %>
    </div>
  </div>

<% end %>

<%= simple_form_for [collections, @form] do |f| %>

  <% if f.error_notification %>
    <div class="alert alert-danger fade in">
      <strong>Wait don't go!</strong> There was a problem with your submission. Please review the errors below:
      <a class="close" data-dismiss="alert" href="#">&times;</a>
    </div>
  <% end %>

  <%= render 'form_descriptive_fields', f: f %>
  <%= render 'form_permission', f: f %>
  <%= render "curation_concerns/base/form_media", f: f %>

  <div class="row">
    <div class="col-md-12 form-actions">
      <%= f.submit class: 'btn btn-primary require-contributor-agreement' %>
      <% if @form.persisted? %>
        <%= link_to 'Cancel', collections.collection_path(@form), class: 'btn btn-link' %>
      <% else %>
        <%= link_to 'Cancel', main_app.root_path, class: 'btn btn-link' %>
      <% end %>
    </div>
  </div>

<% end %>

Set the cancel link based on the persisted state
Set the cancel link based on the persisted state
