Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Morpheus/javascripts/piwikHelper.js')
-rw-r--r--plugins/Morpheus/javascripts/piwikHelper.js32
1 files changed, 24 insertions, 8 deletions
diff --git a/plugins/Morpheus/javascripts/piwikHelper.js b/plugins/Morpheus/javascripts/piwikHelper.js
index 32e2c5c6d3..36eed1c685 100644
--- a/plugins/Morpheus/javascripts/piwikHelper.js
+++ b/plugins/Morpheus/javascripts/piwikHelper.js
@@ -109,8 +109,9 @@ var piwikHelper = {
*
* @param selector
* @param {object} options
- * @param {object} options.scope if supplied, a new isolate scope is created as the parent scope of the
- * compiled angular components. The properties in this object are
+ * @param {object} options.scope if supplied, the given scope will be used when compiling the template. Shouldn't
+ * be a plain object but an actual angular scope.
+ * @param {object} options.params if supplied, the properties in this object are
* added to the new scope.
*/
compileAngularComponents: function (selector, options) {
@@ -122,15 +123,19 @@ var piwikHelper = {
return;
}
- angular.element(document).injector().invoke(function($compile) {
- var scope = angular.element($element).scope();
+ angular.element(document).injector().invoke(function($compile, $rootScope) {
+ var scope = null;
+ if (options.scope) {
+ scope = options.scope;
+ } else {
+ scope = angular.element($element).scope();
+ }
if (!scope) {
- return;
+ scope = $rootScope.$new(true);
}
- if (options.scope) {
- scope = scope.$new(true);
- $.extend(scope, options.scope);
+ if (options.params) {
+ $.extend(scope, options.params);
}
$compile($element)(scope);
@@ -249,9 +254,20 @@ var piwikHelper = {
delete options.fixedFooter;
}
+ if (options && options.extraWide) {
+ // if given, the modal will be shown larger than usual and almost consume the full width.
+ $content.addClass('modal-extra-wide');
+ delete options.extraWide;
+ }
+
if (options && !options.ready) {
options.ready = function () {
$(".modal.open a").focus();
+ var modalContent = $(".modal.open");
+ if (modalContent && modalContent[0]) {
+ // make sure to scroll to the top of the content
+ modalContent[0].scrollTop = 0;
+ }
};
}