railsadminteam/rails_admin

View on GitHub
app/views/rails_admin/main/_submit_buttons.html.erb

Summary

Maintainability
Test Coverage
<div class="form-actions row justify-content-end my-3">
  <div class="col-sm-10">
    <input name="return_to" type="<%= :hidden %>" value="<%= (params[:return_to].presence || request.referer) %>" />
    <button class="btn btn-primary" data-disable-with="<%= t("admin.form.save") %>" name="_save" type="submit"<%= ' disabled' unless @action.enabled? %>>
      <i class="fas fa-check"></i>
      <%= t("admin.form.save") %>
    </button>
    <span class="extra_buttons">
      <% if @action.enabled? && authorized?(:new, @abstract_model) %>
        <button class="btn btn-info" data-disable-with="<%= t("admin.form.save_and_add_another") %>" name="_add_another" type="submit">
          <%= t("admin.form.save_and_add_another") %>
        </button>
      <% end %>
      <% if @action.enabled? && authorized?(:edit, @abstract_model) %>
        <button class="btn btn-info" data-disable-with="<%= t("admin.form.save_and_edit") %>" name="_add_edit" type="submit"<%= ' disabled' unless @action.enabled? %>>
          <%= t("admin.form.save_and_edit") %>
        </button>
      <% end %>
      <button class="btn btn-light" data-disable-with="<%= t("admin.form.cancel") %>" formnovalidate="<%= true %>" name="_continue" type="submit">
        <i class="fas fa-times"></i>
        <%= t("admin.form.cancel") %>
      </button>
    </span>
  </div>
</div>