[Bps-public-commit] RT-Extension-PreviewInSearch branch, master, updated. fb924bcf13c9cea1b7e7476b34e1fb0ae76c22b0

Wallace Reis wreis at bestpractical.com
Tue Dec 9 14:20:43 EST 2014


The branch, master has been updated
       via  fb924bcf13c9cea1b7e7476b34e1fb0ae76c22b0 (commit)
      from  7da005561405e36c6cd515859fae5688a02af195 (commit)

Summary of changes:
 .../Search/Results.html/AfterResults               | 84 ----------------------
 .../Results.html/{AfterResults => BeforeResults}   |  8 ++-
 2 files changed, 5 insertions(+), 87 deletions(-)
 copy html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/{AfterResults => BeforeResults} (88%)

- Log -----------------------------------------------------------------
commit fb924bcf13c9cea1b7e7476b34e1fb0ae76c22b0
Author: Wallace Reis <wreis at bestpractical.com>
Date:   Tue Dec 9 16:31:15 2014 -0200

    SideBySidePreview - rework the Callback to be BeforeResults
    
    Some browsers render the <table> before getting to the <style> block
    directly under it, then causing the effect of re-rendering the table
    with the new style with some delay affecting the UX.

diff --git a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
index f1ddb35..e69de29 100644
--- a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
+++ b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
@@ -1,84 +0,0 @@
-<style>
-tr.in-preview td { background: #ffb }
-% if ( RT->Config->Get('SideBySidePreview') ) {
-.ticket-list-with-previewinsearch {
-    position: fixed;
-    width: 42%;
-    top: 10em;
-    bottom: 6em;
-    overflow-y: scroll;
-    overflow-x: hidden;
-    z-index: 11;
-}
-.refresh-with-previewinsearch {
-    position: fixed;
-    bottom: 0;
-}
-.paging-with-previewinsearch {
-    position: fixed;
-    bottom: 2.5em;
-}
-#ticket-preview-container {
-    position: fixed;
-    top: 10em;
-    left: 47%;
-    right: 0;
-    bottom: 0;
-    overflow-y: auto;
-    background: inherit;
-    z-index: 10;
-    display: none;
-}
-% }
-</style>
-<div id="ticket-preview-container" ></div>
-<script type="text/javascript">
-var get_ticket_row = function (from) {
-    var row = jQuery(from).closest('tr');
-    var even_or_odd = row.hasClass('oddline')? 'evenline': 'oddline';
-    row = row.add(row.prevUntil('.'+even_or_odd, '[class*="line"]'))
-        .add(row.nextUntil('.'+even_or_odd, '[class*="line"]'));
-    return row;
-};
-var do_preview = function(row) {
-    var tid = row.find('> td a[href*="Display.html?id="]')
-        .first().attr('href').match(/Display\.html\?id=(\d+)/)[1];
-    var url = <% RT->Config->Get('WebPath') |n,j %> +'/Helpers/TicketPreview?id='+tid;
-    row.siblings('tr').removeClass('in-preview');
-    row.addClass('in-preview');
-    jQuery('#ticket-preview-container').text(<% loc('Loading...') |n,j %>).load( url );
-% if ( RT->Config->Get('SideBySidePreview') ) {
-    jQuery('table.ticket-list').wrap( "<div class='ticket-list-with-previewinsearch'></div>" );
-    jQuery('#ticket-preview-container').show();
-    jQuery('div.refresh').addClass('refresh-with-previewinsearch');
-    jQuery('div.ticket-list-with-previewinsearch').animate({
-        scrollTop: '+='+(jQuery("tr.in-preview").offset().top-jQuery('div.ticket-list-with-previewinsearch').offset().top)
-    }, 1);
-    jQuery('div.paging').addClass('paging-with-previewinsearch');
-% } else {
-    jQuery('html, body').animate({
-        scrollTop: '+='+(jQuery("#ticket-preview-container").offset().top-jQuery(window).scrollTop())
-    }, 1000);
-% }
-};
-
-% if ( RT->Config->Get('SideBySidePreview') ) {
-jQuery(document).ready(function() {
-    do_preview( get_ticket_row( jQuery('table.ticket-list tbody tr td').first() ) );
-});
-% }
-
-jQuery(function(){
-    jQuery('table.ticket-list > tbody > tr > td').on('click', function (e) {
-        if (e.target.tagName != 'TD')
-            return;
-
-        var row = get_ticket_row(e.target);
-        do_preview(row);
-    });
-});
-</script>
-<%ARGS>
-</%ARGS>
-<%INIT>
-</%INIT>
diff --git a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/BeforeResults
similarity index 88%
copy from html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
copy to html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/BeforeResults
index f1ddb35..03d1167 100644
--- a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
+++ b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/BeforeResults
@@ -1,7 +1,7 @@
 <style>
 tr.in-preview td { background: #ffb }
 % if ( RT->Config->Get('SideBySidePreview') ) {
-.ticket-list-with-previewinsearch {
+table.ticket-list, .ticket-list-with-previewinsearch {
     position: fixed;
     width: 42%;
     top: 10em;
@@ -48,7 +48,9 @@ var do_preview = function(row) {
     row.addClass('in-preview');
     jQuery('#ticket-preview-container').text(<% loc('Loading...') |n,j %>).load( url );
 % if ( RT->Config->Get('SideBySidePreview') ) {
-    jQuery('table.ticket-list').wrap( "<div class='ticket-list-with-previewinsearch'></div>" );
+    var ticket_list = jQuery('table.ticket-list');
+    ticket_list.wrap( "<div class='ticket-list-with-previewinsearch'></div>" );
+    ticket_list.removeClass('ticket-list');
     jQuery('#ticket-preview-container').show();
     jQuery('div.refresh').addClass('refresh-with-previewinsearch');
     jQuery('div.ticket-list-with-previewinsearch').animate({
@@ -69,7 +71,7 @@ jQuery(document).ready(function() {
 % }
 
 jQuery(function(){
-    jQuery('table.ticket-list > tbody > tr > td').on('click', function (e) {
+    jQuery('table.collection-as-table > tbody > tr > td').on('click', function (e) {
         if (e.target.tagName != 'TD')
             return;
 

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


More information about the Bps-public-commit mailing list