[Rt-commit] rt branch, 4.6/select-queue-in-ticket-create, repushed

Aaron Trevena ast at bestpractical.com
Mon Jan 20 11:44:43 EST 2020


The branch 4.6/select-queue-in-ticket-create was deleted and repushed:
       was fc3fd3d52262912dffecc3ee43e3df825745a416
       now c854d5da137029eaf096f88c4e4691f58039e03c

1: ab2ddf5db0 ! 1: 828ac1dd44 Select Queue in Ticket Create page
    @@ -2,74 +2,12 @@
     
         Select Queue in Ticket Create page
         
    -    Allow Queue to be selected in the create ticket page, using defaults from configuration if none provided
    -    Existing urls for queue creation will still work, and previous ticket create button and modal are possible by over-riding template
    -    Auto-complete lookup will be used if configured in place of selectbox in ticket create page in same way as previous modal
    -
    -diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
    ---- a/lib/RT/Interface/Web/MenuBuilder.pm
    -+++ b/lib/RT/Interface/Web/MenuBuilder.pm
    -@@
    -         $widgets->child( create_article => raw_html => $HTML::Mason::Commands::m->scomp('/Articles/Elements/CreateArticleButton') );
    -     } else {
    -         $widgets->child( simple_search => raw_html => $HTML::Mason::Commands::m->scomp('SimpleSearch', Placeholder => loc('Search Tickets')) );
    --        $widgets->child( create_ticket => raw_html => $HTML::Mason::Commands::m->scomp('CreateTicket', ButtonOnly => 1) );
    -+        $widgets->child( create_ticket => raw_html => $HTML::Mason::Commands::m->scomp('CreateTicket', ButtonOnly => 1, SkipQueueSelection => 1) );
    -     }
    - 
    -     my $home = $top->child( home => title => loc('Homepage'), path => '/' );
    -
    -diff --git a/share/html/Elements/CreateTicket b/share/html/Elements/CreateTicket
    ---- a/share/html/Elements/CreateTicket
    -+++ b/share/html/Elements/CreateTicket
    -@@
    - 
    - % 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_only_start = '<input type="submit" class="btn btn-primary" value="';
    - % my $button_end = '" />';
    --% my $queue_selector = $m->scomp('/Elements/SelectNewTicketQueue', AutoSubmit => 1, SendTo => $SendTo, Placeholder => loc('Queue'), Hyperlink => $Hyperlink );
    --
    -+% my $queue_selector = '';
    -+% unless ($SkipQueueSelection) {
    -+%    $queue_selector = $m->scomp('/Elements/SelectNewTicketQueue', AutoSubmit => 1, SendTo => $SendTo, Placeholder => loc('Queue'), Hyperlink => $Hyperlink );
    -+% }
    - % if ($Hyperlink) {
    - <% $queue_selector |n %>
    - % }
    - % elsif ($ButtonOnly) {
    -+%   if ($SkipQueueSelection) {
    -+%       my $button_only_start = '<input type="submit" class="btn btn-primary" value="';
    -+<div class="create-wide">
    -+<&|/l_unsafe, $button_only_start, $button_end &>[_1]Create new ticket[_2]</&>
    -+</div>
    -+<div class="create-medium">
    -+<&|/l_unsafe, $button_only_start, $button_end &>[_1]Create[_2]</&>
    -+</div>
    -+<div class="create-narrow">
    -+<&|/l_unsafe, $button_only_start, $button_end &>[_1]+[_2]</&>
    -+</div>
    -+%   }
    -+%   else {
    -+% my $button_only_start_modal = '<input type="submit" class="btn btn-primary ticket-create-modal" value="';
    - <div class="create-wide">
    - <&|/l_unsafe, $button_only_start_modal, $button_end &>[_1]Create new ticket[_2]</&>
    - </div>
    -@@
    - <div class="create-narrow">
    - <&|/l_unsafe, $button_start_modal, $button_end &>[_1]+[_2]</&>
    - </div>
    -+%    }
    - % }
    - % else {
    - <div class="create-wide">
    -@@
    - $IncludeExplanation => 0
    - $Hyperlink => undef
    - $ButtonOnly => undef
    -+$SkipQueueSelection => undef
    - </%ARGS>
    +    Allow Queue to be selected in the create ticket page, using defaults
    +    from configuration if none provided
    +    Existing urls for queue creation will still work, and previous ticket
    +    create button and modal are possible by over-riding template
    +    Auto-complete lookup will be used if configured in place of selectbox
    +    in ticket create page in same way as previous modal
     
     diff --git a/share/html/Elements/SelectObject b/share/html/Elements/SelectObject
     --- a/share/html/Elements/SelectObject
    @@ -79,22 +17,18 @@
      %     for my $object ($default_entry || (), @{$session{$cache_key}{objects}}) {
        <option value="<% ($NamedValues ? $object->{Name} : $object->{Id}) %>"\
     -% if ($object->{Id} eq ($Default||'') || $object->{Name} eq ($Default||'')) {
    -+% if ($SelectedId) {
    -+%    if ($SelectedId eq $object->{Id} ) {
    -+ selected="selected"\
    -+%    }
    -+% } elsif ( $object->{Id} eq ($Default||'') || $object->{Name} eq ($Default||'')) {
    ++% if ( $object->{Id} eq ($Default||'') || $object->{Name} eq ($Default||'')) {
       selected="selected"\
      % }
      ><%$object->{Name}%>\
     @@
    - $NamedValues => 0
    - $DefaultLabel => "-"
    - $Default => 0
    -+$SelectedId => undef
    - $Lite => 0
    - $OnChange => undef
    - $Multiple => 0
    + %     }
    + </select>
    + % }
    ++
    + <%args>
    + $ObjectType
    + $CheckRight => undef
     @@
      $AccessKey => undef
      </%args>
    @@ -111,7 +45,7 @@
      %# those contributions and any derivatives thereof.
      %#
      %# END BPS TAGGED BLOCK }}}
    -+<input type="hidden" name="queue-changed-reload" id="queue-changed-reload" value="0"/>
    ++<input type="hidden" name="QueueChanged" id="QueueChanged" value="0"/>
      %if (RT->Config->Get("AutocompleteQueues", $session{'CurrentUser'})) {
      <& SelectQueueAutocomplete, %ARGS, &>
      %} else {
    @@ -119,19 +53,19 @@
          CheckRight       => $CheckQueueRight,
          ShowAll          => $ShowAllQueues,
          CacheNeedsUpdate => RT->System->QueueCacheNeedsUpdate,
    -+    SelectedId       => $SelectedId
    ++    Default          => $SelectedId
          &>
      %}
      <%args>
      $CheckQueueRight => 'CreateTicket'
      $ShowAllQueues   => 1
      $AutoSubmit      => 0
    -+$SelectedId      => undef
    ++$SelectedId   => undef
     +$QueueObj        => undef
      </%args>
      <%init>
     -$ARGS{OnChange} = "jQuery(this).closest('form').submit();" if $AutoSubmit;
    -+$ARGS{OnChange} = q{jQuery('#queue-changed-reload').val(1);};
    ++$ARGS{OnChange} = q{jQuery('#QueueChanged').val(1);};
     +$ARGS{OnChange} .= "jQuery(this).closest('form').submit();" if ($AutoSubmit);
      </%init>
     
    @@ -140,7 +74,7 @@
     +++ b/share/html/Ticket/Create.html
     @@
          Title => $title,
    -     onload => "function () { hide('Ticket-Create-details') }" &>
    + &>
      <& /Elements/Tabs &>
     -    
     +
    @@ -196,12 +130,7 @@
      <%INIT>
      $m->callback( CallbackName => "Init", ARGSRef => \%ARGS );
     +
    -+# Queue is a hidden field and updated by javascript when changed in selectbox,
    -+# but we check the select field in case javascript disabled or incompatible with browser
      my $Queue = $ARGS{Queue};
    -+if ($ARGS{SelectedQueue}) {
    -+   $Queue = $ARGS{SelectedQueue};
    -+}
     +
     +# Use default queue from config site or user prefs if none provided
     +unless ($Queue) {
    @@ -243,7 +172,7 @@
      
      if ((!exists $ARGS{'AddMoreAttach'}) and (!exists $ARGS{'Go'}) and (defined($ARGS{'id'}) and $ARGS{'id'} eq 'new')) { # new ticket?
     -    if ( !$checks_failure && !$skip_create ) {
    -+    if ( !$checks_failure && !$skip_create && !$ARGS{'queue-changed-reload'} ) {
    ++    if ( !$checks_failure && !$skip_create && !$ARGS{'QueueChanged'} ) {
              $m->comp('Display.html', %ARGS);
              $RT::Logger->crit("After display call; error is $@");
              $m->abort();
2: fc3fd3d522 ! 2: c854d5da13 Select Queue in Ticket Create page Tests and test dependancies
    @@ -2,7 +2,8 @@
     
         Select Queue in Ticket Create page Tests and test dependancies
         
    -    Added new tests for creating tickets with custom fields and lifecycles, and with or without queue specified
    +    Added new tests for creating tickets with custom fields and
    +     lifecycles, and with or without queue specified
     
     diff --git a/etc/cpanfile b/etc/cpanfile
     --- a/etc/cpanfile
    @@ -14,10 +15,7 @@
     +    requires 'Test::HTML::Form', '>= 1.01';
          requires 'Test::WWW::Mechanize', '>= 1.30';
          requires 'Test::WWW::Mechanize::PSGI';
    -+    requires 'UNIVERSAL::require';
    -     requires 'WWW::Mechanize', '>= 1.52';
    -     requires 'XML::Simple';
    - };
    +     requires 'WWW::Mechanize', '>= 1.80';
     
     diff --git a/t/customfields/access_via_queue.t b/t/customfields/access_via_queue.t
     --- a/t/customfields/access_via_queue.t
    @@ -345,7 +343,7 @@
          $m->submit_form_ok({ form_name => 'CreateTicket' },
                               "Submitted form to create ticket with group $group_id as Cc" );
     -    like( $m->uri, qr{/Ticket/Create\.html\?AddGroupCc=$group_id&Queue=1$},
    -+    like( $m->uri, qr{/Ticket/Create\.html\?AddGroupCc=$group_id&queue-changed-reload=0&Queue=1$},
    ++    like( $m->uri, qr{/Ticket/Create\.html\?AddGroupCc=$group_id&QueueChanged=0&Queue=1$},
                "now on /Ticket/Create\.html with param AddGroupCc=$group_id" );
      
          my $subject = 'test AddGroupCc ticket';
    @@ -407,7 +405,7 @@
     +
     +# test ticket creation on reload from selected queue, specifying queue with custom fields
     +note('reload ticket create page with selected queue');
    -+$m->get_ok( '/Ticket/Create.html?queue-changed-reload=1&Queue='.$queue1->id.'&SelectedQueue=' . $queue1->id,
    ++$m->get_ok( '/Ticket/Create.html?QueueChanged=1&Queue='.$queue1->id,
     +            'go to ticket create page' );
     +
     +form_select_field_matches($m, { field_name => 'Queue', selected => $queue1->id,



More information about the rt-commit mailing list