diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2016-03-08 04:56:14 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2016-03-09 23:34:28 +0300 |
commit | 7f0fdeae8be84f2c80151e960eb02a5652bc1cbd (patch) | |
tree | f95096b26489a8ff953a751745679ed1a60fb144 /plugins/CoreHome/angularjs/widget/widget.directive.js | |
parent | 3b37fe84dd01822e48eb815a18b28ac474de96a2 (diff) |
fix many ui tests
Diffstat (limited to 'plugins/CoreHome/angularjs/widget/widget.directive.js')
-rw-r--r-- | plugins/CoreHome/angularjs/widget/widget.directive.js | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/CoreHome/angularjs/widget/widget.directive.js b/plugins/CoreHome/angularjs/widget/widget.directive.js index 86574870f2..8f2bd2e25d 100644 --- a/plugins/CoreHome/angularjs/widget/widget.directive.js +++ b/plugins/CoreHome/angularjs/widget/widget.directive.js @@ -29,16 +29,15 @@ (function () { angular.module('piwikApp').directive('piwikWidget', piwikWidget); - piwikWidget.$inject = ['piwik', 'piwikApi']; + piwikWidget.$inject = ['piwik', 'piwikApi', 'reportMetadataModel']; - function piwikWidget(piwik, piwikApi){ + function piwikWidget(piwik, piwikApi, reportMetadataModel){ function findContainerWidget(containerId, scope) { widgetsHelper.getAvailableWidgets(function (categorizedWidgets) { angular.forEach(categorizedWidgets, function (widgets) { angular.forEach(widgets, function (widget) { - if (widget && widget.isContainer && widget.parameters.containerId === containerId) { widget = angular.copy(widget); if (scope.widgetized) { @@ -57,6 +56,16 @@ }); } + function addReportDocumentationIfPossible(widget) + { + if (widget && widget.isReport && !widget.documentation) { + var report = reportMetadataModel.findReport(widget.module, widget.action); + if (report && report.documentation) { + widget.documentation = report.documentation; + } + } + } + function applyMiddleware(scope) { if (!scope.widget.middlewareParameters) { @@ -82,6 +91,7 @@ return function (scope, element, attrs, ngModel) { if (scope.widget) { + addReportDocumentationIfPossible(scope.widget); applyMiddleware(scope); } else if (attrs.containerid) { findContainerWidget(attrs.containerid, scope); |