diff --git a/app/views/trestle/resource/edit.html.erb b/app/views/trestle/resource/edit.html.erb index 2f9905c8..b18f3c11 100644 --- a/app/views/trestle/resource/edit.html.erb +++ b/app/views/trestle/resource/edit.html.erb @@ -5,10 +5,12 @@ <% toolbar(:primary) do |t| %> <%= t.save_or_dismiss(:update) %> + <%= hook("edit.toolbar.primary", t) %> <% end %> <% toolbar(:secondary) do |t| %> <%= t.delete %> + <%= hook("edit.toolbar.secondary", t) %> <% end %> <%= resource_turbo_frame(instance) do %> diff --git a/app/views/trestle/resource/index.html.erb b/app/views/trestle/resource/index.html.erb index d25d6e72..72a436b6 100644 --- a/app/views/trestle/resource/index.html.erb +++ b/app/views/trestle/resource/index.html.erb @@ -2,6 +2,11 @@ <% toolbar(:primary) do |t| %> <%= t.new %> + <%= hook("index.toolbar.primary", t) %> +<% end %> + +<% toolbar(:secondary) do |t| %> + <%= hook("index.toolbar.secondary", t) %> <% end %> <% content_for(:utilities) do %> diff --git a/app/views/trestle/resource/new.html.erb b/app/views/trestle/resource/new.html.erb index eb547e60..37051538 100644 --- a/app/views/trestle/resource/new.html.erb +++ b/app/views/trestle/resource/new.html.erb @@ -5,6 +5,11 @@ <% toolbar(:primary) do |t| %> <%= t.save_or_dismiss(:create) %> + <%= hook("new.toolbar.primary", t) %> +<% end %> + +<% toolbar(:secondary) do |t| %> + <%= hook("new.toolbar.secondary", t) %> <% end %> <%= resource_turbo_frame(instance) do %> diff --git a/app/views/trestle/resource/show.html.erb b/app/views/trestle/resource/show.html.erb index ac6bae9d..e4fc051f 100644 --- a/app/views/trestle/resource/show.html.erb +++ b/app/views/trestle/resource/show.html.erb @@ -5,10 +5,12 @@ <% toolbar(:primary) do |t| %> <%= t.save_or_dismiss(:update) %> + <%= hook("show.toolbar.primary", t) %> <% end %> <% toolbar(:secondary) do |t| %> <%= t.delete %> + <%= hook("show.toolbar.secondary", t) %> <% end %> <%= resource_turbo_frame(instance) do %> diff --git a/sandbox/app/admin/articles_admin.rb b/sandbox/app/admin/articles_admin.rb index a5e4c135..98a40218 100644 --- a/sandbox/app/admin/articles_admin.rb +++ b/sandbox/app/admin/articles_admin.rb @@ -12,6 +12,15 @@ scope :active end + hook "index.toolbar.secondary" do |t| + t.link "Batch Action (GET)", action: :batch_get, style: :info, data: { controller: "batch-action" } + t.link "Batch Action (POST)", action: :batch_post, style: :warning, data: { controller: "confirm batch-action", turbo_method: :post } + end + + hook "new.toolbar.secondary" do |t| + t.link "Cancel", action: :index + end + table do selectable_column column :title, link: true, truncate: false diff --git a/sandbox/app/views/admin/articles/index.html.erb b/sandbox/app/views/admin/articles/index.html.erb deleted file mode 100644 index 00f66ad9..00000000 --- a/sandbox/app/views/admin/articles/index.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -<% content_for(:title, admin.t("titles.index", default: "Listing %{pluralized_model_name}")) %> - -<% toolbar(:primary) do |t| %> - <%= t.new %> -<% end %> - -<% toolbar(:secondary) do |t| %> - <%= t.link "Batch Action (GET)", action: :batch_get, style: :info, data: { controller: "batch-action" } %> - <%= t.link "Batch Action (POST)", action: :batch_post, style: :warning, data: { controller: "confirm batch-action", turbo_method: :post } %> -<% end %> - -<% content_for(:utilities) do %> - <%= render "scopes" %> -<% end if admin.scopes.any? %> - -<%= render layout: "layout" do %> - <%= index_turbo_frame do %> - <% if hook?("resource.index.header") %> -
- <%= hook("resource.index.header") %> -
- <% end %> - - <%= render "trestle/table/table", table: admin.table, collection: collection %> - - - <% end %> -<% end %>