diff options
-rw-r--r-- | core/View/UIControl.php | 8 | ||||
-rw-r--r-- | plugins/CoreHome/angularjs/selector/selector.directive.js | 1 | ||||
-rw-r--r-- | plugins/CoreHome/templates/_uiControl.twig | 10 | ||||
-rw-r--r-- | plugins/Dashboard/DashboardSettingsControlBase.php | 1 |
4 files changed, 16 insertions, 4 deletions
diff --git a/core/View/UIControl.php b/core/View/UIControl.php index 845d0f9d6a..dc5bca1279 100644 --- a/core/View/UIControl.php +++ b/core/View/UIControl.php @@ -60,6 +60,13 @@ class UIControl extends \Piwik\View public $cssClass = ""; /** + * HTML Attributes for the root element + * + * @var string + */ + public $htmlAttributes = array(); + + /** * The inner view that renders the actual control content. * * @var View @@ -125,6 +132,7 @@ class UIControl extends \Piwik\View $this->templateVars['cssIdentifier'] = $this->cssIdentifier; $this->templateVars['cssClass'] = $this->cssClass; $this->templateVars['jsClass'] = $this->jsClass; + $this->templateVars['htmlAttributes'] = $this->htmlAttributes; $this->templateVars['jsNamespace'] = $this->jsNamespace; $this->templateVars['implOverride'] = $override; diff --git a/plugins/CoreHome/angularjs/selector/selector.directive.js b/plugins/CoreHome/angularjs/selector/selector.directive.js index eec9dda6d1..37db1d5743 100644 --- a/plugins/CoreHome/angularjs/selector/selector.directive.js +++ b/plugins/CoreHome/angularjs/selector/selector.directive.js @@ -18,6 +18,7 @@ return { restrict: 'A', link: function(scope, element, attr) { + element.find('.title').on('click', function () { element.toggleClass('expanded'); }); diff --git a/plugins/CoreHome/templates/_uiControl.twig b/plugins/CoreHome/templates/_uiControl.twig index 3be1e17be5..1f188cb691 100644 --- a/plugins/CoreHome/templates/_uiControl.twig +++ b/plugins/CoreHome/templates/_uiControl.twig @@ -1,7 +1,9 @@ <div class="{{ cssIdentifier }} {{ cssClass }}" - piwik-expand-on-click - data-props="{{ clientSideProperties|json_encode }}" - data-params="{{ clientSideParameters|json_encode }}"> - {% render implView with implOverride %} + {% for name,value in htmlAttributes %} + {{ name }}="{{ value|e('html_attr') }}" + {% endfor %} + data-props="{{ clientSideProperties|json_encode }}" + data-params="{{ clientSideParameters|json_encode }}"> +{% render implView with implOverride %} </div> <script>$(document).ready(function () { require('{{ jsNamespace }}').{{ jsClass }}.initElements(); });</script>
\ No newline at end of file diff --git a/plugins/Dashboard/DashboardSettingsControlBase.php b/plugins/Dashboard/DashboardSettingsControlBase.php index dadd780f18..c47ece211a 100644 --- a/plugins/Dashboard/DashboardSettingsControlBase.php +++ b/plugins/Dashboard/DashboardSettingsControlBase.php @@ -24,6 +24,7 @@ abstract class DashboardSettingsControlBase extends UIControl parent::__construct(); $this->cssClass = "borderedControl piwikTopControl dashboardSettings"; + $this->htmlAttributes = array('piwik-expand-on-click' => ''); $this->dashboardActions = array(); $this->generalActions = array(); } |