diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-09-25 19:30:33 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-09-25 19:30:33 +0400 |
commit | 8439a8887b0a6608064c1d0062e966e73ee230f4 (patch) | |
tree | 8950d309f1c4e5c98ef318d07816c2d02454c373 /plugins/ExamplePlugin | |
parent | 95d244e5189eb3f5490aa2c6dbf296ee1973a375 (diff) |
refs #6285 forgot to commit the actual templates
Diffstat (limited to 'plugins/ExamplePlugin')
4 files changed, 73 insertions, 0 deletions
diff --git a/plugins/ExamplePlugin/angularjs/directive-component/component.controller.js b/plugins/ExamplePlugin/angularjs/directive-component/component.controller.js new file mode 100644 index 0000000000..018b4eff6f --- /dev/null +++ b/plugins/ExamplePlugin/angularjs/directive-component/component.controller.js @@ -0,0 +1,23 @@ +/*! + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ +(function () { + angular.module('piwikApp').controller('ComponentController', ComponentController); + + ComponentController.$inject = []; + + function ComponentController() { + // remember to keep controller very simple. Create a service/factory (model) if needed + + var vm = this; + vm.myProperty = 'component'; + vm.doSomething = doSomething; + + function doSomething() { + + } + } +})();
\ No newline at end of file diff --git a/plugins/ExamplePlugin/angularjs/directive-component/component.directive.html b/plugins/ExamplePlugin/angularjs/directive-component/component.directive.html new file mode 100644 index 0000000000..45eb76c0b5 --- /dev/null +++ b/plugins/ExamplePlugin/angularjs/directive-component/component.directive.html @@ -0,0 +1,3 @@ +<div class="componentClass"> + {{ componentAs.myProperty }} +</div>
\ No newline at end of file diff --git a/plugins/ExamplePlugin/angularjs/directive-component/component.directive.js b/plugins/ExamplePlugin/angularjs/directive-component/component.directive.js new file mode 100644 index 0000000000..a05f3dc099 --- /dev/null +++ b/plugins/ExamplePlugin/angularjs/directive-component/component.directive.js @@ -0,0 +1,44 @@ +/*! + * 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-component> + */ +(function () { + angular.module('piwikApp').directive('piwikComponent', piwikComponent); + + piwikComponent.$inject = ['piwik']; + + function piwikComponent(piwik){ + var defaults = { + // showAllSitesItem: 'true' + }; + + return { + restrict: 'A', + scope: { + // showAllSitesItem: '=' + }, + templateUrl: 'plugins/ExamplePlugin/angularjs/directive-component/component.directive.html?cb=' + piwik.cacheBuster, + controller: 'ComponentController', + controllerAs: 'componentAs', + 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) { + + }; + } + }; + } +})();
\ No newline at end of file diff --git a/plugins/ExamplePlugin/angularjs/directive-component/component.directive.less b/plugins/ExamplePlugin/angularjs/directive-component/component.directive.less new file mode 100644 index 0000000000..625a2a84ef --- /dev/null +++ b/plugins/ExamplePlugin/angularjs/directive-component/component.directive.less @@ -0,0 +1,3 @@ +.componentClass { + // ... +}
\ No newline at end of file |