Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-09-23 13:28:09 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-09-23 13:28:09 +0400
commit4c7d446ac86dfd688cf95bd4e9e94e5621557eee (patch)
tree1bc05f89c36b2890e116ddf5bdbfa16905072581 /plugins
parent55245288dfd655b6b5a449d328d5a4b145d0844f (diff)
refs #5972 preselect today when clicking on annotations (when not clicked on a specific date)
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/Annotations/Annotations.php6
-rwxr-xr-xplugins/Annotations/Controller.php7
-rwxr-xr-xplugins/Annotations/templates/_annotationList.twig4
3 files changed, 14 insertions, 3 deletions
diff --git a/plugins/Annotations/Annotations.php b/plugins/Annotations/Annotations.php
index 3cdaefd10c..daf89e93a6 100755
--- a/plugins/Annotations/Annotations.php
+++ b/plugins/Annotations/Annotations.php
@@ -23,9 +23,15 @@ class Annotations extends \Piwik\Plugin
return array(
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
+ 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys',
);
}
+ public function getClientSideTranslationKeys(&$translationKeys)
+ {
+ $translationKeys[] = 'General_Today';
+ }
+
/**
* Adds css files for this plugin to the list in the event notification.
*/
diff --git a/plugins/Annotations/Controller.php b/plugins/Annotations/Controller.php
index eec7ab3b9e..9a777050f1 100755
--- a/plugins/Annotations/Controller.php
+++ b/plugins/Annotations/Controller.php
@@ -71,7 +71,12 @@ class Controller extends \Piwik\Plugin\Controller
list($startDate, $endDate) = API::getDateRangeForPeriod($date, $period, $lastN);
$view->startDate = $startDate->toString();
$view->endDate = $endDate->toString();
- $view->today = Date::today()->toString();
+
+ if ($startDate->toString() !== $endDate->toString()) {
+ $view->selectedDate = Date::today()->toString();
+ } else {
+ $view->selectedDate = $endDate->toString();
+ }
$dateFormat = Piwik::translate('CoreHome_ShortDateFormatWithYear');
$view->startDatePretty = $startDate->getLocalized($dateFormat);
diff --git a/plugins/Annotations/templates/_annotationList.twig b/plugins/Annotations/templates/_annotationList.twig
index c9868fa0dd..6628400519 100755
--- a/plugins/Annotations/templates/_annotationList.twig
+++ b/plugins/Annotations/templates/_annotationList.twig
@@ -8,11 +8,11 @@
{% for annotation in annotations %}
{% include "@Annotations/_annotation.twig" %}
{% endfor %}
- <tr class="new-annotation-row" style="display:none;" data-date="{{ endDate }}">
+ <tr class="new-annotation-row" style="display:none;" data-date="{{ selectedDate }}">
<td class="annotation-meta">
<div class="annotation-star">&nbsp;</div>
<div class="annotation-period-edit">
- <a href="#">{{ endDate }}</a>
+ <a href="#">{{ selectedDate }}</a>
<div class="datepicker" style="display:none;"/>
</div>