summaryrefslogtreecommitdiffstats
path: root/js/vendor/angular-ui/templates
diff options
context:
space:
mode:
Diffstat (limited to 'js/vendor/angular-ui/templates')
-rw-r--r--js/vendor/angular-ui/templates/README.md48
-rw-r--r--js/vendor/angular-ui/templates/dependencies.json8
-rw-r--r--js/vendor/angular-ui/templates/stylesheets/template.less2
-rw-r--r--js/vendor/angular-ui/templates/template.js21
-rw-r--r--js/vendor/angular-ui/templates/test/templateSpec.js58
5 files changed, 137 insertions, 0 deletions
diff --git a/js/vendor/angular-ui/templates/README.md b/js/vendor/angular-ui/templates/README.md
new file mode 100644
index 000000000..87ce457f1
--- /dev/null
+++ b/js/vendor/angular-ui/templates/README.md
@@ -0,0 +1,48 @@
+# ui-template directives
+
+#### NOTE: This template is going to be replaced in very near future ###
+
+These directives are boilerplates for creating your own directives.
+
+## Usage
+
+Add the template module as a dependency to your application module:
+
+ var myAppModule = angular.module('MyApp', ['ui.directives.template'])
+
+Apply the directive to your html elements:
+
+ <span ui-template num="SomeNumber"></span>
+
+Default styles are in angular-ui.css and are pretty boring, you could just override these in your
+stylesheet and make things more interesting
+
+### Options
+
+All the options can be passed through the directive or set on the html element.
+NOTE: attributes override controller options
+
+ myAppModule.controller('MyController', function($scope) {
+ $scope.SomeNumber = 123;
+ $scope.uiTemplateOptions = {
+
+ };
+ });
+
+ // two-way binding with default for scoped.options uiTemplateOptions
+ <span ui-template ng-model="SomeNumber"></span>
+
+ // one way binding with your own name for scoped options
+ <span ui-template options="myOptions" num="SomeNumber"></span>
+
+
+### Notes
+
+ui-template
+ - one-way binding unless you have in an ng-repeat
+ - does not currently work with ng-model.
+ - is supported only for attribute style elements
+
+### Todo
+ - support ng-model
+ \ No newline at end of file
diff --git a/js/vendor/angular-ui/templates/dependencies.json b/js/vendor/angular-ui/templates/dependencies.json
new file mode 100644
index 000000000..8f6142ca2
--- /dev/null
+++ b/js/vendor/angular-ui/templates/dependencies.json
@@ -0,0 +1,8 @@
+{
+ "core": [ "jquery", "jquery-ui", "bootstrap" ],
+ "internal": [ "directives/showHide", "filters/highlight" ],
+ "external": [
+ "http://ivaynberg.github.com/select2/select2-3.2/select2.js",
+ "http://ivaynberg.github.com/select2/select2-3.2/select2.css",
+ ]
+} \ No newline at end of file
diff --git a/js/vendor/angular-ui/templates/stylesheets/template.less b/js/vendor/angular-ui/templates/stylesheets/template.less
new file mode 100644
index 000000000..909d09a9e
--- /dev/null
+++ b/js/vendor/angular-ui/templates/stylesheets/template.less
@@ -0,0 +1,2 @@
+/* default styles (if any) for your directive implementations */
+
diff --git a/js/vendor/angular-ui/templates/template.js b/js/vendor/angular-ui/templates/template.js
new file mode 100644
index 000000000..7512cd08e
--- /dev/null
+++ b/js/vendor/angular-ui/templates/template.js
@@ -0,0 +1,21 @@
+angular.module('ui.directives').directive('uiTemplate', ['ui.config', function (uiConfig) {
+ var options = uiConfig.uiTemplate || {};
+ return {
+ restrict: 'EAC', // supports using directive as element, attribute and class
+ link: function (iScope, iElement, iAttrs, controller) {
+ var opts;
+
+ // opts is link element-specific options merged on top of global defaults. If you only extend the global default, then all instances would override each other
+ opts = angular.extend({}, options, iAttrs.uiTemplate);
+
+ // your logic goes here
+ }
+ };
+}]);
+
+
+angular.module('ui.filters').filter('filterTmpl', ['ui.config', function (uiConfig) {
+ return function (value) {
+ return value;
+ };
+}]); \ No newline at end of file
diff --git a/js/vendor/angular-ui/templates/test/templateSpec.js b/js/vendor/angular-ui/templates/test/templateSpec.js
new file mode 100644
index 000000000..6eff729e1
--- /dev/null
+++ b/js/vendor/angular-ui/templates/test/templateSpec.js
@@ -0,0 +1,58 @@
+/*
+ * sample unit testing for sample templates and implementations
+ */
+describe('uiTemplate', function () {
+
+ // declare these up here to be global to all tests
+ var $rootScope, $compile;
+
+ beforeEach(module('ui.directives'));
+ beforeEach(module('ui.filters'));
+
+ // inject in angular constructs. Injector knows about leading/trailing underscores and does the right thing
+ // otherwise, you would need to inject these into each test
+ beforeEach(inject(function (_$rootScope_, _$compile_) {
+ $rootScope = _$rootScope_;
+ $compile = _$compile_;
+ }));
+
+ // reset the ui.config after each test
+ afterEach(function () {
+ angular.module('ui.config').value('ui.config', {});
+ });
+
+ // optional grouping of tests
+ describe('filter', function () {
+
+ // we're doing filter tests so globally define here for this subset of tests
+ var $filter;
+ beforeEach(inject(function (_$filter_) {
+ $filter = _$filter_;
+ }));
+
+ // very simple boilerplate setup of test for a custom filter
+ var tmpl;
+ beforeEach(function () {
+ tmpl = $filter('filterTmpl');
+ });
+
+ it('should exist when provided', function () {
+ expect(tmpl).toBeDefined();
+ });
+
+ it('should return exactly what interesting thing the filter is doing to input', function () {
+ expect(tmpl('text')).toEqual('text');
+ });
+
+ });
+
+ // optional grouping of tests
+ describe('directive', function () {
+ var element;
+ it('should create an element if using element-style', function () {
+ element = $compile('<ui-directive-tmpl ng-model="a"></ui-directive-tmpl>')($rootScope);
+ expect(element).toBeDefined();
+ });
+ });
+
+});