From 8601c094bd1b0e4dbf80877ea7d00ad831a1b7ba Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Tue, 4 Mar 2014 05:25:56 +0100 Subject: [PATCH] refs #57 some more adjustments to the widgets and added a less file --- plugins/Insights/API.php | 10 ++++--- plugins/Insights/Insights.php | 6 ++++ plugins/Insights/lang/en.json | 3 +- .../stylesheets/insightVisualization.less | 28 +++++++++++++++++++ .../templates/insightVisualization.twig | 23 ++++++++------- 5 files changed, 53 insertions(+), 17 deletions(-) create mode 100644 plugins/Insights/stylesheets/insightVisualization.less diff --git a/plugins/Insights/API.php b/plugins/Insights/API.php index 08eedc1f557..f29d301c7ad 100644 --- a/plugins/Insights/API.php +++ b/plugins/Insights/API.php @@ -39,10 +39,13 @@ public function getInsightsOverview($idSite, $period, $date) $reports = array( 'Actions_getPageUrls', 'Actions_getPageTitles', + 'Actions_getDownloads', + 'Referrers_getAll', 'Referrers_getKeywords', 'Referrers_getCampaigns', - 'Referrers_getAll', - 'Referrers_getSearchEngines' + 'Referrers_getSocials', + 'Referrers_getSearchEngines', + 'UserCountry_getCountry', ); // post event to add other reports? @@ -75,7 +78,7 @@ public function getInsightsOverview($idSite, $period, $date) } public function getInsightOverview($idSite, $period, $date, $reportUniqueId, $segment = false, $limitIncreaser = 4, - $limitDecreaser = 4, $minVisitsPercent = 2, $minGrowthPercent = 20, $orderBy = 'absolute', + $limitDecreaser = 4, $minVisitsPercent = 3, $minGrowthPercent = 25, $orderBy = 'absolute', $considerMovers = true, $considerNew = true, $considerDisappeared = false) { Piwik::checkUserHasViewAccess(array($idSite)); @@ -161,7 +164,6 @@ private function requestReport($idSite, $period, $date, $report, $metric, $segme 'idSite' => $idSite, 'period' => $period, 'date' => $date, - 'flat' => 0, 'filter_limit' => 1000, 'showColumns' => $metric ); diff --git a/plugins/Insights/Insights.php b/plugins/Insights/Insights.php index dacd4d2cd34..1753b32aa8c 100644 --- a/plugins/Insights/Insights.php +++ b/plugins/Insights/Insights.php @@ -22,6 +22,7 @@ public function getListHooksRegistered() return array( 'WidgetsList.addWidgets' => 'addWidgets', 'AssetManager.getJavaScriptFiles' => 'getJsFiles', + 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', 'ViewDataTable.addViewDataTable' => 'getAvailableVisualizations' ); } @@ -36,6 +37,11 @@ public function addWidgets() WidgetsList::add('Insights_Category', 'Insights_OverviewWidgetTitle', 'Insights', 'getInsightOverview'); } + public function getStylesheetFiles(&$stylesheets) + { + $stylesheets[] = "plugins/Insights/stylesheets/insightVisualization.less"; + } + public function getJsFiles(&$jsFiles) { $jsFiles[] = "plugins/Insights/javascripts/insightsDataTable.js"; diff --git a/plugins/Insights/lang/en.json b/plugins/Insights/lang/en.json index e56aa7a470b..acc356241a8 100644 --- a/plugins/Insights/lang/en.json +++ b/plugins/Insights/lang/en.json @@ -1,6 +1,7 @@ { "Insights": { "OverviewWidgetTitle": "Insights Overview", - "Category": "Insights" + "Category": "Insights", + "NoResultMatchesCriteria": "No rows match the criteria" } } \ No newline at end of file diff --git a/plugins/Insights/stylesheets/insightVisualization.less b/plugins/Insights/stylesheets/insightVisualization.less new file mode 100644 index 00000000000..b559c9e36a7 --- /dev/null +++ b/plugins/Insights/stylesheets/insightVisualization.less @@ -0,0 +1,28 @@ +.dataTableVizInsight { + th.orderBy { + cursor:pointer; + } +} + +.insightsDataTable { + th.orderBy { + width: 20%; + } + + .title { + word-break: break-all; + overflow: hidden; + text-overflow: ellipsis; + width: inherit; + padding-right: 10px; + display: block; + } + + .grown { + color:green; + } + + .notGrown { + color:red; + } +} \ No newline at end of file diff --git a/plugins/Insights/templates/insightVisualization.twig b/plugins/Insights/templates/insightVisualization.twig index 3ff3466a220..9c9f72c479c 100644 --- a/plugins/Insights/templates/insightVisualization.twig +++ b/plugins/Insights/templates/insightVisualization.twig @@ -1,18 +1,17 @@ -
+
{% if dataTable.getRowsCount > 0 %} - - + - - @@ -22,19 +21,19 @@ {% for row in dataTable.getRows %} {% if row.getColumn('grown') %} - {% else %} - {% endif %} @@ -45,7 +44,7 @@
+
{{ dataTable.getMetadata('reportName') }} + {{ dataTable.getMetadata('metricName') }} + {{ 'MultiSites_Evolution'|translate }}
- {{ row.getColumn('label') }} +{{ row.getColumn('difference') }} + +{{ row.getColumn('growth_percent') }} {{ row.getColumn('difference') }} + {{ row.getColumn('growth_percent') }}
{% elseif showNoDataMessage %}
- No rows match the criteria + {{ 'Insights_NoResultMatchesCriteria'|translate }}
{% endif %}