diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2016-12-06 14:45:35 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2016-12-06 14:45:35 +0300 |
commit | 3cf2f077022856a7dd40a444849d7e88e1cf0367 (patch) | |
tree | e225dd1a581e3353342f50f07f6329d020e21372 /plugins/Marketplace | |
parent | 5b94ec76e74c3ce74b99690f92b5d5b2b489e9da (diff) |
Add new marketplace widget and fixed some urls (#10967)
* added new marketplace widget and fixed some urls
* translate widget
* fix system test
* add some spacing
Diffstat (limited to 'plugins/Marketplace')
6 files changed, 104 insertions, 5 deletions
diff --git a/plugins/Marketplace/Widgets/GetNewPlugins.php b/plugins/Marketplace/Widgets/GetNewPlugins.php index 6079c1a8e8..8ffc54b856 100644 --- a/plugins/Marketplace/Widgets/GetNewPlugins.php +++ b/plugins/Marketplace/Widgets/GetNewPlugins.php @@ -10,6 +10,7 @@ namespace Piwik\Plugins\Marketplace\Widgets; use Piwik\Common; use Piwik\Plugins\Marketplace\Api\Client; +use Piwik\Plugins\Marketplace\Input\PurchaseType; use Piwik\Plugins\Marketplace\Input\Sort; use Piwik\Widget\Widget; use Piwik\Widget\WidgetConfig; @@ -43,7 +44,7 @@ class GetNewPlugins extends Widget $template = 'getNewPlugins'; } - $plugins = $this->marketplaceApiClient->searchForPlugins('', '', Sort::METHOD_LAST_UPDATED, ''); + $plugins = $this->marketplaceApiClient->searchForPlugins('', '', Sort::METHOD_LAST_UPDATED, PurchaseType::TYPE_ALL); return $this->renderTemplate($template, array( 'plugins' => array_splice($plugins, 0, 3) diff --git a/plugins/Marketplace/Widgets/GetPremiumFeatures.php b/plugins/Marketplace/Widgets/GetPremiumFeatures.php new file mode 100644 index 0000000000..4e777a218f --- /dev/null +++ b/plugins/Marketplace/Widgets/GetPremiumFeatures.php @@ -0,0 +1,56 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\Marketplace\Widgets; + +use Piwik\Common; +use Piwik\Piwik; +use Piwik\Plugin; +use Piwik\Plugins\Marketplace\Api\Client; +use Piwik\Plugins\Marketplace\Input\PurchaseType; +use Piwik\Plugins\Marketplace\Input\Sort; +use Piwik\Widget\Widget; +use Piwik\Widget\WidgetConfig; + +class GetPremiumFeatures extends Widget +{ + /** + * @var Client + */ + private $marketplaceApiClient; + + public function __construct(Client $marketplaceApiClient) + { + $this->marketplaceApiClient = $marketplaceApiClient; + } + + public static function configure(WidgetConfig $config) + { + $config->setCategoryId('About Piwik'); + $config->setName(Piwik::translate('Marketplace_PaidPlugins')); + $config->setOrder(20); + } + + public function render() + { + $template = 'getPremiumFeatures'; + + $plugins = $this->marketplaceApiClient->searchForPlugins('', '', Sort::METHOD_LAST_UPDATED, PurchaseType::TYPE_PAID); + + if (empty($plugins)) { + $plugins = array(); + } else { + $plugins = array_splice($plugins, 0, 20); + } + + return $this->renderTemplate($template, array( + 'plugins' => $plugins + )); + } + +}
\ No newline at end of file diff --git a/plugins/Marketplace/stylesheets/marketplace-widget.less b/plugins/Marketplace/stylesheets/marketplace-widget.less index 3438983825..33508cdb24 100644 --- a/plugins/Marketplace/stylesheets/marketplace-widget.less +++ b/plugins/Marketplace/stylesheets/marketplace-widget.less @@ -4,6 +4,25 @@ } } +.getPremiumFeatures { + h3 { + margin-top: 0; + } + .pluginBody { + margin-bottom: 32px; + display: inline-block; + + .pluginMoreDetails { + line-height:3em; + } + } + + .row { + margin-left: -12px; + margin-right: -12px; + } +} + .getNewPlugins { .pluginName { cursor: pointer; diff --git a/plugins/Marketplace/templates/getNewPlugins.twig b/plugins/Marketplace/templates/getNewPlugins.twig index 0c68e552e3..9808a72ce6 100644 --- a/plugins/Marketplace/templates/getNewPlugins.twig +++ b/plugins/Marketplace/templates/getNewPlugins.twig @@ -3,7 +3,7 @@ {% for plugin in plugins %} <div class="col s12"> - <h3 class="pluginName" piwik-plugin-name="{{ plugin.name|e('html_attr') }}">{{ plugin.name }}</h3> + <h3 class="pluginName" piwik-plugin-name="{{ plugin.name|e('html_attr') }}">{{ plugin.displayName }}</h3> <span> {{ plugin.description }} <br /> @@ -16,7 +16,7 @@ </div> <div class="widgetBody"> - <a href="{{ linkTo({'module': 'CorePluginsAdmin', 'action': 'marketplace'}) }}" + <a href="{{ linkTo({'module': 'Marketplace', 'action': 'overview'}) }}" >{{ 'CorePluginsAdmin_ViewAllMarketplacePlugins'|translate }}</a> </div> </div>
\ No newline at end of file diff --git a/plugins/Marketplace/templates/getNewPluginsAdmin.twig b/plugins/Marketplace/templates/getNewPluginsAdmin.twig index b929a48430..1e3d60f647 100644 --- a/plugins/Marketplace/templates/getNewPluginsAdmin.twig +++ b/plugins/Marketplace/templates/getNewPluginsAdmin.twig @@ -5,7 +5,7 @@ <h3 class="pluginName" title="{{ plugin.description|e('html_attr') }}" - piwik-plugin-name="{{ plugin.name|e('html_attr') }}">{{ plugin.name }}</h3> + piwik-plugin-name="{{ plugin.name|e('html_attr') }}">{{ plugin.displayName }}</h3> <p class="description" title="{{ plugin.description|e('html_attr') }}">{{ plugin.description }}</p> @@ -20,7 +20,7 @@ </div> <div class="widgetBody"> - <a href="{{ linkTo({'module': 'CorePluginsAdmin', 'action': 'marketplace'}) }}" + <a href="{{ linkTo({'module': 'Marketplace', 'action': 'overview'}) }}" >{{ 'CorePluginsAdmin_ViewAllMarketplacePlugins'|translate }}</a> </div> diff --git a/plugins/Marketplace/templates/getPremiumFeatures.twig b/plugins/Marketplace/templates/getPremiumFeatures.twig new file mode 100644 index 0000000000..fa0fe83744 --- /dev/null +++ b/plugins/Marketplace/templates/getPremiumFeatures.twig @@ -0,0 +1,23 @@ +<div class="getNewPlugins getPremiumFeatures widgetBody"> + <div class="row"> + {% for plugin in plugins %} + <div class="col s12 m4"> + + <h3 class="pluginName" piwik-plugin-name="{{ plugin.name|e('html_attr') }}">{{ plugin.displayName }}</h3> + <span class="pluginBody"> + {{ plugin.description }} + <br /> + <a href="javascript:;" class="pluginMoreDetails" piwik-plugin-name="{{ plugin.name|e('html_attr') }}">{{ 'General_MoreDetails'|translate }}</a> + </span> + </div> + {% if loop.index % 3 == 0 %} + </div><div class="row"> + {% endif %} + {% endfor %} + </div> + + <div class="widgetBody"> + <a href="{{ linkTo({'module': 'Marketplace', 'action': 'overview', 'show': 'premium'}) }}" + >{{ 'CorePluginsAdmin_ViewAllMarketplacePlugins'|translate }}</a> + </div> +</div>
\ No newline at end of file |