New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various Api Improvements #10665
Various Api Improvements #10665
Changes from 5 commits
3845b7b
b6b97cd
7f3afcd
c6e6fea
2988260
cb36cba
8089672
ac0faa7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,6 @@ | |
* | ||
*/ | ||
namespace Piwik\Report; | ||
use Piwik\ViewDataTable\Factory; | ||
use Piwik\Widget\WidgetConfig; | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ | |
use Exception; | ||
use Piwik\API\Request; | ||
use Piwik\Common; | ||
use Piwik\DataTable\Renderer\Json; | ||
use Piwik\Date; | ||
use Piwik\FrontController; | ||
use Piwik\Notification\Manager as NotificationManager; | ||
|
@@ -29,6 +28,7 @@ | |
use Piwik\Url; | ||
use Piwik\View; | ||
use Piwik\ViewDataTable\Manager as ViewDataTableManager; | ||
use Piwik\Widget\WidgetConfig; | ||
|
||
class Controller extends \Piwik\Plugin\Controller | ||
{ | ||
|
@@ -86,7 +86,33 @@ public function renderWidget($widget) | |
{ | ||
Piwik::checkUserHasSomeViewAccess(); | ||
|
||
return $widget->render(); | ||
$config = new WidgetConfig(); | ||
$widget::configure($config); | ||
|
||
$content = $widget->render(); | ||
|
||
if ($config->getName() && Common::getRequestVar('showtitle', '', 'string') === '1') { | ||
if (strpos($content, '<h2') !== false | ||
|| strpos($content, ' content-title=') !== false | ||
|| strpos($content, ' piwik-enriched-headline') !== false | ||
|| strpos($content, '<h1') !== false ) { | ||
// already includes title | ||
return $content; | ||
} | ||
|
||
if (strpos($content, 'piwik-content-block') === false | ||
&& strpos($content, 'class="card"') === false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might not detect in all cases whether someone is using the card css class manually but developers should not do this anyway, they should use piwik-content-block. So it's fine if someone was using |
||
&& strpos($content, "class='card'") === false | ||
&& strpos($content, 'class="card-content"') === false | ||
&& strpos($content, "class='card-content'") === false) { | ||
$view = new View('@CoreHome/_singleWidget'); | ||
$view->title = $config->getName(); | ||
$view->content = $content; | ||
return $view->render(); | ||
} | ||
} | ||
|
||
return $content; | ||
} | ||
|
||
function redirectToCoreHomeIndex() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,11 @@ | |
return true; | ||
} | ||
|
||
return widget.viewDataTable && widget.viewDataTable === 'tableAllColumns'; | ||
if ('undefined' !== typeof widget.isWide && widget.isWide) { | ||
return true; | ||
} | ||
|
||
return widget.viewDataTable && (widget.viewDataTable === 'tableAllColumns' || widget.viewDataTable === 'sparklines' || widget.viewDataTable === 'graphEvolution'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we always display them full width |
||
} | ||
|
||
function buildPage(page) | ||
|
@@ -69,13 +73,7 @@ | |
|
||
reportsToIgnore = reportsToIgnore.concat(getRelatedReports(widget)); | ||
|
||
if (widget.viewDataTable && widget.viewDataTable === 'graphEvolution') { | ||
evolutionReports.push(widget); | ||
} else if (widget.viewDataTable && widget.viewDataTable === 'sparklines') { | ||
sparklineReports.push(widget); | ||
} else { | ||
widgets.push(widget); | ||
} | ||
widgets.push(widget); | ||
}); | ||
|
||
widgets = sortWidgets(widgets); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ | |
} | ||
|
||
.goalEntry { | ||
border-bottom: 0px; | ||
border-bottom: 0; | ||
} | ||
|
||
.relatedReferrerReports { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we can see the benefit of rendering widget headlines automatically now, we do not have to define the title twice, we automatically use the widget title defined in the widget