Skip to content
Extraits de code Groupes Projets
Valider fc0f1e73 rédigé par Stefan Giehl's avatar Stefan Giehl Validation de GitHub
Parcourir les fichiers

Make it possible to show a header message for datatables (#12146)

* Make it possible to show a header message for datatables

* update changelog

* add comment that messages will be printed raw
parent 6ec19d16
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -13,6 +13,7 @@ The Product Changelog at **[piwik.org/changelog](https://piwik.org/changelog)** ...@@ -13,6 +13,7 @@ The Product Changelog at **[piwik.org/changelog](https://piwik.org/changelog)**
### New APIs ### New APIs
* Reports and visualizations can now hide the export icons with a new property `$view->config->show_export`. * Reports and visualizations can now hide the export icons with a new property `$view->config->show_export`.
* Reports and visualizations can now show a message above the report with a new property `$view->config->show_header_message`.
* The following events have been added: * The following events have been added:
* `Metric.addMetrics` Triggered to add new metrics that cannot be picked up automatically by the platform. * `Metric.addMetrics` Triggered to add new metrics that cannot be picked up automatically by the platform.
* `Metric.addComputedMetrics` Triggered to add computed metrics that are not generated automatically * `Metric.addComputedMetrics` Triggered to add computed metrics that are not generated automatically
......
...@@ -38,6 +38,7 @@ use Piwik\API\Request as ApiRequest; ...@@ -38,6 +38,7 @@ use Piwik\API\Request as ApiRequest;
* itself: * itself:
* *
* - report documentation, * - report documentation,
* - a header message (if {@link Piwik\ViewDataTable\Config::$show_header_message} is set),
* - a footer message (if {@link Piwik\ViewDataTable\Config::$show_footer_message} is set), * - a footer message (if {@link Piwik\ViewDataTable\Config::$show_footer_message} is set),
* - a list of links to related reports (if {@link Piwik\ViewDataTable\Config::$related_reports} is set), * - a list of links to related reports (if {@link Piwik\ViewDataTable\Config::$related_reports} is set),
* - a button that allows users to switch visualizations, * - a button that allows users to switch visualizations,
......
...@@ -371,8 +371,17 @@ class Config ...@@ -371,8 +371,17 @@ class Config
*/ */
public $show_ecommerce = false; public $show_ecommerce = false;
/**
* Stores an HTML message (if any) to display above the datatable view.
*
* Attention: Message will be printed raw. Don't forget to escape where needed!
*/
public $show_header_message = false;
/** /**
* Stores an HTML message (if any) to display under the datatable view. * Stores an HTML message (if any) to display under the datatable view.
*
* Attention: Message will be printed raw. Don't forget to escape where needed!
*/ */
public $show_footer_message = false; public $show_footer_message = false;
......
...@@ -183,7 +183,7 @@ table.dataTable img { ...@@ -183,7 +183,7 @@ table.dataTable img {
position: absolute; position: absolute;
} }
.datatableFooterMessage { .datatableHeaderMessage, .datatableFooterMessage {
color: #888; color: #888;
text-align: left; text-align: left;
margin: 10px; margin: 10px;
......
...@@ -49,6 +49,10 @@ ...@@ -49,6 +49,10 @@
{% if error is defined %} {% if error is defined %}
{{ error.message }} {{ error.message }}
{% else %} {% else %}
{% if properties.show_header_message is defined and properties.show_header_message is not empty %}
<div class='datatableHeaderMessage'>{{ properties.show_header_message | raw }}</div>
{% endif %}
{% if isDataTableEmpty %} {% if isDataTableEmpty %}
<div class="pk-emptyDataTable"> <div class="pk-emptyDataTable">
{% if showReportDataWasPurgedMessage is defined and showReportDataWasPurgedMessage %} {% if showReportDataWasPurgedMessage is defined and showReportDataWasPurgedMessage %}
......
...@@ -140,8 +140,10 @@ ...@@ -140,8 +140,10 @@
background-color: @theme-color-widget-background; background-color: @theme-color-widget-background;
} }
.widget .datatableFooterMessage { .widget {
padding-left: 12px; .datatableHeaderMessage, .datatableFooterMessage {
padding-left: 12px;
}
} }
.bar-graph-colors[data-name=grid-background] { .bar-graph-colors[data-name=grid-background] {
......
...@@ -510,7 +510,7 @@ div.sparkline { ...@@ -510,7 +510,7 @@ div.sparkline {
color: @theme-color-text; color: @theme-color-text;
} }
.datatableFooterMessage { .datatableHeaderMessage, .datatableFooterMessage {
.font-default(13px, 18px); .font-default(13px, 18px);
color: @color-silver; color: @color-silver;
font-weight: normal; font-weight: normal;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter