Skip to content

Commit

Permalink
refs #57 some more adjustments to the widgets and added a less file
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteur committed Mar 4, 2014
1 parent 5adae48 commit 8601c09
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 17 deletions.
10 changes: 6 additions & 4 deletions plugins/Insights/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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
);
Expand Down
6 changes: 6 additions & 0 deletions plugins/Insights/Insights.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function getListHooksRegistered()
return array(
'WidgetsList.addWidgets' => 'addWidgets',
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
'AssetManager.getStylesheetFiles' => 'getStylesheetFiles',
'ViewDataTable.addViewDataTable' => 'getAvailableVisualizations'
);
}
Expand All @@ -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";
Expand Down
3 changes: 2 additions & 1 deletion plugins/Insights/lang/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"Insights": {
"OverviewWidgetTitle": "Insights Overview",
"Category": "Insights"
"Category": "Insights",
"NoResultMatchesCriteria": "No rows match the criteria"
}
}
28 changes: 28 additions & 0 deletions plugins/Insights/stylesheets/insightVisualization.less
Original file line number Diff line number Diff line change
@@ -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;
}
}
23 changes: 11 additions & 12 deletions plugins/Insights/templates/insightVisualization.twig
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<div>
<div class="insightsDataTable">
{% if dataTable.getRowsCount > 0 %}
<table class="dataTable">
<thead>
<tr title="based on {{ dataTable.getMetadata('totalValue') }} {{ dataTable.getMetadata('metricName') }}, rows less than {{ dataTable.getMetadata('minVisits') }} {{ dataTable.getMetadata('metricName') }} were ignored">
<th class="label" style="width:60%;">
<tr title="Based on {{ dataTable.getMetadata('totalValue') }} {{ dataTable.getMetadata('metricName') }}, rows less than {{ dataTable.getMetadata('minVisits') }} {{ dataTable.getMetadata('metricName') }} were ignored">
<th class="label">
{{ dataTable.getMetadata('reportName') }}
</th>
<th class="label" name="orderBy" value="absolute"
style="width:20%;cursor:pointer;{% if 'absolute' == properties.order_by %}font-weight:bold;{% endif %}"
>
<th class="label orderBy" name="orderBy" value="absolute"
style="{% if 'absolute' == properties.order_by %}font-weight:bold;{% endif %}">
{{ dataTable.getMetadata('metricName') }}
</th>
<th class="label" name="orderBy" value="relative"
style="width:20%;cursor:pointer;{% if 'relative' == properties.order_by %}font-weight:bold;{% endif %}">
<th class="label orderBy" name="orderBy" value="relative"
style="{% if 'relative' == properties.order_by %}font-weight:bold;{% endif %}">
{{ 'MultiSites_Evolution'|translate }}
</th>
</tr>
Expand All @@ -22,19 +21,19 @@
{% for row in dataTable.getRows %}
<tr title="{{ dataTable.getMetadata('metricName') }} changed from {{ row.getColumn('value_old') }} ({{ dataTable.getMetadata('lastDate') }}) to {{ row.getColumn('value_new') }} ({{ dataTable.getMetadata('date') }})">
<td>
<span style="word-break: break-all;overflow: hidden;text-overflow: ellipsis;width: inherit;padding-right: 10px;display: block;"
<span class="title"
title="{{ row.getColumn('label') }}">
{{ row.getColumn('label') }}
</span>
</td>
{% if row.getColumn('grown') %}
<td>+{{ row.getColumn('difference') }}</td>
<td style="color:green">
<td class="grown">
+{{ row.getColumn('growth_percent') }}
</td>
{% else %}
<td>{{ row.getColumn('difference') }}</td>
<td style="color:red">
<td class="notGrown">
{{ row.getColumn('growth_percent') }}
</td>
{% endif %}
Expand All @@ -45,7 +44,7 @@
</table>
{% elseif showNoDataMessage %}
<div class="pk-emptyDataTable">
No rows match the criteria
{{ 'Insights_NoResultMatchesCriteria'|translate }}
</div>
{% endif %}

Expand Down

0 comments on commit 8601c09

Please sign in to comment.