From 5a8f44960c28e94e7d01e92933abb7586e076553 Mon Sep 17 00:00:00 2001 From: Paul Bob <69730720+Paul-Bob@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:17:07 +0200 Subject: [PATCH] fix: standalone action disabled and enabled classes (#3520) * WIP fix: standalone actions disabled and enabled classes * reminder * wip --- app/components/avo/button_component.rb | 2 +- app/components/avo/resource_component.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/components/avo/button_component.rb b/app/components/avo/button_component.rb index dad700472..3c913313f 100644 --- a/app/components/avo/button_component.rb +++ b/app/components/avo/button_component.rb @@ -29,7 +29,7 @@ def args end def button_classes - classes = "button-component inline-flex flex-grow-0 items-center font-semibold leading-6 fill-current whitespace-nowrap transition duration-100 transform transition duration-100 cursor-pointer disabled:cursor-not-allowed disabled:opacity-70 justify-center #{@class}" + classes = "button-component inline-flex flex-grow-0 items-center font-semibold leading-6 fill-current whitespace-nowrap transition duration-100 transform transition duration-100 cursor-pointer disabled:cursor-not-allowed disabled:opacity-60 data-[disabled='true']:opacity-60 justify-center #{@class}" # For non-icon-styled buttons we should not add borders. classes += " border active:outline active:outline-1" unless is_icon? diff --git a/app/components/avo/resource_component.rb b/app/components/avo/resource_component.rb index c5a23ab1a..3974ada36 100644 --- a/app/components/avo/resource_component.rb +++ b/app/components/avo/resource_component.rb @@ -288,7 +288,8 @@ def render_action(action) tippy: action.title ? :tooltip : nil, action: "click->actions-picker#visitAction", turbo_prefetch: false, - "actions-picker-target": action.action.standalone ? "standaloneAction" : "resourceAction", + # When action has record present behave as standalone and keep always active. + "actions-picker-target": (action.action.standalone || action.action.record.present?) ? "standaloneAction" : "resourceAction", disabled: action.action.disabled? } do action.label