[Rt-commit] rt 03/12: Add "New Dashboard" to prefs/global MyRT page menu for convenience

sunnavy sunnavy at bestpractical.com
Wed Jul 14 14:46:44 EDT 2021


This is an automated email from the git hooks/post-receive script.

sunnavy pushed a commit to branch 5.0/use-dashboard-for-homepage-select-ui
in repository rt.

commit 934a70bc6e082ce9874137b09aa152dfc9d9b527
Author: sunnavy <sunnavy at bestpractical.com>
AuthorDate: Sat May 15 00:59:13 2021 +0800

    Add "New Dashboard" to prefs/global MyRT page menu for convenience
---
 lib/RT/Interface/Web/MenuBuilder.pm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 3b3b67c554..6d42200acb 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -933,6 +933,20 @@ sub BuildMainNav {
         }
     }
 
+    # Top menu already has the create link, adding it to page menu is just
+    # for convenience. As user admin page already has quite a few items in
+    # page menu and it's unlikely that admins want to create new dashboard
+    # when editing a user's preference, here we don't touch admin user page.
+    if ( $request_path =~ m{^/(Prefs|Admin/Global)/MyRT\.html} ) {
+        if ( RT::Dashboard->new($current_user)->CurrentUserCanCreateAny ) {
+            $page->child(
+                'dashboard_create' => title => loc('New Dashboard'),
+                path               => "/Dashboards/Modify.html?Create=1"
+            );
+        }
+    }
+
+
     if ( $request_path =~ /^\/(?:index.html|$)/ ) {
         my $alt = loc('Edit');
         $page->child( edit => raw_html => q[<a id="page-edit" class="menu-item" href="] . RT->Config->Get('WebPath') . qq[/Prefs/MyRT.html"><span class="fas fa-cog" alt="$alt" data-toggle="tooltip" data-placement="top" data-original-title="$alt"></span></a>] );

-- 
To stop receiving notification emails like this one, please contact
sysadmin at bestpractical.com.


More information about the rt-commit mailing list