[Rt-commit] rt branch, 4.0/saved-search-context, updated. rt-4.0.1-216-g9cb31b4

Jason May jasonmay at bestpractical.com
Mon Aug 22 20:29:13 EDT 2011


The branch, 4.0/saved-search-context has been updated
       via  9cb31b4c8c8dad422e61927ac9fdbd652b2524d0 (commit)
       via  00a7c82f64d702b1e5ee5772e2f5d459620a4838 (commit)
      from  277a702b1634d44bde34c5823d26e03916b0fcc2 (commit)

Summary of changes:
 share/html/Elements/Submit   |    5 +++--
 share/html/Search/Build.html |    8 ++++----
 t/web/saved_search_context.t |   39 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 6 deletions(-)
 create mode 100644 t/web/saved_search_context.t

- Log -----------------------------------------------------------------
commit 00a7c82f64d702b1e5ee5772e2f5d459620a4838
Author: Jason May <jasonmay at bestpractical.com>
Date:   Mon Aug 22 19:56:55 2011 -0400

    Add failing test for context loss regarding search terms
    
    "Add these terms and search" two times appears to cause
    the last search condition entered to drop when 'Bulk Update'
    is clicked.

diff --git a/t/web/saved_search_context.t b/t/web/saved_search_context.t
new file mode 100644
index 0000000..002763b
--- /dev/null
+++ b/t/web/saved_search_context.t
@@ -0,0 +1,39 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use RT::Test no_plan => 1;
+my ( $url, $m ) = RT::Test->started_ok;
+
+my $ticket = RT::Ticket->new(RT->SystemUser);
+for (['x', 50], ['y', 40], ['z', 30]) {
+    $ticket->Create(
+        Subject   => $_->[0],
+        Queue     => 'general',
+        Owner     => 'root',
+        Priority  => $_->[1],
+        Requestor => 'root at localhost',
+    );
+}
+
+ok( $m->login, 'logged in' );
+
+$m->get($url . '/Search/Build.html?NewQuery=1');
+$m->form_name('BuildQuery');
+$m->field(ValueOfPriority => 45);
+$m->click('DoSearch');
+#RT->Logger->error($m->uri); sleep 100;
+#{ open my $fh, '>', 'm.html'; print $fh $m->content; close $fh; }; die;
+$m->text_contains('Found 2 tickets');
+
+$m->follow_link(id => 'page-edit_search');
+$m->form_name('BuildQuery');
+$m->field(ValueOfAttachment => 'z');
+$m->click('DoSearch');
+
+$m->text_contains('Found 1 ticket');
+
+$m->follow_link(id => 'page-bulk');
+
+$m->form_name('BulkUpdate');
+ok(!$m->value('UpdateTicket2'), "There is no Ticket #2 in the search's bulk update");

commit 9cb31b4c8c8dad422e61927ac9fdbd652b2524d0
Author: Jason May <jasonmay at bestpractical.com>
Date:   Mon Aug 22 20:25:43 2011 -0400

    Preserve context better when Add These Terms and Search
    
    BulkUpdate seems to be one step behind so we redirect with
    the newest query params instead of using what's in the inputs.

diff --git a/share/html/Elements/Submit b/share/html/Elements/Submit
index 2b7c6dd..6a45714 100755
--- a/share/html/Elements/Submit
+++ b/share/html/Elements/Submit
@@ -68,10 +68,10 @@ id="<%$id%>"
 
 % if ($AlternateLabel) {
   <span class="caption"><%$AlternateCaption%></span>
-  <input type="submit" <% $OnClick ? qq[ onclick="$OnClick"] : '' | n %> <% $Name ? qq[ name="$Name"] : '' | n %> value="<%$AlternateLabel%>" class="button" />
+  <input type="submit" <% $OnClick ? qq[ onclick="$OnClick"] : '' | n %> <% $Name ? qq[ name="$Name"] : '' | n %> <% $SubmitId ? qq[ id="$SubmitId"] : '' | n %> value="<%$AlternateLabel%>" class="button" />
 % } else {
   <span class="caption"><%$Caption%></span>
-  <input type="submit" <% $OnClick ? qq[ onclick="$OnClick"] : '' | n %> <% $Name ? qq[ name="$Name"] : '' | n %> value="<%$Label%>" class="button" />
+  <input type="submit" <% $OnClick ? qq[ onclick="$OnClick"] : '' | n %> <% $Name ? qq[ name="$Name"] : '' | n %> <% $SubmitId ? qq[ id="$SubmitId"] : '' | n %> value="<%$Label%>" class="button" />
 % }
 
 % if ( $Back ) {
@@ -112,5 +112,6 @@ $BackOnClick => undef
 $OnClick => undef
 $Reset => undef
 $ResetLabel => loc('Reset')
+$SubmitId => undef
 $id => undef
 </%ARGS>
diff --git a/share/html/Search/Build.html b/share/html/Search/Build.html
index db84e7d..7b2dc7f 100644
--- a/share/html/Search/Build.html
+++ b/share/html/Search/Build.html
@@ -80,8 +80,8 @@
 <div id="pick-criteria">
     <& Elements/PickCriteria, query => $query{'Query'}, cfqueues => $queues &>
 </div>
-<& /Elements/Submit,  Label => loc('Add these terms'), Name => 'AddClause'&>
-<& /Elements/Submit, Label => loc('Add these terms and Search'), Name => 'DoSearch'&>
+<& /Elements/Submit,  Label => loc('Add these terms'), SubmitId => 'AddClause', Name => 'AddClause'&>
+<& /Elements/Submit, Label => loc('Add these terms and Search'), SubmitId => 'DoSearch', Name => 'DoSearch'&>
 
 
 <div id="editquery">
@@ -290,8 +290,8 @@ $session{'CurrentSearchHash'} = {
 # Show the results, if we were asked.
 
 if ( $ARGS{'DoSearch'} ) {
-    $m->comp( 'Results.html', %query, SavedChartSearchId => $ARGS{'SavedChartSearchId'}, );
-    $m->comp( '/Elements/Footer' );
+    my $redir_query_string = $m->comp('/Elements/QueryString', %query, SavedChartSearchId => $ARGS{'SavedChartSearchId'});
+    RT::Interface::Web::Redirect(RT->Config->Get('WebPath') . '/Search/Results.html?' . $redir_query_string);
     $m->abort;
 }
 

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


More information about the Rt-commit mailing list