From 67d72f90522b6face4e044f0a2e0d1fd1aef610e Mon Sep 17 00:00:00 2001 From: benakamoorthi Date: Tue, 18 Dec 2012 23:36:08 +0000 Subject: Fixes #1253, fix bug where resizing element does not reposition evolution icons and tweak translation keys. git-svn-id: http://dev.piwik.org/svn/trunk@7650 59fd770c-687e-43c8-a1e3-f5a4ff64c105 --- .../Annotations/templates/annotationManager.tpl | 2 +- plugins/Annotations/templates/annotations.js | 26 +++++++++++++++++++++- .../Annotations/templates/evolutionAnnotations.tpl | 4 ++-- 3 files changed, 28 insertions(+), 4 deletions(-) (limited to 'plugins/Annotations/templates') diff --git a/plugins/Annotations/templates/annotationManager.tpl b/plugins/Annotations/templates/annotationManager.tpl index 7ba893a972..852c09bbc4 100755 --- a/plugins/Annotations/templates/annotationManager.tpl +++ b/plugins/Annotations/templates/annotationManager.tpl @@ -18,7 +18,7 @@
{if $canUserAddNotes} - {'Annotations_CreateNewAnnotation'|translate} + {'Annotations_CreateNewAnnotation'|translate} {elseif $userLogin eq 'anonymous'} {'Annotations_LoginToAnnotate'|translate} {/if} diff --git a/plugins/Annotations/templates/annotations.js b/plugins/Annotations/templates/annotations.js index 925c652567..447df6a2e5 100755 --- a/plugins/Annotations/templates/annotations.js +++ b/plugins/Annotations/templates/annotations.js @@ -589,9 +589,33 @@ var showAnnotationViewer = function(domElem, idSite, date, period, lastN, callba } }; -// make showAnnotationViewer & annotationsApi globally accessible +/** + * Determines the x-coordinates of a set of evolution annotation icons. + * + * @param {Element} annotations The '.evolution-annotations' element. + * @param {Element} graphElem The evolution graph's datatable element. + */ +var placeEvolutionIcons = function (annotations, graphElem) +{ + var canvases = $('.piwik-graph .jqplot-xaxis canvas', graphElem), + noteSize = 16; + + // set position of each individual icon + $('span', annotations).each(function(i) { + var canvas = $(canvases[i]), + canvasCenterX = canvas.position().left + (canvas.width() / 2); + $(this).css({ + left: canvasCenterX - noteSize / 2, + // show if there are annotations for this x-axis tick + opacity: +$(this).attr('data-count') > 0 ? 1 : 0 + }); + }); +}; + +// make showAnnotationViewer, placeEvolutionIcons & annotationsApi globally accessible piwik.annotations = { showAnnotationViewer: showAnnotationViewer, + placeEvolutionIcons: placeEvolutionIcons, api: annotationsApi }; diff --git a/plugins/Annotations/templates/evolutionAnnotations.tpl b/plugins/Annotations/templates/evolutionAnnotations.tpl index 5248bddbf2..50a7479797 100755 --- a/plugins/Annotations/templates/evolutionAnnotations.tpl +++ b/plugins/Annotations/templates/evolutionAnnotations.tpl @@ -3,8 +3,8 @@ {assign var=date value=$dateCountPair[0]} {assign var=counts value=$dateCountPair[1]} -- cgit v1.2.3