diff options
Diffstat (limited to 'plugins/CoreAdminHome/angularjs/trustedhosts/trustedhosts.directive.js')
-rw-r--r-- | plugins/CoreAdminHome/angularjs/trustedhosts/trustedhosts.directive.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/plugins/CoreAdminHome/angularjs/trustedhosts/trustedhosts.directive.js b/plugins/CoreAdminHome/angularjs/trustedhosts/trustedhosts.directive.js new file mode 100644 index 0000000000..10485b8a1d --- /dev/null +++ b/plugins/CoreAdminHome/angularjs/trustedhosts/trustedhosts.directive.js @@ -0,0 +1,36 @@ +/*! + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +/** + * Usage: + * <div piwik-trusted-hosts-setting> + */ +(function () { + angular.module('piwikApp').directive('piwikTrustedHostsSetting', piwikTrustedHostsSetting); + + piwikTrustedHostsSetting.$inject = ['piwik']; + + function piwikTrustedHostsSetting(piwik){ + + return { + restrict: 'A', + transclude: true, + template: '<div ng-transclude></div>', + controller: 'TrustedHostsController', + controllerAs: 'trustedHosts', + compile: function (element, attrs) { + + return function (scope, element, attrs, controller) { + controller.hosts = []; + angular.forEach(JSON.parse(attrs.piwikTrustedHostsSetting), function (host) { + controller.hosts.push({host: host}); + }); + }; + } + }; + } +})();
\ No newline at end of file |