You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/03/24 11:08:07 UTC

[isis] branch master updated: ISIS-2093: fixes non no-arg action buttons not receiving 'danger' style

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 56fe4f2  ISIS-2093: fixes non no-arg action buttons not receiving 'danger' style
56fe4f2 is described below

commit 56fe4f2888cbda2490d234008d18cee15596725a
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Mar 24 12:07:55 2020 +0100

    ISIS-2093: fixes non no-arg action buttons not receiving 'danger' style
---
 .../entityactions/AdditionalLinksPanel.java           | 19 ++++++++++---------
 .../isis/viewer/wicket/ui/util/Confirmations.java     |  6 +++++-
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksPanel.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksPanel.java
index a9dc733..ffad2fd 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksPanel.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/entityactions/AdditionalLinksPanel.java
@@ -146,15 +146,16 @@ public class AdditionalLinksPanel extends PanelAbstract<ListOfLinksModel> {
                 }
                 link.add(new CssClassAppender(linkAndLabel.getActionIdentifier()));
 
-                if (linkAndLabel.getSemantics().isAreYouSure() 
-                        && linkAndLabel.getParameters().isNoParameters()) {
-                    
-                    val hasDisabledReason = link instanceof ActionLink 
-                            ? _Strings.isNotEmpty(((ActionLink)link).getReasonDisabledIfAny()) 
-                            : false;
-                    if (!hasDisabledReason) {
-                        addConfirmationDialog(link);
-                    }
+                if (linkAndLabel.getSemantics().isAreYouSure()) { 
+                    if(linkAndLabel.getParameters().isNoParameters()) {
+                        val hasDisabledReason = link instanceof ActionLink 
+                                ? _Strings.isNotEmpty(((ActionLink)link).getReasonDisabledIfAny()) 
+                                : false;
+                        if (!hasDisabledReason) {
+                            addConfirmationDialog(link);
+                        }
+                    } 
+                    Confirmations.addConfirmationStyle(link);
                 }
 
                 val cssClass = linkAndLabel.getCssClass();
diff --git a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Confirmations.java b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Confirmations.java
index f9378bb..fc19e73 100644
--- a/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Confirmations.java
+++ b/viewers/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/Confirmations.java
@@ -56,9 +56,13 @@ public class Confirmations {
         if(component instanceof Button) {
             // ensure dialog ok buttons receive the danger style as well
             // don't care if expressed twice
-            component.add(new CssClassAppender("btn-danger"));
+            addConfirmationStyle(component);
         }
         
     }
     
+    public static void addConfirmationStyle(final Component component) {
+        component.add(new CssClassAppender("btn-danger"));
+    }
+    
 }