From: Tim Otten Date: Mon, 2 Feb 2015 04:42:44 +0000 (-0800) Subject: crmExample - Hidden Angular module for testing custom widgets in various configs. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=56f158de76bcf6382471925c3d3b0d6524e2f299;p=civicrm-core.git crmExample - Hidden Angular module for testing custom widgets in various configs. --- diff --git a/Civi/Angular/Manager.php b/Civi/Angular/Manager.php index bb3043ff8d..215d7e1a26 100644 --- a/Civi/Angular/Manager.php +++ b/Civi/Angular/Manager.php @@ -73,6 +73,11 @@ class Manager { 'ext' => 'civicrm', 'js' => array('js/angular-crmAutosave.js'), ); + //$angularModules['crmExample'] = array( + // 'ext' => 'civicrm', + // 'js' => array('js/angular-crmExample.js'), + // 'partials' => array('partials/crmExample'), + //); $angularModules['crmResource'] = array( 'ext' => 'civicrm', // 'js' => array('js/angular-crmResource/byModule.js'), // One HTTP request per module. diff --git a/js/angular-crmExample.js b/js/angular-crmExample.js new file mode 100644 index 0000000000..d32d81d29a --- /dev/null +++ b/js/angular-crmExample.js @@ -0,0 +1,47 @@ +(function(angular, $, _) { + + angular.module('crmExample', [ + 'crmUtil', 'ngRoute', 'ui.utils', 'crmUi' + ]); + + angular.module('crmExample').config([ + '$routeProvider', + function($routeProvider) { + $routeProvider.when('/example', { + templateUrl: '~/crmExample/example.html', + controller: 'ExampleCtrl' + }); + } + ]); + + angular.module('crmExample').controller('ExampleCtrl', function ExampleCtrl($scope) { + $scope.ts = CRM.ts(null); + + //$scope.examples = { + // blank1: {value: '', required: false}, + // blank2: {value: '', required: true}, + // filled1: {value:'2014-01-02', required: false}, + // filled2: {value:'2014-02-03', required: true} + //}; + + //$scope.examples = { + // blank1: {value: '', required: false}, + // blank2: {value: '', required: true}, + // filled1: {value:'12:34', required: false}, + // filled2: {value:'10:09', required: true} + //}; + + $scope.examples = { + blank: {value: '', required: false}, + //blankReq: {value: '', required: true}, + filled: {value:'2014-01-02 03:04', required: false}, + //filledReq: {value:'2014-02-03 05:06', required: true}, + missingDate: {value:' 05:06', required: false}, + //missingDateReq: {value:' 05:06', required: true}, + missingTime: {value:'2014-03-04 ', required: false} + //missingTimeReq: {value:'2014-03-04 ', required: true} + }; + + }); + +})(angular, CRM.$, CRM._); diff --git a/partials/crmExample/example.html b/partials/crmExample/example.html new file mode 100644 index 0000000000..f19fca560f --- /dev/null +++ b/partials/crmExample/example.html @@ -0,0 +1,46 @@ +
+ + + + + + + + + + + + + + + + + + + + +
NameValueInputngModel
{{exName}}{{example.value}} + + + +
+ +
+
+ + +
+
+ + + +
+
+
+ +
+
{{exampleForm[exName]|json}}
+
+ +