aboutsummaryrefslogtreecommitdiffstats
path: root/themes/default/template
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2011-07-26 19:04:50 +0000
committerrvelices <rv-github@modusoptimus.com>2011-07-26 19:04:50 +0000
commitc0bb4dfb43d05d68cb4abe69e279e91c88bd2f11 (patch)
treed82bf347d8b4a5deb8532371e7073e2692737bec /themes/default/template
parent630c4bb85e82c956053526255097f3fa706427b4 (diff)
feature 2384: improve average rating calculation (final)
git-svn-id: http://piwigo.org/svn/trunk@11839 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--themes/default/template/picture.tpl19
1 files changed, 12 insertions, 7 deletions
diff --git a/themes/default/template/picture.tpl b/themes/default/template/picture.tpl
index 6ffaa7261..d83795d58 100644
--- a/themes/default/template/picture.tpl
+++ b/themes/default/template/picture.tpl
@@ -196,13 +196,12 @@ y.callService(
{if $display_info.average_rate and isset($rate_summary)}
<tr id="Average">
- <td class="label">{'Rating'|@translate}</td>
- <td class="value" id="ratingSummary">
+ <td class="label">{'Rating score'|@translate}</td>
+ <td class="value">
{if $rate_summary.count}
- {assign var='rate_text' value='%.2f (rated %d times)'|@translate}
- {$pwg->sprintf($rate_text, $rate_summary.score, $rate_summary.count, $rate_summary.average)}
+ <span id="ratingScore">{$rate_summary.score}</span> <span id="ratingCount">({assign var='rate_text' value='%d rates'|@translate}{$pwg->sprintf($rate_text, $rate_summary.count)})</span>
{else}
- {'no rate'|@translate}
+ <span id="ratingScore">{'no rate'|@translate}</span> <span id="ratingCount"></span>
{/if}
</td>
</tr>
@@ -228,8 +227,14 @@ y.callService(
{footer_script}
var _pwgRatingAutoQueue = _pwgRatingAutoQueue||[];
_pwgRatingAutoQueue.push( {ldelim}rootUrl: '{$ROOT_URL}', image_id: {$current.id},
- updateRateText: "{'Update your rating'|@translate|@escape:'javascript'}", updateRateElement: document.getElementById("updateRate"),
- ratingSummaryText: "{'%.2f (rated %d times)'|@translate|@escape:'javascript'}", ratingSummaryElement: document.getElementById("ratingSummary"){rdelim} );
+ onSuccess : function(rating) {ldelim}
+ var e = document.getElementById("updateRate");
+ if (e) e.innerHTML = "{'Update your rating'|@translate|@escape:'javascript'}";
+ e = document.getElementById("ratingScore");
+ if (e) e.innerHTML = rating.score;
+ e = document.getElementById("ratingCount");
+ if (e) e.innerHTML = "({'%d rates'|@translate|@escape:'javascript'})".replace( "%d", rating.count);
+ {rdelim}{rdelim} );
{/footer_script}
{/strip}
</div>