[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.1-99-g40d29f9
Shawn Moore
shawn at bestpractical.com
Tue Aug 9 19:01:10 EDT 2016
The branch, 4.4-trunk has been updated
via 40d29f995084845ed029c7650935ffaa47173dd5 (commit)
via 6862e956520730d55604a411076e05cf92dc30ea (commit)
from c491c12593663489e49ab1ccd523f17821f98bbe (commit)
Summary of changes:
share/html/Elements/ShowHistoryHeader | 11 +++++++++++
share/html/Helpers/TicketHistoryPage | 3 ++-
share/html/Ticket/Elements/ScrollShowHistory | 28 +++++++++++++++++++++++++++-
3 files changed, 40 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit 6862e956520730d55604a411076e05cf92dc30ea
Author: Dustin Graves <dustin at bestpractical.com>
Date: Fri Aug 5 22:17:23 2016 +0000
add "Load all history" button to "as you scroll" history mode
Fixes: I#32094
diff --git a/share/html/Elements/ShowHistoryHeader b/share/html/Elements/ShowHistoryHeader
index 8954bc8..e9092c5 100644
--- a/share/html/Elements/ShowHistoryHeader
+++ b/share/html/Elements/ShowHistoryHeader
@@ -50,6 +50,7 @@ $Object
$ShowHeaders => 0
$ShowTitle => 1
$ShowDisplayModes => 1
+$ScrollShowHistory => 0
</%ARGS>
<%INIT>
my $record_type = $Object->RecordType;
@@ -63,6 +64,15 @@ if ( $ShowDisplayModes or $ShowTitle ) {
: ' ';
my $titleright = '';
+ if ( $ScrollShowHistory ) {
+ $titleright .= qq{<span id="LoadAllHistoryContainer">} .
+ qq{<a href="#" id="LoadAllHistory">} .
+ loc('Load all history') .
+ qq{</a>} .
+ ($ShowDisplayModes ? '—' : '') .
+ qq{</span>};
+ }
+
if ( $ShowDisplayModes ) {
if ( RT->Config->Get( 'QuoteFolding', $session{CurrentUser} ) ) {
my $open_all = $m->interp->apply_escapes( loc("Show all quoted text"), 'j' );
@@ -85,6 +95,7 @@ if ( $ShowDisplayModes or $ShowTitle ) {
qq{</a>};
}
}
+
</%perl>
<& /Widgets/TitleBoxStart, title => $title, titleright_raw => $titleright &>
% }
diff --git a/share/html/Helpers/TicketHistoryPage b/share/html/Helpers/TicketHistoryPage
index e4e7411..17a55a4 100644
--- a/share/html/Helpers/TicketHistoryPage
+++ b/share/html/Helpers/TicketHistoryPage
@@ -50,6 +50,7 @@ $id
$oldestTransactionsFirst => RT->Config->Get("OldestTransactionsFirst", $session{CurrentUser});
$lastTransactionId => undef
$focusTransactionId => undef
+$loadAll => 0
</%ARGS>
<%INIT>
my $TicketObj = RT::Ticket->new($session{'CurrentUser'});
@@ -82,7 +83,7 @@ if ($focusTransactionId) { # make sure we load enough if we need to focus a tran
OPERATOR => $oldestTransactionsFirst ? '<=' : '>=',
VALUE => $focusTransactionId
);
-} else { # otherwise, just load the standard page of 10 transactions
+} elsif (!$loadAll) { # otherwise, just load the standard page of 10 transactions
$transactions->RowsPerPage(10);
$transactions->FirstPage();
}
diff --git a/share/html/Ticket/Elements/ScrollShowHistory b/share/html/Ticket/Elements/ScrollShowHistory
index a6687c3..03bdc95 100644
--- a/share/html/Ticket/Elements/ScrollShowHistory
+++ b/share/html/Ticket/Elements/ScrollShowHistory
@@ -71,6 +71,7 @@ my $oldestTransactionsFirst = RT->Config->Get("OldestTransactionsFirst", $sessio
ShowHeaders => $ShowHeaders,
ShowTitle => $ShowTitle,
ShowDisplayModes => $ShowDisplayModes,
+ ScrollShowHistory => 1,
&>
</div>
@@ -86,7 +87,8 @@ jQuery(function(){
loadDistanceFromBottom = 1500, // to load before bottom of page is reached
lastTransactionId = null,
hash = window.location.hash,
- hashTransactionId = null;
+ hashTransactionId = null,
+ loadAll = false;
var oldestTransactionsFirst = <% $oldestTransactionsFirst || 0 %>;
@@ -123,6 +125,10 @@ jQuery(function(){
var queryString = '&oldestTransactionsFirst=' + oldestTransactionsFirst;
if (lastTransactionId) queryString += '&lastTransactionId=' + lastTransactionId;
+ if (loadAll) queryString += '&loadAll=1';
+
+ // don't load all over and over again
+ loadAll = false;
// check for link to specific transaction and make sure we load enough to focus it
if (hash && !lastTransactionId) {
@@ -147,10 +153,17 @@ jQuery(function(){
}
} else {
disableLoading = true;
+
+ // hide 'Load All' link container if we're done loading
+ var loadAllHistoryContainer = jQuery('#LoadAllHistoryContainer');
+ loadAllHistoryContainer.hide();
}
isLoading = false;
removeLoadingMessage();
+
+ // make sure we load all if we clicked the "Load All" button while we were already loading
+ if (loadAll) loadHistoryPage();
},
error: function(xhr, reason) {
isLoading = false;
@@ -159,6 +172,14 @@ jQuery(function(){
});
};
+ var loadAllHistory = function() {
+ // hide link container
+ var loadAllHistoryContainer = jQuery('#LoadAllHistoryContainer');
+ loadAllHistoryContainer.hide();
+ loadAll = true;
+ loadHistoryPage();
+ };
+
jQuery(window).scroll(function() {
if(jQuery(window).scrollTop() >= jQuery(document).height() - jQuery(window).height() - loadDistanceFromBottom) {
loadHistoryPage();
@@ -172,6 +193,11 @@ jQuery(function(){
loadHistoryPage();
});
+ jQuery('div.history').on('click', '#LoadAllHistory', function(e) {
+ e.preventDefault();
+ loadAllHistory();
+ });
+
loadHistoryPage();
});
</script>
commit 40d29f995084845ed029c7650935ffaa47173dd5
Merge: c491c12 6862e95
Author: Shawn M Moore <shawn at bestpractical.com>
Date: Tue Aug 9 23:00:54 2016 +0000
Merge branch '4.4/history-scroll-load-all' into 4.4-trunk
-----------------------------------------------------------------------
More information about the rt-commit
mailing list