From 046502f876999afcc5e46e80c6698f0d6409881a Mon Sep 17 00:00:00 2001 From: Benaka Moorthi Date: Sun, 8 Sep 2013 15:25:35 -0400 Subject: Refs #3089, display 'There are no more visits' if its known there are no more visits to display in the visitor profile. --- plugins/Live/Controller.php | 2 +- plugins/Live/javascripts/visitorProfile.js | 11 +++++++++-- plugins/Live/templates/getVisitorProfilePopup.twig | 4 ++++ 3 files changed, 14 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/Live/Controller.php b/plugins/Live/Controller.php index 93e5249f74..16c0e6b6a3 100644 --- a/plugins/Live/Controller.php +++ b/plugins/Live/Controller.php @@ -174,7 +174,7 @@ class Controller extends \Piwik\Controller $view = new View('@Live/getVisitList.twig'); $view->idSite = Common::getRequestVar('idSite', null, 'int'); - $view->startCounter = Common::getRequestVar('filter_offset', 1, 'int'); + $view->startCounter = Common::getRequestVar('filter_offset', 0, 'int') + 1; $view->visits = $nextVisits; echo $view->render(); } diff --git a/plugins/Live/javascripts/visitorProfile.js b/plugins/Live/javascripts/visitorProfile.js index 4726734c4a..51197fb8ee 100644 --- a/plugins/Live/javascripts/visitorProfile.js +++ b/plugins/Live/javascripts/visitorProfile.js @@ -149,13 +149,15 @@ }, 'GET'); ajax.setCallback(function (response) { if (response == "") { // no more visits left - var noMoreSpan = $('').text(_pk_translate('Live_NoMoreVisits_js')).addClass('visitor-profile-no-visits'); - $('.visitor-profile-more-info', $element).html(noMoreSpan); + self._showNoMoreVisitsSpan(); } else { response = $(response); loading.hide(); $('.visitor-profile-visits', $element).append(response); + if (response.filter('li').length < 10) { + self._showNoMoreVisitsSpan(); + } piwikHelper.lazyScrollTo($(response)[0], 400, true); } @@ -164,6 +166,11 @@ ajax.send(); }, + _showNoMoreVisitsSpan: function () { + var noMoreSpan = $('').text(_pk_translate('Live_NoMoreVisits_js')).addClass('visitor-profile-no-visits'); + $('.visitor-profile-more-info', this.$element).html(noMoreSpan); + }, + _loadIndividualVisitDetails: function ($visitElement) { var self = this, $element = this.$element, diff --git a/plugins/Live/templates/getVisitorProfilePopup.twig b/plugins/Live/templates/getVisitorProfilePopup.twig index a408f19a1a..bb30a5ee5f 100644 --- a/plugins/Live/templates/getVisitorProfilePopup.twig +++ b/plugins/Live/templates/getVisitorProfilePopup.twig @@ -85,7 +85,11 @@
+ {% if visitorData.lastVisits.getRowsCount() >= constant("Piwik\\Plugins\\Live\\API::VISITOR_PROFILE_MAX_VISITS_TO_SHOW") %} {{ 'Live_LoadMoreVisits'|translate }} + {% else %} + {{ 'Live_NoMoreVisits_js'|translate }} + {% endif %}
-- cgit v1.2.3