// Code review

This commit is contained in:
Damien Metzger
2013-10-24 17:49:18 +02:00
parent 1a7f9e6c11
commit f6dd4a9ee4
8 changed files with 74 additions and 56 deletions
+1 -1
View File
@@ -86,7 +86,7 @@ class Dashactivity extends Module
$this->context->smarty->assign(array_merge(array(
'gapi_mode' => $gapi_mode,
'dashactivity_config_form' => $this->renderConfigForm(),
'date_subtitle' => $this->l('from %s to %s'),
'date_subtitle' => $this->l('(from %s to %s)'),
'date_format' => $this->context->language->date_format_lite
), $this->getConfigFieldsValues()));
return $this->display(__FILE__, 'dashboard_zone_one.tpl');
@@ -103,7 +103,7 @@ Date.prototype.format = function(format) {
$(document).ready(function() {
if (date_subtitle === undefined)
date_subtitle = 'From %s to %s';
date_subtitle = '(from %s to %s)';
if (date_format === undefined)
date_format = 'Y-m-d';
@@ -158,7 +158,7 @@
{if $gapi_mode}
<li>
<span class="data_label">
<a href="{$link->getAdminLink('AdminModules')}&{$gapi_mode}=gapi"><img src="../modules/gapi/logo.gif" width="16" height="16" /> {l s="Connect to Google Analytics API" mod="dashactivity"}</a>
<a href="{$link->getAdminLink('AdminModules')}&{$gapi_mode}=gapi"><img src="../modules/gapi/logo.gif" width="16" height="16" /> {l s="Link to your Google Analytics account" mod="dashactivity"}</a>
</span>
</li>
{/if}
+1 -1
View File
@@ -103,7 +103,7 @@ class Dashgoals extends Module
$month_row['values'][$type] = ConfigurationKPI::get(strtoupper($key));
}
$this->context->smarty->assign('currency_code', $this->context->currency->iso_code);
$this->context->smarty->assign('currency', $this->context->currency);
$this->context->smarty->assign('goals_year', $year);
$this->context->smarty->assign('goals_months', $months);
return $this->display(__FILE__, 'dashboard_zone_two.tpl');
+2 -2
View File
@@ -22,9 +22,9 @@ function dashgoals_calc_sales()
var key = $(this).attr('id').substr(16);
var sales = parseFloat($('#dashgoals_traffic_' + key).val()) * parseFloat($('#dashgoals_avg_cart_value_' + key).val()) * parseFloat($('#dashgoals_conversion_' + key).val()) / 100;
if (isNaN(sales))
$(this).text('0');
$(this).text(formatCurrency(0, currency_format, currency_sign, currency_blank));
else
$(this).text(parseInt(sales));
$(this).text(formatCurrency(parseInt(sales), currency_format, currency_sign, currency_blank));
});
}
@@ -23,6 +23,13 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<script>
var currency_format = {$currency->format|intval};
var currency_sign = '{$currency->sign|addslashes}';
var currency_blank = {$currency->blank|intval};
var priceDisplayPrecision = 0;
</script>
<section id="dashgoals" class="panel widget">
<header class="panel-heading">
<i class="icon-bar-chart"></i> {l s='Goals' mod='dashgoals'}
@@ -55,8 +62,10 @@
{$month.label}
</td>
<td>
<input id="dashgoals_traffic_{$month@key}" name="dashgoals_traffic_{$month@key}" class="dashgoals_config_input form-control"
value="{$month.values.traffic|intval}" />
<div class="input-group">
<input id="dashgoals_traffic_{$month@key}" name="dashgoals_traffic_{$month@key}" class="dashgoals_config_input form-control"
value="{$month.values.traffic|intval}" />
</div>
</td>
<td>
<div class="input-group">
@@ -67,7 +76,7 @@
</td>
<td>
<div class="input-group">
<span class="input-group-addon">{$currency_code|escape}</span>
<span class="input-group-addon">{$currency->iso_code|escape}</span>
<input id="dashgoals_avg_cart_value_{$month@key}" name="dashgoals_avg_cart_value_{$month@key}" class="dashgoals_config_input form-control"
value="{$month.values.avg_cart_value|intval}" />
</div>