[Rt-commit] rt branch, 4.6/create_ticket_link_in_menu, created. rt-4.4.4-540-ge2530cd920

Aaron Trevena ast at bestpractical.com
Thu Nov 28 09:59:09 EST 2019


The branch, 4.6/create_ticket_link_in_menu has been created
        at  e2530cd9209349a5fae7fa891e52c80c2eb4a2f3 (commit)

- Log -----------------------------------------------------------------
commit e2530cd9209349a5fae7fa891e52c80c2eb4a2f3
Author: Aaron Trevena <aaron at aarontrevena.co.uk>
Date:   Tue Nov 26 20:20:49 2019 +0000

    Add Create Ticket link in Menu
    
    Adds create ticket item to the home submenu that pops-up modal dialog to select queue and takes you to create ticket page in same way as button
    Added new Ticket/CreateInQueue.html page that matches behaviour of Asset/CreatetInCatalog allowing right-click of menu item to open in new window/tab
    Implements: I#221613

diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 0e1d7b9c36..101af440b0 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -92,6 +92,9 @@ sub BuildMainNav {
     }
 
     my $home = $top->child( home => title => loc('Homepage'), path => '/' );
+    $home->child( createticket => title => loc("Create Ticket"),
+                  path => "/Ticket/CreateInQueue.html" );
+
     unless ($HTML::Mason::Commands::session{'dashboards_in_menu'}) {
         my $dashboards_in_menu = $current_user->UserObj->Preferences(
             'DashboardsInMenu',
diff --git a/share/html/Elements/CreateTicket b/share/html/Elements/CreateTicket
index aa9ae034cb..a07a3f1a23 100644
--- a/share/html/Elements/CreateTicket
+++ b/share/html/Elements/CreateTicket
@@ -45,7 +45,7 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<form action="<% RT->Config->Get('WebPath') %><% $SendTo %>" name="CreateTicketInQueue" id="CreateTicketInQueue" \
+<form action="<% RT->Config->Get('WebPath') %><% $SendTo %>" name="<% $FormName %>" id="<% $FormName %>" \
 % $m->callback(CallbackName => 'InFormElement');
 >
 
@@ -87,4 +87,5 @@ $SendTo => '/Ticket/Create.html',
 $IncludeExplanation => 0
 $Hyperlink => undef
 $ButtonOnly => undef
+$FormName => 'CreateTicketInQueue'
 </%ARGS>
diff --git a/share/html/Elements/CreateTicket b/share/html/Ticket/CreateInQueue.html
similarity index 57%
copy from share/html/Elements/CreateTicket
copy to share/html/Ticket/CreateInQueue.html
index aa9ae034cb..c2f3117bb6 100644
--- a/share/html/Elements/CreateTicket
+++ b/share/html/Ticket/CreateInQueue.html
@@ -45,46 +45,8 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<form action="<% RT->Config->Get('WebPath') %><% $SendTo %>" name="CreateTicketInQueue" id="CreateTicketInQueue" \
-% $m->callback(CallbackName => 'InFormElement');
->
 
-% if ($IncludeExplanation) {
-<p><&|/l&>Select a queue for your new ticket.</&></p>
-% }
-
-% my $button_start = '<input type="submit" class="button btn btn-primary form-control" value="';
-% my $button_start_modal = '<input type="submit" class="button btn btn-primary form-control ticket-create-modal" value="';
-% my $button_only_start_modal = '<input type="submit" class="btn btn-primary ticket-create-modal" value="';
-% my $button_end = '" />';
-% my $queue_selector = $m->scomp('/Elements/SelectNewTicketQueue', AutoSubmit => 1, SendTo => $SendTo, Placeholder => loc('Queue'), Hyperlink => $Hyperlink );
-
-% if ($Hyperlink) {
-<% $queue_selector |n %>
-% }
-% elsif ($ButtonOnly) {
-<div class="create-ticket-button">
-<&|/l_unsafe, $button_only_start_modal, $button_end &>[_1]Create new ticket[_2]</&>
-</div>
-% }
-% else {
-<div class="create-wide">
-<&|/l_unsafe, $button_start, $button_end, $queue_selector &>[_1]New ticket in[_2] [_3]</&>
-</div>
-<div class="create-medium">
-<&|/l_unsafe, $button_start_modal, $button_end &>[_1]New ticket[_2]</&>
-</div>
-<div class="create-narrow">
-<&|/l_unsafe, $button_start_modal, $button_end &>[_1]+[_2]</&>
-</div>
-% }
-
-% $m->callback(CallbackName => 'BeforeFormEnd');
-
-</form>
-<%ARGS>
-$SendTo => '/Ticket/Create.html',
-$IncludeExplanation => 0
-$Hyperlink => undef
-$ButtonOnly => undef
-</%ARGS>
+<& /Elements/Header,
+    Title => loc("Create new Ticket") &>
+<& /Elements/Tabs &>
+<& /Elements/CreateInQueue &>
diff --git a/share/static/js/util.js b/share/static/js/util.js
index f54c129656..d9914c4efe 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -565,7 +565,7 @@ jQuery(function() {
         return false;
     });
 
-    jQuery(".ticket-create-modal").click(function(ev){
+    jQuery("#home-createticket,.ticket-create-modal").click(function(ev){
         ev.preventDefault();
         jQuery.get(
             RT.Config.WebHomePath + "/Helpers/CreateInQueue",

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


More information about the rt-commit mailing list