app/views/trestle/resource/edit.html.erb in trestle-0.8.5 vs app/views/trestle/resource/edit.html.erb in trestle-0.8.6
- old
+ new
@@ -2,17 +2,17 @@
<% content_for(:title, title) %>
<% breadcrumb title %>
<% content_for(:primary_toolbar) do %>
- <%= button_tag t("admin.buttons.save", default: "Save %{model_name}", model_name: admin.model_name), class: "btn btn-success btn-lg" unless admin.readonly? %>
+ <%= button_tag t("admin.buttons.save", default: "Save %{model_name}", model_name: admin.model_name), class: "btn btn-success btn-lg" if admin.actions.include?(:update) %>
<% end %>
<% content_for(:secondary_toolbar) do %>
- <%= link_to admin.path(:destroy, id: admin.to_param(instance)), method: :delete, class: "btn btn-danger", data: { toggle: "confirm-delete", placement: "bottom" } do %>
+ <%= admin_link_to instance, action: :destroy, method: :delete, class: "btn btn-danger", data: { toggle: "confirm-delete", placement: "bottom" } do %>
<%= icon("fa fa-trash") %> <%= t("admin.buttons.delete", default: "Delete %{model_name}", model_name: admin.model_name) %>
- <% end unless admin.readonly? %>
+ <% end if admin.actions.include?(:destroy) %>
<% end %>
-<%= trestle_form_for instance, url: admin.readonly? ? "#" : admin.path(:update, id: admin.to_param(instance)), method: :patch do |f| %>
- <%= render partial: "form", layout: "layout" %>
+<%= trestle_form_for instance, url: admin.actions.include?(:update) ? admin.path(:update, id: admin.to_param(instance)) : "#", method: :patch do |f| %>
+ <%= render partial: "form", layout: dialog_request? ? "dialog" : "layout" %>
<% end %>