kms 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/kms/application.js +1 -0
  3. data/app/assets/javascripts/kms/application/controllers/assets_controller.coffee.erb +14 -4
  4. data/app/assets/javascripts/kms/application/controllers/pages_controller.coffee.erb +12 -2
  5. data/app/assets/javascripts/kms/application/controllers/snippets_controller.coffee.erb +13 -3
  6. data/app/assets/javascripts/kms/application/controllers/templates_controller.coffee.erb +13 -3
  7. data/app/assets/javascripts/kms/application/controllers/users_controller.coffee +5 -5
  8. data/app/assets/javascripts/kms/application/module.coffee +6 -2
  9. data/app/assets/javascripts/kms/application/routes.coffee.erb +10 -0
  10. data/app/assets/javascripts/templates/assets/edit.html.slim +2 -1
  11. data/app/assets/javascripts/templates/assets/form.html.slim +1 -1
  12. data/app/assets/javascripts/templates/pages/edit.html.slim +1 -0
  13. data/app/assets/javascripts/templates/shared/hotkey_notification.html.slim +6 -0
  14. data/app/assets/javascripts/templates/snippets/edit.html.slim +1 -0
  15. data/app/assets/javascripts/templates/templates/edit.html.slim +1 -0
  16. data/app/assets/javascripts/templates/users/edit.html.slim +5 -0
  17. data/app/assets/javascripts/templates/users/form.html.slim +3 -2
  18. data/app/assets/javascripts/templates/users/index.html.slim +2 -1
  19. data/app/assets/stylesheets/kms/custom.css.scss +10 -0
  20. data/app/controllers/kms/assets_controller.rb +6 -3
  21. data/app/controllers/kms/users_controller.rb +14 -0
  22. data/app/services/kms/resource_service.rb +3 -1
  23. data/app/views/layouts/kms/kms.html.erb +1 -1
  24. data/config/initializers/devise.rb +9 -0
  25. data/config/locales/en.yml +12 -0
  26. data/config/locales/ru.yml +12 -0
  27. data/config/routes.rb +1 -1
  28. data/lib/kms/engine.rb +1 -1
  29. data/lib/kms/version.rb +1 -1
  30. data/spec/controllers/kms/assets_controller_spec.rb +28 -10
  31. data/spec/controllers/kms/users_controller_spec.rb +23 -0
  32. data/spec/internal/config/routes.rb +1 -1
  33. data/spec/internal/log/test.log +0 -105823
  34. data/vendor/assets/bower.json +5 -4
  35. data/vendor/assets/bower_components/angular-cookies/angular-cookies.js +22 -18
  36. data/vendor/assets/bower_components/angular-cookies/angular-cookies.min.js +4 -4
  37. data/vendor/assets/bower_components/angular-cookies/angular-cookies.min.js.map +2 -2
  38. data/vendor/assets/bower_components/angular-cookies/bower.json +2 -2
  39. data/vendor/assets/bower_components/angular-cookies/package.json +1 -1
  40. data/vendor/assets/bower_components/angular-hotkeys/Gruntfile.js +118 -0
  41. data/vendor/assets/bower_components/angular-hotkeys/LICENSE +20 -0
  42. data/vendor/assets/bower_components/angular-hotkeys/README.md +248 -0
  43. data/vendor/assets/bower_components/angular-hotkeys/bower.json +19 -0
  44. data/vendor/assets/bower_components/angular-hotkeys/build/hotkeys.css +110 -0
  45. data/vendor/assets/bower_components/angular-hotkeys/build/hotkeys.js +1661 -0
  46. data/vendor/assets/bower_components/angular-hotkeys/build/hotkeys.min.css +1 -0
  47. data/vendor/assets/bower_components/angular-hotkeys/build/hotkeys.min.js +7 -0
  48. data/vendor/assets/bower_components/angular-hotkeys/package.json +45 -0
  49. data/vendor/assets/bower_components/angular-hotkeys/src/hotkeys.css +104 -0
  50. data/vendor/assets/bower_components/angular-hotkeys/src/hotkeys.js +633 -0
  51. data/vendor/assets/bower_components/angular-loading-bar/CHANGELOG.md +33 -0
  52. data/vendor/assets/bower_components/angular-loading-bar/CONTRIBUTING.md +17 -0
  53. data/vendor/assets/bower_components/angular-loading-bar/Gruntfile.js +9 -1
  54. data/vendor/assets/bower_components/angular-loading-bar/ISSUE_TEMPLATE.md +14 -0
  55. data/vendor/assets/bower_components/angular-loading-bar/PULL_REQUEST_TEMPLATE.md +13 -0
  56. data/vendor/assets/bower_components/angular-loading-bar/README.md +30 -3
  57. data/vendor/assets/bower_components/angular-loading-bar/bower.json +11 -6
  58. data/vendor/assets/bower_components/angular-loading-bar/build/loading-bar.css +5 -5
  59. data/vendor/assets/bower_components/angular-loading-bar/build/loading-bar.js +39 -12
  60. data/vendor/assets/bower_components/angular-loading-bar/build/loading-bar.min.css +1 -8
  61. data/vendor/assets/bower_components/angular-loading-bar/build/loading-bar.min.js +3 -3
  62. data/vendor/assets/bower_components/angular-loading-bar/index.js +2 -0
  63. data/vendor/assets/bower_components/angular-loading-bar/package.json +12 -15
  64. data/vendor/assets/bower_components/angular-loading-bar/src/loading-bar.css +3 -3
  65. data/vendor/assets/bower_components/angular-loading-bar/src/loading-bar.js +37 -10
  66. data/vendor/assets/bower_components/angular-sanitize/angular-sanitize.js +504 -386
  67. data/vendor/assets/bower_components/angular-sanitize/angular-sanitize.min.js +13 -12
  68. data/vendor/assets/bower_components/angular-sanitize/angular-sanitize.min.js.map +3 -3
  69. data/vendor/assets/bower_components/angular-sanitize/bower.json +2 -2
  70. data/vendor/assets/bower_components/angular-sanitize/package.json +1 -1
  71. data/vendor/assets/bower_components/angular-ui-router/CHANGELOG.md +1410 -0
  72. data/vendor/assets/bower_components/angular-ui-router/CONTRIBUTING.md +64 -16
  73. data/vendor/assets/bower_components/angular-ui-router/DOCS.md +48 -0
  74. data/vendor/assets/bower_components/angular-ui-router/ISSUE_TEMPLATE.md +53 -0
  75. data/vendor/assets/bower_components/angular-ui-router/LICENSE +1 -1
  76. data/vendor/assets/bower_components/angular-ui-router/README.md +24 -211
  77. data/vendor/assets/bower_components/angular-ui-router/artifacts.json +8 -0
  78. data/vendor/assets/bower_components/angular-ui-router/bower.json +1 -23
  79. data/vendor/assets/bower_components/angular-ui-router/karma.conf.js +105 -0
  80. data/vendor/assets/bower_components/angular-ui-router/release/angular-ui-router.js +9744 -3901
  81. data/vendor/assets/bower_components/angular-ui-router/release/angular-ui-router.js.map +192 -0
  82. data/vendor/assets/bower_components/angular-ui-router/release/angular-ui-router.min.js +9 -4
  83. data/vendor/assets/bower_components/angular-ui-router/release/angular-ui-router.min.js.map +1679 -0
  84. data/vendor/assets/bower_components/angular-ui-router/release/resolveService.js +83 -0
  85. data/vendor/assets/bower_components/angular-ui-router/release/resolveService.js.map +19 -0
  86. data/vendor/assets/bower_components/angular-ui-router/release/resolveService.min.js +8 -0
  87. data/vendor/assets/bower_components/angular-ui-router/release/resolveService.min.js.map +47 -0
  88. data/vendor/assets/bower_components/angular-ui-router/release/stateEvents.js +294 -0
  89. data/vendor/assets/bower_components/angular-ui-router/release/stateEvents.js.map +17 -0
  90. data/vendor/assets/bower_components/angular-ui-router/release/stateEvents.min.js +8 -0
  91. data/vendor/assets/bower_components/angular-ui-router/release/stateEvents.min.js.map +102 -0
  92. data/vendor/assets/bower_components/angular-ui-router/release/ui-router-angularjs.js +2014 -0
  93. data/vendor/assets/bower_components/angular-ui-router/release/ui-router-angularjs.js.map +70 -0
  94. data/vendor/assets/bower_components/angular-ui-router/release/ui-router-angularjs.min.js +9 -0
  95. data/vendor/assets/bower_components/angular-ui-router/release/ui-router-angularjs.min.js.map +541 -0
  96. data/vendor/assets/bower_components/angular-ui-router/rollup.config.js +116 -0
  97. data/vendor/assets/bower_components/angular-ui-router/tslint.json +60 -0
  98. data/vendor/assets/bower_components/angular-ui-router/yarn.lock +4146 -0
  99. data/vendor/assets/bower_components/angular-ui-tree/yarn.lock +4945 -0
  100. data/vendor/assets/bower_components/angular/angular.js +4019 -2449
  101. data/vendor/assets/bower_components/angular/angular.min.js +331 -319
  102. data/vendor/assets/bower_components/angular/angular.min.js.gzip +0 -0
  103. data/vendor/assets/bower_components/angular/angular.min.js.map +3 -3
  104. data/vendor/assets/bower_components/angular/bower.json +1 -1
  105. data/vendor/assets/bower_components/angular/package.json +1 -1
  106. data/vendor/assets/bower_components/angularjs-dropdown-multiselect/LICENSE +21 -0
  107. data/vendor/assets/bower_components/angularjs-dropdown-multiselect/README.md +14 -14
  108. data/vendor/assets/bower_components/angularjs-dropdown-multiselect/bower.json +25 -12
  109. data/vendor/assets/bower_components/angularjs-dropdown-multiselect/development_index.html +59 -52
  110. data/vendor/assets/bower_components/angularjs-dropdown-multiselect/dist/angularjs-dropdown-multiselect.min.js +1 -1
  111. data/vendor/assets/bower_components/angularjs-dropdown-multiselect/index.html +73 -0
  112. data/vendor/assets/bower_components/angularjs-dropdown-multiselect/package.json +19 -7
  113. data/vendor/assets/bower_components/angularjs-dropdown-multiselect/pages/javascripts/pages/home/ExampleCtrl.js +126 -3
  114. data/vendor/assets/bower_components/angularjs-dropdown-multiselect/pages/javascripts/pages/home/home.html +1262 -852
  115. data/vendor/assets/bower_components/angularjs-dropdown-multiselect/pages/stylesheets/stylesheet.css +10 -5
  116. data/vendor/assets/bower_components/angularjs-dropdown-multiselect/src/angularjs-dropdown-multiselect.js +612 -287
  117. metadata +66 -169
  118. data/spec/internal/config/database.yml +0 -7
  119. data/spec/internal/public/uploads/kms/asset/file/1/avatar.jpg +0 -0
  120. data/spec/internal/public/uploads/kms/asset/file/2/avatar.jpg +0 -0
  121. data/spec/internal/public/uploads/kms/asset/file/2/style.css +0 -1
  122. data/spec/internal/public/uploads/kms/asset/file/3/style.css +0 -1
  123. data/spec/internal/public/uploads/kms/asset/file/4/style.css +0 -1
  124. data/spec/internal/public/uploads/tmp/1500976987-41025-0002-0883/style.css +0 -1
  125. data/spec/internal/public/uploads/tmp/1500977082-41195-0002-6495/style.css +0 -1
  126. data/spec/internal/public/uploads/tmp/1500977109-41364-0002-4518/style.css +0 -1
  127. data/spec/internal/public/uploads/tmp/1500977152-41405-0002-2345/style.css +0 -1
  128. data/spec/internal/public/uploads/tmp/1500977327-41694-0002-5448/style.css +0 -1
  129. data/spec/internal/public/uploads/tmp/1500977376-41732-0002-7916/style.css +0 -1
  130. data/spec/internal/public/uploads/tmp/1500977392-41759-0002-7593/style.css +0 -1
  131. data/spec/internal/public/uploads/tmp/1500977410-42259-0002-7527/style.css +0 -1
  132. data/spec/internal/public/uploads/tmp/1500977429-42306-0002-5937/style.css +0 -1
  133. data/spec/internal/public/uploads/tmp/1500977437-42324-0002-5880/style.css +0 -1
  134. data/spec/internal/public/uploads/tmp/1500983228-53594-0002-4559/style.css +0 -1
  135. data/spec/internal/public/uploads/tmp/1500983284-53632-0002-6590/style.css +0 -1
  136. data/spec/internal/public/uploads/tmp/1500983360-53784-0002-7289/style.css +0 -1
  137. data/spec/internal/public/uploads/tmp/1500983469-54321-0002-0386/avatar.jpg +0 -0
  138. data/spec/internal/public/uploads/tmp/1500983469-54321-0004-5691/style.css +0 -1
  139. data/spec/internal/public/uploads/tmp/1500983511-54352-0002-5720/avatar.jpg +0 -0
  140. data/spec/internal/public/uploads/tmp/1500983511-54352-0004-1399/style.css +0 -1
  141. data/spec/internal/public/uploads/tmp/1500983610-54507-0002-4280/avatar.jpg +0 -0
  142. data/spec/internal/public/uploads/tmp/1500983610-54507-0004-9758/style.css +0 -1
  143. data/spec/internal/public/uploads/tmp/1500984466-57012-0002-4146/avatar.jpg +0 -0
  144. data/spec/internal/public/uploads/tmp/1500984466-57012-0004-5895/style.css +0 -1
  145. data/spec/internal/public/uploads/tmp/1500984509-57158-0002-9657/avatar.jpg +0 -0
  146. data/spec/internal/public/uploads/tmp/1500984509-57158-0004-5003/style.css +0 -1
  147. data/spec/internal/public/uploads/tmp/1500984616-57697-0002-7201/avatar.jpg +0 -0
  148. data/spec/internal/public/uploads/tmp/1500984616-57697-0004-6255/style.css +0 -1
  149. data/spec/internal/public/uploads/tmp/1500985257-58947-0002-3629/avatar.jpg +0 -0
  150. data/spec/internal/public/uploads/tmp/1500985257-58947-0004-5338/style.css +0 -1
  151. data/spec/internal/public/uploads/tmp/1500985407-58947-0006-5929/style.css +0 -1
  152. data/spec/internal/public/uploads/tmp/1500985473-59264-0002-0397/avatar.jpg +0 -0
  153. data/spec/internal/public/uploads/tmp/1500985473-59264-0004-6493/style.css +0 -1
  154. data/spec/internal/public/uploads/tmp/1500985475-59264-0007-8674/style.css +0 -1
  155. data/spec/internal/public/uploads/tmp/1500985538-59468-0002-9206/avatar.jpg +0 -0
  156. data/spec/internal/public/uploads/tmp/1500985538-59468-0004-2586/style.css +0 -1
  157. data/spec/internal/public/uploads/tmp/1500985538-59468-0007-6200/style.css +0 -1
  158. data/spec/internal/public/uploads/tmp/1500988358-65877-0002-4528/avatar.jpg +0 -0
  159. data/spec/internal/public/uploads/tmp/1500988358-65877-0004-5904/style.css +0 -1
  160. data/spec/internal/public/uploads/tmp/1500988358-65877-0007-7320/style.css +0 -1
  161. data/spec/internal/public/uploads/tmp/1500988407-65916-0002-3138/avatar.jpg +0 -0
  162. data/spec/internal/public/uploads/tmp/1500988407-65916-0004-5400/style.css +0 -1
  163. data/spec/internal/public/uploads/tmp/1500988407-65916-0007-1655/style.css +0 -1
  164. data/spec/internal/public/uploads/tmp/1500988421-65950-0002-9415/avatar.jpg +0 -0
  165. data/spec/internal/public/uploads/tmp/1500988421-65950-0004-7130/style.css +0 -1
  166. data/spec/internal/public/uploads/tmp/1500988421-65950-0007-9886/style.css +0 -1
  167. data/spec/internal/public/uploads/tmp/1500988435-65981-0002-3228/avatar.jpg +0 -0
  168. data/spec/internal/public/uploads/tmp/1500988435-65981-0004-3682/style.css +0 -1
  169. data/spec/internal/public/uploads/tmp/1500988435-65981-0007-1582/style.css +0 -1
  170. data/spec/internal/public/uploads/tmp/1500988475-66122-0002-9516/avatar.jpg +0 -0
  171. data/spec/internal/public/uploads/tmp/1500988475-66122-0004-5634/style.css +0 -1
  172. data/spec/internal/public/uploads/tmp/1500988530-66122-0007-2272/style.css +0 -1
  173. data/spec/internal/public/uploads/tmp/1500988554-66315-0002-6262/avatar.jpg +0 -0
  174. data/spec/internal/public/uploads/tmp/1500988554-66315-0004-6099/style.css +0 -1
  175. data/spec/internal/public/uploads/tmp/1500988554-66315-0007-1632/style.css +0 -1
  176. data/spec/internal/public/uploads/tmp/1500991751-73722-0002-9937/avatar.jpg +0 -0
  177. data/spec/internal/public/uploads/tmp/1500991751-73722-0004-8034/style.css +0 -1
  178. data/spec/internal/public/uploads/tmp/1500991751-73722-0007-7763/style.css +0 -1
  179. data/spec/internal/public/uploads/tmp/1501233238-34385-0002-3210/avatar.jpg +0 -0
  180. data/spec/internal/public/uploads/tmp/1501233238-34385-0004-5881/style.css +0 -1
  181. data/spec/internal/public/uploads/tmp/1501233238-34385-0007-6280/style.css +0 -1
  182. data/spec/internal/tmp/cache/assets/test/sprockets/v3.0/1XyAFYlYI0pK7WAgjR4PgXV6BgU6huJSviWmHetdCRs.cache +0 -1
  183. data/vendor/assets/bower_components/angular-ui-router/api/angular-ui-router.d.ts +0 -126
  184. data/vendor/assets/bower_components/angular-ui-router/src/common.js +0 -292
  185. data/vendor/assets/bower_components/angular-ui-router/src/resolve.js +0 -252
  186. data/vendor/assets/bower_components/angular-ui-router/src/state.js +0 -1373
  187. data/vendor/assets/bower_components/angular-ui-router/src/stateDirectives.js +0 -268
  188. data/vendor/assets/bower_components/angular-ui-router/src/stateFilters.js +0 -39
  189. data/vendor/assets/bower_components/angular-ui-router/src/templateFactory.js +0 -110
  190. data/vendor/assets/bower_components/angular-ui-router/src/urlMatcherFactory.js +0 -1036
  191. data/vendor/assets/bower_components/angular-ui-router/src/urlRouter.js +0 -413
  192. data/vendor/assets/bower_components/angular-ui-router/src/view.js +0 -71
  193. data/vendor/assets/bower_components/angular-ui-router/src/viewDirective.js +0 -302
  194. data/vendor/assets/bower_components/angular-ui-router/src/viewScroll.js +0 -52
  195. data/vendor/assets/bower_components/angularjs-dropdown-multiselect/pages/index.html +0 -67
  196. data/vendor/assets/bower_components/bootstrap/Gemfile.lock +0 -43
@@ -1 +0,0 @@
1
- "%_�|�`e����@��<�ݴ8<�g�%����
@@ -1,126 +0,0 @@
1
- // Type definitions for Angular JS 1.1.5+ (ui.router module)
2
- // Project: https://github.com/angular-ui/ui-router
3
- // Definitions by: Michel Salib <https://github.com/michelsalib>
4
- // Definitions: https://github.com/borisyankov/DefinitelyTyped
5
-
6
- declare module ng.ui {
7
-
8
- interface IState {
9
- name?: string;
10
- template?: string;
11
- templateUrl?: any; // string || () => string
12
- templateProvider?: any; // () => string || IPromise<string>
13
- controller?: any;
14
- controllerAs?: string;
15
- controllerProvider?: any;
16
- resolve?: {};
17
- url?: string;
18
- params?: any;
19
- views?: {};
20
- abstract?: boolean;
21
- onEnter?: (...args: any[]) => void;
22
- onExit?: (...args: any[]) => void;
23
- data?: any;
24
- reloadOnSearch?: boolean;
25
- }
26
-
27
- interface ITypedState<T> extends IState {
28
- data?: T;
29
- }
30
-
31
- interface IStateProvider extends IServiceProvider {
32
- state(name: string, config: IState): IStateProvider;
33
- state(config: IState): IStateProvider;
34
- decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any;
35
- }
36
-
37
- interface IUrlMatcher {
38
- concat(pattern: string): IUrlMatcher;
39
- exec(path: string, searchParams: {}): {};
40
- parameters(): string[];
41
- format(values: {}): string;
42
- }
43
-
44
- interface IUrlMatcherFactory {
45
- compile(pattern: string): IUrlMatcher;
46
- isMatcher(o: any): boolean;
47
- }
48
-
49
- interface IUrlRouterProvider extends IServiceProvider {
50
- when(whenPath: RegExp, handler: Function): IUrlRouterProvider;
51
- when(whenPath: RegExp, handler: any[]): IUrlRouterProvider;
52
- when(whenPath: RegExp, toPath: string): IUrlRouterProvider;
53
- when(whenPath: IUrlMatcher, hanlder: Function): IUrlRouterProvider;
54
- when(whenPath: IUrlMatcher, handler: any[]): IUrlRouterProvider;
55
- when(whenPath: IUrlMatcher, toPath: string): IUrlRouterProvider;
56
- when(whenPath: string, handler: Function): IUrlRouterProvider;
57
- when(whenPath: string, handler: any[]): IUrlRouterProvider;
58
- when(whenPath: string, toPath: string): IUrlRouterProvider;
59
- otherwise(handler: Function): IUrlRouterProvider;
60
- otherwise(handler: any[]): IUrlRouterProvider;
61
- otherwise(path: string): IUrlRouterProvider;
62
- rule(handler: Function): IUrlRouterProvider;
63
- rule(handler: any[]): IUrlRouterProvider;
64
- }
65
-
66
- interface IStateOptions {
67
- location?: any;
68
- inherit?: boolean;
69
- relative?: IState;
70
- notify?: boolean;
71
- reload?: boolean;
72
- }
73
-
74
- interface IHrefOptions {
75
- lossy?: boolean;
76
- inherit?: boolean;
77
- relative?: IState;
78
- absolute?: boolean;
79
- }
80
-
81
- interface IStateService {
82
- go(to: string, params?: {}, options?: IStateOptions): IPromise<any>;
83
- transitionTo(state: string, params?: {}, updateLocation?: boolean): void;
84
- transitionTo(state: string, params?: {}, options?: IStateOptions): void;
85
- includes(state: string, params?: {}): boolean;
86
- is(state:string, params?: {}): boolean;
87
- is(state: IState, params?: {}): boolean;
88
- href(state: IState, params?: {}, options?: IHrefOptions): string;
89
- href(state: string, params?: {}, options?: IHrefOptions): string;
90
- get(state: string): IState;
91
- get(): IState[];
92
- current: IState;
93
- params: any;
94
- reload(): void;
95
- }
96
-
97
- interface IStateParamsService {
98
- [key: string]: any;
99
- }
100
-
101
- interface IStateParams {
102
- [key: string]: any;
103
- }
104
-
105
- interface IUrlRouterService {
106
- /*
107
- * Triggers an update; the same update that happens when the address bar
108
- * url changes, aka $locationChangeSuccess.
109
- *
110
- * This method is useful when you need to use preventDefault() on the
111
- * $locationChangeSuccess event, perform some custom logic (route protection,
112
- * auth, config, redirection, etc) and then finally proceed with the transition
113
- * by calling $urlRouter.sync().
114
- *
115
- */
116
- sync(): void;
117
- }
118
-
119
- interface IUiViewScrollProvider {
120
- /*
121
- * Reverts back to using the core $anchorScroll service for scrolling
122
- * based on the url anchor.
123
- */
124
- useAnchorScroll(): void;
125
- }
126
- }
@@ -1,292 +0,0 @@
1
- /*jshint globalstrict:true*/
2
- /*global angular:false*/
3
- 'use strict';
4
-
5
- var isDefined = angular.isDefined,
6
- isFunction = angular.isFunction,
7
- isString = angular.isString,
8
- isObject = angular.isObject,
9
- isArray = angular.isArray,
10
- forEach = angular.forEach,
11
- extend = angular.extend,
12
- copy = angular.copy;
13
-
14
- function inherit(parent, extra) {
15
- return extend(new (extend(function() {}, { prototype: parent }))(), extra);
16
- }
17
-
18
- function merge(dst) {
19
- forEach(arguments, function(obj) {
20
- if (obj !== dst) {
21
- forEach(obj, function(value, key) {
22
- if (!dst.hasOwnProperty(key)) dst[key] = value;
23
- });
24
- }
25
- });
26
- return dst;
27
- }
28
-
29
- /**
30
- * Finds the common ancestor path between two states.
31
- *
32
- * @param {Object} first The first state.
33
- * @param {Object} second The second state.
34
- * @return {Array} Returns an array of state names in descending order, not including the root.
35
- */
36
- function ancestors(first, second) {
37
- var path = [];
38
-
39
- for (var n in first.path) {
40
- if (first.path[n] !== second.path[n]) break;
41
- path.push(first.path[n]);
42
- }
43
- return path;
44
- }
45
-
46
- /**
47
- * IE8-safe wrapper for `Object.keys()`.
48
- *
49
- * @param {Object} object A JavaScript object.
50
- * @return {Array} Returns the keys of the object as an array.
51
- */
52
- function objectKeys(object) {
53
- if (Object.keys) {
54
- return Object.keys(object);
55
- }
56
- var result = [];
57
-
58
- angular.forEach(object, function(val, key) {
59
- result.push(key);
60
- });
61
- return result;
62
- }
63
-
64
- /**
65
- * IE8-safe wrapper for `Array.prototype.indexOf()`.
66
- *
67
- * @param {Array} array A JavaScript array.
68
- * @param {*} value A value to search the array for.
69
- * @return {Number} Returns the array index value of `value`, or `-1` if not present.
70
- */
71
- function indexOf(array, value) {
72
- if (Array.prototype.indexOf) {
73
- return array.indexOf(value, Number(arguments[2]) || 0);
74
- }
75
- var len = array.length >>> 0, from = Number(arguments[2]) || 0;
76
- from = (from < 0) ? Math.ceil(from) : Math.floor(from);
77
-
78
- if (from < 0) from += len;
79
-
80
- for (; from < len; from++) {
81
- if (from in array && array[from] === value) return from;
82
- }
83
- return -1;
84
- }
85
-
86
- /**
87
- * Merges a set of parameters with all parameters inherited between the common parents of the
88
- * current state and a given destination state.
89
- *
90
- * @param {Object} currentParams The value of the current state parameters ($stateParams).
91
- * @param {Object} newParams The set of parameters which will be composited with inherited params.
92
- * @param {Object} $current Internal definition of object representing the current state.
93
- * @param {Object} $to Internal definition of object representing state to transition to.
94
- */
95
- function inheritParams(currentParams, newParams, $current, $to) {
96
- var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = [];
97
-
98
- for (var i in parents) {
99
- if (!parents[i].params) continue;
100
- parentParams = objectKeys(parents[i].params);
101
- if (!parentParams.length) continue;
102
-
103
- for (var j in parentParams) {
104
- if (indexOf(inheritList, parentParams[j]) >= 0) continue;
105
- inheritList.push(parentParams[j]);
106
- inherited[parentParams[j]] = currentParams[parentParams[j]];
107
- }
108
- }
109
- return extend({}, inherited, newParams);
110
- }
111
-
112
- /**
113
- * Performs a non-strict comparison of the subset of two objects, defined by a list of keys.
114
- *
115
- * @param {Object} a The first object.
116
- * @param {Object} b The second object.
117
- * @param {Array} keys The list of keys within each object to compare. If the list is empty or not specified,
118
- * it defaults to the list of keys in `a`.
119
- * @return {Boolean} Returns `true` if the keys match, otherwise `false`.
120
- */
121
- function equalForKeys(a, b, keys) {
122
- if (!keys) {
123
- keys = [];
124
- for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility
125
- }
126
-
127
- for (var i=0; i<keys.length; i++) {
128
- var k = keys[i];
129
- if (a[k] != b[k]) return false; // Not '===', values aren't necessarily normalized
130
- }
131
- return true;
132
- }
133
-
134
- /**
135
- * Returns the subset of an object, based on a list of keys.
136
- *
137
- * @param {Array} keys
138
- * @param {Object} values
139
- * @return {Boolean} Returns a subset of `values`.
140
- */
141
- function filterByKeys(keys, values) {
142
- var filtered = {};
143
-
144
- forEach(keys, function (name) {
145
- filtered[name] = values[name];
146
- });
147
- return filtered;
148
- }
149
-
150
- // like _.indexBy
151
- // when you know that your index values will be unique, or you want last-one-in to win
152
- function indexBy(array, propName) {
153
- var result = {};
154
- forEach(array, function(item) {
155
- result[item[propName]] = item;
156
- });
157
- return result;
158
- }
159
-
160
- // extracted from underscore.js
161
- // Return a copy of the object only containing the whitelisted properties.
162
- function pick(obj) {
163
- var copy = {};
164
- var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
165
- forEach(keys, function(key) {
166
- if (key in obj) copy[key] = obj[key];
167
- });
168
- return copy;
169
- }
170
-
171
- // extracted from underscore.js
172
- // Return a copy of the object omitting the blacklisted properties.
173
- function omit(obj) {
174
- var copy = {};
175
- var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));
176
- for (var key in obj) {
177
- if (indexOf(keys, key) == -1) copy[key] = obj[key];
178
- }
179
- return copy;
180
- }
181
-
182
- function pluck(collection, key) {
183
- var result = isArray(collection) ? [] : {};
184
-
185
- forEach(collection, function(val, i) {
186
- result[i] = isFunction(key) ? key(val) : val[key];
187
- });
188
- return result;
189
- }
190
-
191
- function filter(collection, callback) {
192
- var array = isArray(collection);
193
- var result = array ? [] : {};
194
- forEach(collection, function(val, i) {
195
- if (callback(val, i)) {
196
- result[array ? result.length : i] = val;
197
- }
198
- });
199
- return result;
200
- }
201
-
202
- function map(collection, callback) {
203
- var result = isArray(collection) ? [] : {};
204
-
205
- forEach(collection, function(val, i) {
206
- result[i] = callback(val, i);
207
- });
208
- return result;
209
- }
210
-
211
- /**
212
- * @ngdoc overview
213
- * @name ui.router.util
214
- *
215
- * @description
216
- * # ui.router.util sub-module
217
- *
218
- * This module is a dependency of other sub-modules. Do not include this module as a dependency
219
- * in your angular app (use {@link ui.router} module instead).
220
- *
221
- */
222
- angular.module('ui.router.util', ['ng']);
223
-
224
- /**
225
- * @ngdoc overview
226
- * @name ui.router.router
227
- *
228
- * @requires ui.router.util
229
- *
230
- * @description
231
- * # ui.router.router sub-module
232
- *
233
- * This module is a dependency of other sub-modules. Do not include this module as a dependency
234
- * in your angular app (use {@link ui.router} module instead).
235
- */
236
- angular.module('ui.router.router', ['ui.router.util']);
237
-
238
- /**
239
- * @ngdoc overview
240
- * @name ui.router.state
241
- *
242
- * @requires ui.router.router
243
- * @requires ui.router.util
244
- *
245
- * @description
246
- * # ui.router.state sub-module
247
- *
248
- * This module is a dependency of the main ui.router module. Do not include this module as a dependency
249
- * in your angular app (use {@link ui.router} module instead).
250
- *
251
- */
252
- angular.module('ui.router.state', ['ui.router.router', 'ui.router.util']);
253
-
254
- /**
255
- * @ngdoc overview
256
- * @name ui.router
257
- *
258
- * @requires ui.router.state
259
- *
260
- * @description
261
- * # ui.router
262
- *
263
- * ## The main module for ui.router
264
- * There are several sub-modules included with the ui.router module, however only this module is needed
265
- * as a dependency within your angular app. The other modules are for organization purposes.
266
- *
267
- * The modules are:
268
- * * ui.router - the main "umbrella" module
269
- * * ui.router.router -
270
- *
271
- * *You'll need to include **only** this module as the dependency within your angular app.*
272
- *
273
- * <pre>
274
- * <!doctype html>
275
- * <html ng-app="myApp">
276
- * <head>
277
- * <script src="js/angular.js"></script>
278
- * <!-- Include the ui-router script -->
279
- * <script src="js/angular-ui-router.min.js"></script>
280
- * <script>
281
- * // ...and add 'ui.router' as a dependency
282
- * var myApp = angular.module('myApp', ['ui.router']);
283
- * </script>
284
- * </head>
285
- * <body>
286
- * </body>
287
- * </html>
288
- * </pre>
289
- */
290
- angular.module('ui.router', ['ui.router.state']);
291
-
292
- angular.module('ui.router.compat', ['ui.router']);