angularjs-rails-gem 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,166 @@
1
+ /**
2
+ * @license AngularJS v1.1.2
3
+ * (c) 2010-2012 Google, Inc. http://angularjs.org
4
+ * License: MIT
5
+ */
6
+ (function(window, angular, undefined) {
7
+ 'use strict';
8
+
9
+ var directive = {};
10
+
11
+ directive.dropdownToggle =
12
+ ['$document', '$location', '$window',
13
+ function ($document, $location, $window) {
14
+ var openElement = null, close;
15
+ return {
16
+ restrict: 'C',
17
+ link: function(scope, element, attrs) {
18
+ scope.$watch(function dropdownTogglePathWatch(){return $location.path();}, function dropdownTogglePathWatchAction() {
19
+ close && close();
20
+ });
21
+
22
+ element.parent().bind('click', function(event) {
23
+ close && close();
24
+ });
25
+
26
+ element.bind('click', function(event) {
27
+ event.preventDefault();
28
+ event.stopPropagation();
29
+
30
+ var iWasOpen = false;
31
+
32
+ if (openElement) {
33
+ iWasOpen = openElement === element;
34
+ close();
35
+ }
36
+
37
+ if (!iWasOpen){
38
+ element.parent().addClass('open');
39
+ openElement = element;
40
+
41
+ close = function (event) {
42
+ event && event.preventDefault();
43
+ event && event.stopPropagation();
44
+ $document.unbind('click', close);
45
+ element.parent().removeClass('open');
46
+ close = null;
47
+ openElement = null;
48
+ }
49
+
50
+ $document.bind('click', close);
51
+ }
52
+ });
53
+ }
54
+ };
55
+ }];
56
+
57
+
58
+ directive.tabbable = function() {
59
+ return {
60
+ restrict: 'C',
61
+ compile: function(element) {
62
+ var navTabs = angular.element('<ul class="nav nav-tabs"></ul>'),
63
+ tabContent = angular.element('<div class="tab-content"></div>');
64
+
65
+ tabContent.append(element.contents());
66
+ element.append(navTabs).append(tabContent);
67
+ },
68
+ controller: ['$scope', '$element', function($scope, $element) {
69
+ var navTabs = $element.contents().eq(0),
70
+ ngModel = $element.controller('ngModel') || {},
71
+ tabs = [],
72
+ selectedTab;
73
+
74
+ ngModel.$render = function() {
75
+ var $viewValue = this.$viewValue;
76
+
77
+ if (selectedTab ? (selectedTab.value != $viewValue) : $viewValue) {
78
+ if(selectedTab) {
79
+ selectedTab.paneElement.removeClass('active');
80
+ selectedTab.tabElement.removeClass('active');
81
+ selectedTab = null;
82
+ }
83
+ if($viewValue) {
84
+ for(var i = 0, ii = tabs.length; i < ii; i++) {
85
+ if ($viewValue == tabs[i].value) {
86
+ selectedTab = tabs[i];
87
+ break;
88
+ }
89
+ }
90
+ if (selectedTab) {
91
+ selectedTab.paneElement.addClass('active');
92
+ selectedTab.tabElement.addClass('active');
93
+ }
94
+ }
95
+
96
+ }
97
+ };
98
+
99
+ this.addPane = function(element, attr) {
100
+ var li = angular.element('<li><a href></a></li>'),
101
+ a = li.find('a'),
102
+ tab = {
103
+ paneElement: element,
104
+ paneAttrs: attr,
105
+ tabElement: li
106
+ };
107
+
108
+ tabs.push(tab);
109
+
110
+ attr.$observe('value', update)();
111
+ attr.$observe('title', function(){ update(); a.text(tab.title); })();
112
+
113
+ function update() {
114
+ tab.title = attr.title;
115
+ tab.value = attr.value || attr.title;
116
+ if (!ngModel.$setViewValue && (!ngModel.$viewValue || tab == selectedTab)) {
117
+ // we are not part of angular
118
+ ngModel.$viewValue = tab.value;
119
+ }
120
+ ngModel.$render();
121
+ }
122
+
123
+ navTabs.append(li);
124
+ li.bind('click', function(event) {
125
+ event.preventDefault();
126
+ event.stopPropagation();
127
+ if (ngModel.$setViewValue) {
128
+ $scope.$apply(function() {
129
+ ngModel.$setViewValue(tab.value);
130
+ ngModel.$render();
131
+ });
132
+ } else {
133
+ // we are not part of angular
134
+ ngModel.$viewValue = tab.value;
135
+ ngModel.$render();
136
+ }
137
+ });
138
+
139
+ return function() {
140
+ tab.tabElement.remove();
141
+ for(var i = 0, ii = tabs.length; i < ii; i++ ) {
142
+ if (tab == tabs[i]) {
143
+ tabs.splice(i, 1);
144
+ }
145
+ }
146
+ };
147
+ }
148
+ }]
149
+ };
150
+ };
151
+
152
+
153
+ directive.tabPane = function() {
154
+ return {
155
+ require: '^tabbable',
156
+ restrict: 'C',
157
+ link: function(scope, element, attrs, tabsCtrl) {
158
+ element.bind('$remove', tabsCtrl.addPane(element, attrs));
159
+ }
160
+ };
161
+ };
162
+
163
+
164
+ angular.module('bootstrap', []).directive(directive);
165
+
166
+ })(window, window.angular);
@@ -0,0 +1,171 @@
1
+ /**
2
+ * @license AngularJS v1.1.2
3
+ * (c) 2010-2012 Google, Inc. http://angularjs.org
4
+ * License: MIT
5
+ */
6
+ (function(window, angular, undefined) {
7
+ 'use strict';
8
+
9
+ /**
10
+ * @ngdoc overview
11
+ * @name ngCookies
12
+ */
13
+
14
+
15
+ angular.module('ngCookies', ['ng']).
16
+ /**
17
+ * @ngdoc object
18
+ * @name ngCookies.$cookies
19
+ * @requires $browser
20
+ *
21
+ * @description
22
+ * Provides read/write access to browser's cookies.
23
+ *
24
+ * Only a simple Object is exposed and by adding or removing properties to/from
25
+ * this object, new cookies are created/deleted at the end of current $eval.
26
+ *
27
+ * @example
28
+ */
29
+ factory('$cookies', ['$rootScope', '$browser', function ($rootScope, $browser) {
30
+ var cookies = {},
31
+ lastCookies = {},
32
+ lastBrowserCookies,
33
+ runEval = false,
34
+ copy = angular.copy,
35
+ isUndefined = angular.isUndefined;
36
+
37
+ //creates a poller fn that copies all cookies from the $browser to service & inits the service
38
+ $browser.addPollFn(function() {
39
+ var currentCookies = $browser.cookies();
40
+ if (lastBrowserCookies != currentCookies) { //relies on browser.cookies() impl
41
+ lastBrowserCookies = currentCookies;
42
+ copy(currentCookies, lastCookies);
43
+ copy(currentCookies, cookies);
44
+ if (runEval) $rootScope.$apply();
45
+ }
46
+ })();
47
+
48
+ runEval = true;
49
+
50
+ //at the end of each eval, push cookies
51
+ //TODO: this should happen before the "delayed" watches fire, because if some cookies are not
52
+ // strings or browser refuses to store some cookies, we update the model in the push fn.
53
+ $rootScope.$watch(push);
54
+
55
+ return cookies;
56
+
57
+
58
+ /**
59
+ * Pushes all the cookies from the service to the browser and verifies if all cookies were stored.
60
+ */
61
+ function push() {
62
+ var name,
63
+ value,
64
+ browserCookies,
65
+ updated;
66
+
67
+ //delete any cookies deleted in $cookies
68
+ for (name in lastCookies) {
69
+ if (isUndefined(cookies[name])) {
70
+ $browser.cookies(name, undefined);
71
+ }
72
+ }
73
+
74
+ //update all cookies updated in $cookies
75
+ for(name in cookies) {
76
+ value = cookies[name];
77
+ if (!angular.isString(value)) {
78
+ if (angular.isDefined(lastCookies[name])) {
79
+ cookies[name] = lastCookies[name];
80
+ } else {
81
+ delete cookies[name];
82
+ }
83
+ } else if (value !== lastCookies[name]) {
84
+ $browser.cookies(name, value);
85
+ updated = true;
86
+ }
87
+ }
88
+
89
+ //verify what was actually stored
90
+ if (updated){
91
+ updated = false;
92
+ browserCookies = $browser.cookies();
93
+
94
+ for (name in cookies) {
95
+ if (cookies[name] !== browserCookies[name]) {
96
+ //delete or reset all cookies that the browser dropped from $cookies
97
+ if (isUndefined(browserCookies[name])) {
98
+ delete cookies[name];
99
+ } else {
100
+ cookies[name] = browserCookies[name];
101
+ }
102
+ updated = true;
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }]).
108
+
109
+
110
+ /**
111
+ * @ngdoc object
112
+ * @name ngCookies.$cookieStore
113
+ * @requires $cookies
114
+ *
115
+ * @description
116
+ * Provides a key-value (string-object) storage, that is backed by session cookies.
117
+ * Objects put or retrieved from this storage are automatically serialized or
118
+ * deserialized by angular's toJson/fromJson.
119
+ * @example
120
+ */
121
+ factory('$cookieStore', ['$cookies', function($cookies) {
122
+
123
+ return {
124
+ /**
125
+ * @ngdoc method
126
+ * @name ngCookies.$cookieStore#get
127
+ * @methodOf ngCookies.$cookieStore
128
+ *
129
+ * @description
130
+ * Returns the value of given cookie key
131
+ *
132
+ * @param {string} key Id to use for lookup.
133
+ * @returns {Object} Deserialized cookie value.
134
+ */
135
+ get: function(key) {
136
+ return angular.fromJson($cookies[key]);
137
+ },
138
+
139
+ /**
140
+ * @ngdoc method
141
+ * @name ngCookies.$cookieStore#put
142
+ * @methodOf ngCookies.$cookieStore
143
+ *
144
+ * @description
145
+ * Sets a value for given cookie key
146
+ *
147
+ * @param {string} key Id for the `value`.
148
+ * @param {Object} value Value to be stored.
149
+ */
150
+ put: function(key, value) {
151
+ $cookies[key] = angular.toJson(value);
152
+ },
153
+
154
+ /**
155
+ * @ngdoc method
156
+ * @name ngCookies.$cookieStore#remove
157
+ * @methodOf ngCookies.$cookieStore
158
+ *
159
+ * @description
160
+ * Remove given cookie
161
+ *
162
+ * @param {string} key Id of the key-value pair to delete.
163
+ */
164
+ remove: function(key) {
165
+ delete $cookies[key];
166
+ }
167
+ };
168
+
169
+ }]);
170
+
171
+ })(window, window.angular);
@@ -0,0 +1,276 @@
1
+ /**
2
+ * @license AngularJS v1.1.2
3
+ * (c) 2010-2012 Google, Inc. http://angularjs.org
4
+ * License: MIT
5
+ */
6
+
7
+ (
8
+
9
+ /**
10
+ * @ngdoc interface
11
+ * @name angular.Module
12
+ * @description
13
+ *
14
+ * Interface for configuring angular {@link angular.module modules}.
15
+ */
16
+
17
+ function setupModuleLoader(window) {
18
+
19
+ function ensure(obj, name, factory) {
20
+ return obj[name] || (obj[name] = factory());
21
+ }
22
+
23
+ return ensure(ensure(window, 'angular', Object), 'module', function() {
24
+ /** @type {Object.<string, angular.Module>} */
25
+ var modules = {};
26
+
27
+ /**
28
+ * @ngdoc function
29
+ * @name angular.module
30
+ * @description
31
+ *
32
+ * The `angular.module` is a global place for creating and registering Angular modules. All
33
+ * modules (angular core or 3rd party) that should be available to an application must be
34
+ * registered using this mechanism.
35
+ *
36
+ *
37
+ * # Module
38
+ *
39
+ * A module is a collocation of services, directives, filters, and configuration information. Module
40
+ * is used to configure the {@link AUTO.$injector $injector}.
41
+ *
42
+ * <pre>
43
+ * // Create a new module
44
+ * var myModule = angular.module('myModule', []);
45
+ *
46
+ * // register a new service
47
+ * myModule.value('appName', 'MyCoolApp');
48
+ *
49
+ * // configure existing services inside initialization blocks.
50
+ * myModule.config(function($locationProvider) {
51
+ 'use strict';
52
+ * // Configure existing providers
53
+ * $locationProvider.hashPrefix('!');
54
+ * });
55
+ * </pre>
56
+ *
57
+ * Then you can create an injector and load your modules like this:
58
+ *
59
+ * <pre>
60
+ * var injector = angular.injector(['ng', 'MyModule'])
61
+ * </pre>
62
+ *
63
+ * However it's more likely that you'll just use
64
+ * {@link ng.directive:ngApp ngApp} or
65
+ * {@link angular.bootstrap} to simplify this process for you.
66
+ *
67
+ * @param {!string} name The name of the module to create or retrieve.
68
+ * @param {Array.<string>=} requires If specified then new module is being created. If unspecified then the
69
+ * the module is being retrieved for further configuration.
70
+ * @param {Function} configFn Optional configuration function for the module. Same as
71
+ * {@link angular.Module#config Module#config()}.
72
+ * @returns {module} new module with the {@link angular.Module} api.
73
+ */
74
+ return function module(name, requires, configFn) {
75
+ if (requires && modules.hasOwnProperty(name)) {
76
+ modules[name] = null;
77
+ }
78
+ return ensure(modules, name, function() {
79
+ if (!requires) {
80
+ throw Error('No module: ' + name);
81
+ }
82
+
83
+ /** @type {!Array.<Array.<*>>} */
84
+ var invokeQueue = [];
85
+
86
+ /** @type {!Array.<Function>} */
87
+ var runBlocks = [];
88
+
89
+ var config = invokeLater('$injector', 'invoke');
90
+
91
+ /** @type {angular.Module} */
92
+ var moduleInstance = {
93
+ // Private state
94
+ _invokeQueue: invokeQueue,
95
+ _runBlocks: runBlocks,
96
+
97
+ /**
98
+ * @ngdoc property
99
+ * @name angular.Module#requires
100
+ * @propertyOf angular.Module
101
+ * @returns {Array.<string>} List of module names which must be loaded before this module.
102
+ * @description
103
+ * Holds the list of modules which the injector will load before the current module is loaded.
104
+ */
105
+ requires: requires,
106
+
107
+ /**
108
+ * @ngdoc property
109
+ * @name angular.Module#name
110
+ * @propertyOf angular.Module
111
+ * @returns {string} Name of the module.
112
+ * @description
113
+ */
114
+ name: name,
115
+
116
+
117
+ /**
118
+ * @ngdoc method
119
+ * @name angular.Module#provider
120
+ * @methodOf angular.Module
121
+ * @param {string} name service name
122
+ * @param {Function} providerType Construction function for creating new instance of the service.
123
+ * @description
124
+ * See {@link AUTO.$provide#provider $provide.provider()}.
125
+ */
126
+ provider: invokeLater('$provide', 'provider'),
127
+
128
+ /**
129
+ * @ngdoc method
130
+ * @name angular.Module#factory
131
+ * @methodOf angular.Module
132
+ * @param {string} name service name
133
+ * @param {Function} providerFunction Function for creating new instance of the service.
134
+ * @description
135
+ * See {@link AUTO.$provide#factory $provide.factory()}.
136
+ */
137
+ factory: invokeLater('$provide', 'factory'),
138
+
139
+ /**
140
+ * @ngdoc method
141
+ * @name angular.Module#service
142
+ * @methodOf angular.Module
143
+ * @param {string} name service name
144
+ * @param {Function} constructor A constructor function that will be instantiated.
145
+ * @description
146
+ * See {@link AUTO.$provide#service $provide.service()}.
147
+ */
148
+ service: invokeLater('$provide', 'service'),
149
+
150
+ /**
151
+ * @ngdoc method
152
+ * @name angular.Module#value
153
+ * @methodOf angular.Module
154
+ * @param {string} name service name
155
+ * @param {*} object Service instance object.
156
+ * @description
157
+ * See {@link AUTO.$provide#value $provide.value()}.
158
+ */
159
+ value: invokeLater('$provide', 'value'),
160
+
161
+ /**
162
+ * @ngdoc method
163
+ * @name angular.Module#constant
164
+ * @methodOf angular.Module
165
+ * @param {string} name constant name
166
+ * @param {*} object Constant value.
167
+ * @description
168
+ * Because the constant are fixed, they get applied before other provide methods.
169
+ * See {@link AUTO.$provide#constant $provide.constant()}.
170
+ */
171
+ constant: invokeLater('$provide', 'constant', 'unshift'),
172
+
173
+ /**
174
+ * @ngdoc method
175
+ * @name angular.Module#filter
176
+ * @methodOf angular.Module
177
+ * @param {string} name Filter name.
178
+ * @param {Function} filterFactory Factory function for creating new instance of filter.
179
+ * @description
180
+ * See {@link ng.$filterProvider#register $filterProvider.register()}.
181
+ */
182
+ filter: invokeLater('$filterProvider', 'register'),
183
+
184
+ /**
185
+ * @ngdoc method
186
+ * @name angular.Module#controller
187
+ * @methodOf angular.Module
188
+ * @param {string} name Controller name.
189
+ * @param {Function} constructor Controller constructor function.
190
+ * @description
191
+ * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
192
+ */
193
+ controller: invokeLater('$controllerProvider', 'register'),
194
+
195
+ /**
196
+ * @ngdoc method
197
+ * @name angular.Module#directive
198
+ * @methodOf angular.Module
199
+ * @param {string} name directive name
200
+ * @param {Function} directiveFactory Factory function for creating new instance of
201
+ * directives.
202
+ * @description
203
+ * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
204
+ */
205
+ directive: invokeLater('$compileProvider', 'directive'),
206
+
207
+ /**
208
+ * @ngdoc method
209
+ * @name angular.Module#config
210
+ * @methodOf angular.Module
211
+ * @param {Function} configFn Execute this function on module load. Useful for service
212
+ * configuration.
213
+ * @description
214
+ * Use this method to register work which needs to be performed on module loading.
215
+ */
216
+ config: config,
217
+
218
+ /**
219
+ * @ngdoc method
220
+ * @name angular.Module#run
221
+ * @methodOf angular.Module
222
+ * @param {Function} initializationFn Execute this function after injector creation.
223
+ * Useful for application initialization.
224
+ * @description
225
+ * Use this method to register work which should be performed when the injector is done
226
+ * loading all modules.
227
+ */
228
+ run: function(block) {
229
+ runBlocks.push(block);
230
+ return this;
231
+ }
232
+ };
233
+
234
+ if (configFn) {
235
+ config(configFn);
236
+ }
237
+
238
+ return moduleInstance;
239
+
240
+ /**
241
+ * @param {string} provider
242
+ * @param {string} method
243
+ * @param {String=} insertMethod
244
+ * @returns {angular.Module}
245
+ */
246
+ function invokeLater(provider, method, insertMethod) {
247
+ return function() {
248
+ invokeQueue[insertMethod || 'push']([provider, method, arguments]);
249
+ return moduleInstance;
250
+ }
251
+ }
252
+ });
253
+ };
254
+ });
255
+
256
+ }
257
+ )(window);
258
+
259
+ /**
260
+ * Closure compiler type information
261
+ *
262
+ * @typedef { {
263
+ * requires: !Array.<string>,
264
+ * invokeQueue: !Array.<Array.<*>>,
265
+ *
266
+ * service: function(string, Function):angular.Module,
267
+ * factory: function(string, Function):angular.Module,
268
+ * value: function(string, *):angular.Module,
269
+ *
270
+ * filter: function(string, Function):angular.Module,
271
+ *
272
+ * init: function(Function):angular.Module
273
+ * } }
274
+ */
275
+ angular.Module;
276
+