From 48c1c8efc7ef687c2beb642f0c397d5f7ad1b00e Mon Sep 17 00:00:00 2001 From: Miguel Michelson Date: Sat, 13 Jul 2024 20:44:44 -0400 Subject: [PATCH] routes admin --- .../controllers/backstage/dashboard_controller.rb | 1 - backstage/app/views/backstage/shared/_actions.erb | 6 +++--- .../app/views/backstage/shared/_main_header.erb | 15 ++++++++------- backstage/config/routes.rb | 2 +- backstage/lib/backstage/config.rb | 2 +- config/initializers/backstage_config.rb | 3 +++ 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/backstage/app/controllers/backstage/dashboard_controller.rb b/backstage/app/controllers/backstage/dashboard_controller.rb index 294fa84..2c52e04 100644 --- a/backstage/app/controllers/backstage/dashboard_controller.rb +++ b/backstage/app/controllers/backstage/dashboard_controller.rb @@ -3,7 +3,6 @@ class Backstage::DashboardController < Backstage::BaseController before_action :authenticate_admin - def index readme_path = Backstage::Engine.root.join('README.md') @readme_content = File.exist?(readme_path) ? File.read(readme_path) : "Welcome to the Admin Panel" diff --git a/backstage/app/views/backstage/shared/_actions.erb b/backstage/app/views/backstage/shared/_actions.erb index 2624ae4..d0365be 100644 --- a/backstage/app/views/backstage/shared/_actions.erb +++ b/backstage/app/views/backstage/shared/_actions.erb @@ -1,10 +1,10 @@ <% resource.actions.each do |action| %> <% case action[:name] %> <% when :view %> - <%= link_to 'View', backstage.url_for(item), class: "text-blue-600 hover:text-blue-900 mr-2" %> + <%= link_to 'View', polymorphic_path([item]), class: "text-blue-600 hover:text-blue-900 mr-2" %> <% when :edit %> - <%= link_to 'Edit', "backstage.url_for(item, action: :edit)", class: "text-green-600 hover:text-green-900 mr-2" %> + <%= link_to 'Edit', edit_polymorphic_path([item]), class: "text-green-600 hover:text-green-900 mr-2" %> <% when :delete %> - <%= link_to 'Delete', backstage.url_for(item), data: {turbo_method: :delete, turbo_confirm: 'Are you sure?' }, class: "text-red-600 hover:text-red-900" %> + <%= link_to 'Delete', polymorphic_path([item]), data: {turbo_method: :delete, turbo_confirm: 'Are you sure?' }, class: "text-red-600 hover:text-red-900" %> <% end %> <% end %> \ No newline at end of file diff --git a/backstage/app/views/backstage/shared/_main_header.erb b/backstage/app/views/backstage/shared/_main_header.erb index ecae34f..73cd10d 100644 --- a/backstage/app/views/backstage/shared/_main_header.erb +++ b/backstage/app/views/backstage/shared/_main_header.erb @@ -39,22 +39,22 @@
- + <%= link_to "https://github.com/rauversion/backstage", class: "flex w-full items-center gap-3 rounded-lg px-2 py-2.5 text-left text-base/6 font-medium text-zinc-950 sm:py-2 sm:text-sm/5 data-[slot=icon]:*:size-6 data-[slot=icon]:*:shrink-0 data-[slot=icon]:*:fill-zinc-500 sm:data-[slot=icon]:*:size-5 data-[slot=icon]:last:*:ml-auto data-[slot=icon]:last:*:size-5 sm:data-[slot=icon]:last:*:size-4 data-[slot=avatar]:*:-m-0.5 data-[slot=avatar]:*:size-7 data-[slot=avatar]:*:[--ring-opacity:10%] sm:data-[slot=avatar]:*:size-6 data-[hover]:bg-zinc-950/5 data-[slot=icon]:*:data-[hover]:fill-zinc-950 data-[active]:bg-zinc-950/5 data-[slot=icon]:*:data-[active]:fill-zinc-950 data-[slot=icon]:*:data-[current]:fill-zinc-950 dark:text-white dark:data-[slot=icon]:*:fill-zinc-400 dark:data-[hover]:bg-white/5 dark:data-[slot=icon]:*:data-[hover]:fill-white dark:data-[active]:bg-white/5 dark:data-[slot=icon]:*:data-[active]:fill-white dark:data-[slot=icon]:*:data-[current]:fill-white" do %> Support - + <% end %> - + <%= link_to "https://github.com/rauversion/backstage", class: "flex w-full items-center gap-3 rounded-lg px-2 py-2.5 text-left text-base/6 font-medium text-zinc-950 sm:py-2 sm:text-sm/5 data-[slot=icon]:*:size-6 data-[slot=icon]:*:shrink-0 data-[slot=icon]:*:fill-zinc-500 sm:data-[slot=icon]:*:size-5 data-[slot=icon]:last:*:ml-auto data-[slot=icon]:last:*:size-5 sm:data-[slot=icon]:last:*:size-4 data-[slot=avatar]:*:-m-0.5 data-[slot=avatar]:*:size-7 data-[slot=avatar]:*:[--ring-opacity:10%] sm:data-[slot=avatar]:*:size-6 data-[hover]:bg-zinc-950/5 data-[slot=icon]:*:data-[hover]:fill-zinc-950 data-[active]:bg-zinc-950/5 data-[slot=icon]:*:data-[active]:fill-zinc-950 data-[slot=icon]:*:data-[current]:fill-zinc-950 dark:text-white dark:data-[slot=icon]:*:fill-zinc-400 dark:data-[hover]:bg-white/5 dark:data-[slot=icon]:*:data-[hover]:fill-white dark:data-[active]:bg-white/5 dark:data-[slot=icon]:*:data-[active]:fill-white dark:data-[slot=icon]:*:data-[current]:fill-white" do %> Changelog - + <% end %>
@@ -63,15 +63,16 @@
-