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/CoreHome/angularjs/progressbar/progressbar.directive.js')
-rw-r--r--plugins/CoreHome/angularjs/progressbar/progressbar.directive.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/plugins/CoreHome/angularjs/progressbar/progressbar.directive.js b/plugins/CoreHome/angularjs/progressbar/progressbar.directive.js
new file mode 100644
index 0000000000..445fa1d021
--- /dev/null
+++ b/plugins/CoreHome/angularjs/progressbar/progressbar.directive.js
@@ -0,0 +1,54 @@
+/*!
+ * 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-progressbar>
+ */
+(function () {
+ angular.module('piwikApp').directive('piwikProgressbar', piwikProgressbar);
+
+ piwikProgressbar.$inject = ['piwik'];
+
+ function piwikProgressbar(piwik){
+ var defaults = {
+ label: '',
+ progress: 0
+ };
+
+ return {
+ restrict: 'A',
+ scope: {
+ progress: '=',
+ label: '='
+ },
+ templateUrl: 'plugins/CoreHome/angularjs/progressbar/progressbar.directive.html?cb=' + piwik.cacheBuster,
+ compile: function (element, attrs) {
+
+ for (var index in defaults) {
+ if (defaults.hasOwnProperty(index) && attrs[index] === undefined) {
+ attrs[index] = defaults[index];
+ }
+ }
+
+ return function (scope, element, attrs) {
+
+ scope.$watch('progress', function (val, oldVal) {
+ if (val !== oldVal) {
+ if (val > 100) {
+ scope.progress = 100;
+ } else if (val < 0) {
+ scope.progress = 0;
+ }
+ }
+ });
+
+ };
+ }
+ };
+ }
+})(); \ No newline at end of file