[Rt-commit] rt branch 5.0/self-service-asset-actions-menu created. rt-5.0.5-79-gfc3439ea86

BPS Git Server git at git.bestpractical.com
Mon Dec 11 20:27:13 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/self-service-asset-actions-menu has been created
        at  fc3439ea86fa50b54b5dd58b1912dba2eb5af739 (commit)

- Log -----------------------------------------------------------------
commit fc3439ea86fa50b54b5dd58b1912dba2eb5af739
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Dec 11 14:54:25 2023 -0500

    Switch to "Create Linked Ticket" modal in "Assets" widget on ticket display page
    
    This is consistent with page menu.

diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index f786616332..69a68a40d0 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -1058,6 +1058,7 @@ sub _BuildAssetMenuActionSubmenu {
     my $actions = $page->child("actions", title => HTML::Mason::Commands::loc("Actions"));
     $actions->child(
         "create-linked-ticket",
+        class => 'asset-create-linked-ticket',
         title => HTML::Mason::Commands::loc("Create linked ticket"),
         path  => ( $is_self_service ? '/SelfService' : '' ) . "/Asset/CreateLinkedTicket.html?Asset=$id"
     );
@@ -1766,7 +1767,12 @@ sub BuildSelfServiceNav {
 
         if ($home->child("new")) {
             my $actions = $page->child("actions", title => loc("Actions"));
-            $actions->child("create-linked-ticket", title => loc("Create linked ticket"), path => "/SelfService/Asset/CreateLinkedTicket.html?Asset=$id");
+            $actions->child(
+                "create-linked-ticket",
+                class => 'asset-create-linked-ticket',
+                title => loc("Create linked ticket"),
+                path  => "/SelfService/Asset/CreateLinkedTicket.html?Asset=$id"
+            );
         }
     }
 
diff --git a/share/static/js/assets.js b/share/static/js/assets.js
index 6eba4c09d5..926be23f13 100644
--- a/share/static/js/assets.js
+++ b/share/static/js/assets.js
@@ -18,7 +18,7 @@ jQuery(function() {
                                  .map(function(x){return "asset:"+x})
                                  .join(" "));
     });
-    jQuery("#page-actions-create-linked-ticket").click(function(ev){
+    jQuery(".asset-create-linked-ticket").click(function(ev){
         ev.preventDefault();
         var url = this.href.replace(/\/Asset\/CreateLinkedTicket\.html\?/g,
                                     '/Asset/Helpers/CreateLinkedTicket?');

commit 86692a8c88a75f88936e1f08feda92c84d99ef6a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Dec 11 14:45:05 2023 -0500

    Take care of SelfService when building asset action menu for "Assets" widget
    
    Not only for privileged page menu, _BuildAssetMenuActionSubmenu is also
    used to build asset action menu in "Assets" widget on ticket display
    page, which may show up in SelfService.

diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 57c7240d57..f786616332 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -1053,9 +1053,16 @@ sub _BuildAssetMenuActionSubmenu {
 
     my $asset = $args{Asset};
     my $id    = $asset->id;
+    my $is_self_service = $request_path =~ m{^/SelfService/} ? 1 : 0;
 
     my $actions = $page->child("actions", title => HTML::Mason::Commands::loc("Actions"));
-    $actions->child("create-linked-ticket", title => HTML::Mason::Commands::loc("Create linked ticket"), path => "/Asset/CreateLinkedTicket.html?Asset=$id");
+    $actions->child(
+        "create-linked-ticket",
+        title => HTML::Mason::Commands::loc("Create linked ticket"),
+        path  => ( $is_self_service ? '/SelfService' : '' ) . "/Asset/CreateLinkedTicket.html?Asset=$id"
+    );
+
+    return if $is_self_service;
 
     my $status    = $asset->Status;
     my $lifecycle = $asset->LifecycleObj;

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list