Navigation Menu

Skip to content
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

Merged
merged 8 commits into from Oct 5, 2016
Merged

Various Api Improvements #10665

merged 8 commits into from Oct 5, 2016

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Oct 4, 2016

The changes were needed in order to make some plugins compatible with Piwik 3:

  • Let a widget decide whether it should be shown full width in the UI (wide) or not.
    Background: By default, when there are two widgets on one page, the layout will automatically show them next to each other. However, sometimes a widget might need to be shown full width even when there is more than one widget on a page. I found "wide" better than "full width" property as we might not show it full width
  • New event Segment.addSegments similar to Widget.addWidgetConfigs, Report.addReports, etc
  • Render widget title automatically if not done by the widget. This is useful when a plugin developer defines a widget that should not only be displayed in the dashboard but also in the reporting UI or somewhere else. If the UI decides it needs a title (&showtitle=1) and the widget does not define it, it will automatically make a card with a title out of the widget. This ensures the widget will be shown properly in the dashboard and somewhere else. Otherwise the developer would need to handle this manually and detect whether it is shown in the reporting UI and depending on this render content differently etc.
  • Removed "Magic" for evolution and sparkline views. In the past, we hard coded to show evolution and sparklines at the very top of the page. I thought this was good as it ensures a constistent look across reporting pages. However, it is a problem when someone wants to show content above an evolution graph which was not possible but is now.
  • Added support for new form field attributes placeholder and rows
  • New feature: If we find a metric documentation for a sparkline, in the sparklines widget, we automatically show on hover a help text explaining what the metric is about

The changes are all in one PR as I'm making some plugins compatible and I need all the changes together in order to make them compatible.

@tsteur tsteur added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Oct 4, 2016
@tsteur tsteur added this to the 3.0.0-b1 milestone Oct 4, 2016
<div piwik-content-block content-title="Piwik.org Blog">
<div piwik-widget-loader='{"module":"RssWidget","action":"rssPiwik"}'></div>
</div>
<div piwik-widget-loader='{"module":"RssWidget","action":"rssPiwik"}'></div>
Copy link
Member Author

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

}

if (strpos($content, 'piwik-content-block') === false
&& strpos($content, 'class="card"') === false
Copy link
Member Author

Choose a reason for hiding this comment

The 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 class=" card test"

return true;
}

return widget.viewDataTable && (widget.viewDataTable === 'tableAllColumns' || widget.viewDataTable === 'sparklines' || widget.viewDataTable === 'graphEvolution');
Copy link
Member Author

@tsteur tsteur Oct 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we always display them full width

@tsteur tsteur merged commit d01b279 into 3.x-dev Oct 5, 2016
@tsteur tsteur deleted the apiimprovements branch October 5, 2016 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant