bastion 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (278) hide show
  1. checksums.yaml +15 -0
  2. data/.jshintrc +35 -0
  3. data/Gruntfile.js +24 -0
  4. data/LICENSE +339 -0
  5. data/README.md +8 -0
  6. data/Rakefile +53 -0
  7. data/app/assets/javascripts/bastion/auth/auth.module.js +87 -0
  8. data/app/assets/javascripts/bastion/auth/authorization.service.js +48 -0
  9. data/app/assets/javascripts/bastion/bastion-bootstrap.js +32 -0
  10. data/app/assets/javascripts/bastion/bastion-resource.factory.js +39 -0
  11. data/app/assets/javascripts/bastion/bastion.js +52 -0
  12. data/app/assets/javascripts/bastion/bastion.module.js +213 -0
  13. data/app/assets/javascripts/bastion/i18n/README +9 -0
  14. data/app/assets/javascripts/bastion/i18n/i18n.module.js +24 -0
  15. data/app/assets/javascripts/bastion/i18n/katello.pot +968 -0
  16. data/app/assets/javascripts/bastion/i18n/locale/README +1 -0
  17. data/app/assets/javascripts/bastion/i18n/translate.service.js +14 -0
  18. data/app/assets/javascripts/bastion/i18n/translations.js +3 -0
  19. data/app/assets/javascripts/bastion/i18n/zanata.xml +28 -0
  20. data/app/assets/javascripts/bastion/incubator/alch-alert.directive.js +67 -0
  21. data/app/assets/javascripts/bastion/incubator/alch-container-scroll.directive.js +44 -0
  22. data/app/assets/javascripts/bastion/incubator/alch-dropdown.directive.js +28 -0
  23. data/app/assets/javascripts/bastion/incubator/alch-edit.directive.js +361 -0
  24. data/app/assets/javascripts/bastion/incubator/alch-flyout.directive.js +19 -0
  25. data/app/assets/javascripts/bastion/incubator/alch-form-buttons.directive.js +60 -0
  26. data/app/assets/javascripts/bastion/incubator/alch-form-group.directive.js +87 -0
  27. data/app/assets/javascripts/bastion/incubator/alch-infinite-scroll.directive.js +84 -0
  28. data/app/assets/javascripts/bastion/incubator/alch-menu.directive.js +56 -0
  29. data/app/assets/javascripts/bastion/incubator/alch-modal.directive.js +80 -0
  30. data/app/assets/javascripts/bastion/incubator/alch-save-control.directive.js +42 -0
  31. data/app/assets/javascripts/bastion/incubator/alch-table.directive.js +295 -0
  32. data/app/assets/javascripts/bastion/incubator/format/alch-format.module.js +21 -0
  33. data/app/assets/javascripts/bastion/incubator/format/array-to-string.filter.js +30 -0
  34. data/app/assets/javascripts/bastion/incubator/format/boolean-to-yes-no.filter.js +34 -0
  35. data/app/assets/javascripts/bastion/incubator/format/capitalize.filter.js +32 -0
  36. data/app/assets/javascripts/bastion/incubator/format/key-value-to-string.filter.js +40 -0
  37. data/app/assets/javascripts/bastion/incubator/format/unlimitedFilter.filter.js +35 -0
  38. data/app/assets/javascripts/bastion/incubator/stylesheets/alch-edit.scss +34 -0
  39. data/app/assets/javascripts/bastion/incubator/stylesheets/header.scss +207 -0
  40. data/app/assets/javascripts/bastion/incubator/views/alch-alert.html +6 -0
  41. data/app/assets/javascripts/bastion/incubator/views/alch-dropdown.html +19 -0
  42. data/app/assets/javascripts/bastion/incubator/views/alch-edit-add-item.html +21 -0
  43. data/app/assets/javascripts/bastion/incubator/views/alch-edit-add-remove-cancel.html +28 -0
  44. data/app/assets/javascripts/bastion/incubator/views/alch-edit-checkbox.html +6 -0
  45. data/app/assets/javascripts/bastion/incubator/views/alch-edit-custom.html +8 -0
  46. data/app/assets/javascripts/bastion/incubator/views/alch-edit-multiselect.html +17 -0
  47. data/app/assets/javascripts/bastion/incubator/views/alch-edit-save-cancel.html +20 -0
  48. data/app/assets/javascripts/bastion/incubator/views/alch-edit-select.html +10 -0
  49. data/app/assets/javascripts/bastion/incubator/views/alch-edit-text.html +6 -0
  50. data/app/assets/javascripts/bastion/incubator/views/alch-edit-textarea.html +6 -0
  51. data/app/assets/javascripts/bastion/incubator/views/alch-edit.html +18 -0
  52. data/app/assets/javascripts/bastion/incubator/views/alch-flyout.html +10 -0
  53. data/app/assets/javascripts/bastion/incubator/views/alch-form-buttons.html +10 -0
  54. data/app/assets/javascripts/bastion/incubator/views/alch-form-group.html +9 -0
  55. data/app/assets/javascripts/bastion/incubator/views/alch-menu.html +18 -0
  56. data/app/assets/javascripts/bastion/incubator/views/alch-modal-remove.html +13 -0
  57. data/app/assets/javascripts/bastion/incubator/views/alch-save-control.html +18 -0
  58. data/app/assets/javascripts/bastion/layouts/details-nutupane.html +73 -0
  59. data/app/assets/javascripts/bastion/layouts/nutupane.html +63 -0
  60. data/app/assets/javascripts/bastion/layouts/select-all-results.html +9 -0
  61. data/app/assets/javascripts/bastion/menu/menu-expander.service.js +51 -0
  62. data/app/assets/javascripts/bastion/menu/menu.module.js +26 -0
  63. data/app/assets/javascripts/bastion/utils/as.filter.js +33 -0
  64. data/app/assets/javascripts/bastion/utils/form-utils.service.js +53 -0
  65. data/app/assets/javascripts/bastion/utils/utils.module.js +21 -0
  66. data/app/assets/javascripts/bastion/widgets/current-tasks.directive.js +67 -0
  67. data/app/assets/javascripts/bastion/widgets/nutupane-table.directive.js +59 -0
  68. data/app/assets/javascripts/bastion/widgets/nutupane.factory.js +316 -0
  69. data/app/assets/javascripts/bastion/widgets/page-title.directive.js +61 -0
  70. data/app/assets/javascripts/bastion/widgets/page-title.service.js +42 -0
  71. data/app/assets/javascripts/bastion/widgets/path-selector.directive.js +109 -0
  72. data/app/assets/javascripts/bastion/widgets/views/current-tasks.html +23 -0
  73. data/app/assets/javascripts/bastion/widgets/views/path-selector.html +11 -0
  74. data/app/assets/javascripts/bastion/widgets/widgets.module.js +24 -0
  75. data/app/assets/stylesheets/bastion/animations.less +15 -0
  76. data/app/assets/stylesheets/bastion/bastion.less +160 -0
  77. data/app/assets/stylesheets/bastion/forms.less +41 -0
  78. data/app/assets/stylesheets/bastion/gpg-keys.less +36 -0
  79. data/app/assets/stylesheets/bastion/helpers.less +6 -0
  80. data/app/assets/stylesheets/bastion/mixins.less +15 -0
  81. data/app/assets/stylesheets/bastion/nutupane.less +382 -0
  82. data/app/assets/stylesheets/bastion/overrides.less +54 -0
  83. data/app/assets/stylesheets/bastion/path-selector.less +123 -0
  84. data/app/assets/stylesheets/bastion/systems.less +35 -0
  85. data/app/assets/stylesheets/bastion/tasks.less +23 -0
  86. data/app/assets/stylesheets/bastion/typography.less +31 -0
  87. data/app/assets/stylesheets/bastion/variables.less +3 -0
  88. data/app/controllers/bastion/bastion_controller.rb +24 -0
  89. data/app/views/bastion/layouts/application.html.erb +32 -0
  90. data/app/views/bastion/layouts/application_ie.html.erb +5 -0
  91. data/bastion.js +26 -0
  92. data/bower.json +94 -0
  93. data/config/routes.rb +25 -0
  94. data/config/routes/mount_engine.rb +3 -0
  95. data/grunt/bower.js +20 -0
  96. data/grunt/htmlhint.js +15 -0
  97. data/grunt/jshint.js +9 -0
  98. data/grunt/karma.js +83 -0
  99. data/lib/bastion.rb +17 -0
  100. data/lib/bastion/engine.rb +37 -0
  101. data/lib/bastion/version.rb +3 -0
  102. data/package.json +29 -0
  103. data/test/auth/authorization.service.test.js +63 -0
  104. data/test/bastion/bastion-resource.factory.test.js +31 -0
  105. data/test/bastion/test-constants.js +30 -0
  106. data/test/i18n/translate.service.test.js +31 -0
  107. data/test/incubator/alch-alert.directive.test.js +84 -0
  108. data/test/incubator/alch-container-scroll.directive.test.js +68 -0
  109. data/test/incubator/alch-dropdown.directive.test.js +113 -0
  110. data/test/incubator/alch-edit.directive.test.js +320 -0
  111. data/test/incubator/alch-flyout.directive.test.js +73 -0
  112. data/test/incubator/alch-form-buttons.directive.test.js +55 -0
  113. data/test/incubator/alch-form-group.directive.test.js +76 -0
  114. data/test/incubator/alch-infinite-scroll.directive.test.js +123 -0
  115. data/test/incubator/alch-menu.directive.test.js +94 -0
  116. data/test/incubator/alch-modal.directive.test.js +81 -0
  117. data/test/incubator/alch-table.directive.test.js +270 -0
  118. data/test/incubator/format/array-to-string.filter.test.js +38 -0
  119. data/test/incubator/format/boolean-to-yes-no.filter.test.js +41 -0
  120. data/test/incubator/format/capitalize.filter.test.js +35 -0
  121. data/test/incubator/format/key-value-to-string.filter.test.js +60 -0
  122. data/test/incubator/format/unlimited-filter.filter.test.js +31 -0
  123. data/test/incubator/nutupane-table.directive.test.js +69 -0
  124. data/test/incubator/nutupane.factory.test.js +307 -0
  125. data/test/menu/menu-expander.service.test.js +74 -0
  126. data/test/test-mocks.module.js +268 -0
  127. data/test/utils/as.filter.test.js +33 -0
  128. data/test/utils/form-utils.service.test.js +52 -0
  129. data/test/widgets/page-title.directive.test.js +54 -0
  130. data/test/widgets/page-title.service.test.js +51 -0
  131. data/test/widgets/path-selector.directive.test.js +136 -0
  132. data/vendor/assets/fonts/bastion/bootstrap/glyphicons-halflings-regular.eot +0 -0
  133. data/vendor/assets/fonts/bastion/bootstrap/glyphicons-halflings-regular.svg +229 -0
  134. data/vendor/assets/fonts/bastion/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  135. data/vendor/assets/fonts/bastion/bootstrap/glyphicons-halflings-regular.woff +0 -0
  136. data/vendor/assets/fonts/bastion/font-awesome/FontAwesome.otf +0 -0
  137. data/vendor/assets/fonts/bastion/font-awesome/fontawesome-webfont.eot +0 -0
  138. data/vendor/assets/fonts/bastion/font-awesome/fontawesome-webfont.svg +399 -0
  139. data/vendor/assets/fonts/bastion/font-awesome/fontawesome-webfont.ttf +0 -0
  140. data/vendor/assets/fonts/bastion/font-awesome/fontawesome-webfont.woff +0 -0
  141. data/vendor/assets/fonts/bastion/rcue/OpenSans-Bold-webfont.eot +0 -0
  142. data/vendor/assets/fonts/bastion/rcue/OpenSans-Bold-webfont.svg +146 -0
  143. data/vendor/assets/fonts/bastion/rcue/OpenSans-Bold-webfont.ttf +0 -0
  144. data/vendor/assets/fonts/bastion/rcue/OpenSans-Bold-webfont.woff +0 -0
  145. data/vendor/assets/fonts/bastion/rcue/OpenSans-BoldItalic-webfont.eot +0 -0
  146. data/vendor/assets/fonts/bastion/rcue/OpenSans-BoldItalic-webfont.svg +146 -0
  147. data/vendor/assets/fonts/bastion/rcue/OpenSans-BoldItalic-webfont.ttf +0 -0
  148. data/vendor/assets/fonts/bastion/rcue/OpenSans-BoldItalic-webfont.woff +0 -0
  149. data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBold-webfont.eot +0 -0
  150. data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBold-webfont.svg +146 -0
  151. data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBold-webfont.ttf +0 -0
  152. data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBold-webfont.woff +0 -0
  153. data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBoldItalic-webfont.eot +0 -0
  154. data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBoldItalic-webfont.svg +146 -0
  155. data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBoldItalic-webfont.ttf +0 -0
  156. data/vendor/assets/fonts/bastion/rcue/OpenSans-ExtraBoldItalic-webfont.woff +0 -0
  157. data/vendor/assets/fonts/bastion/rcue/OpenSans-Italic-webfont.eot +0 -0
  158. data/vendor/assets/fonts/bastion/rcue/OpenSans-Italic-webfont.svg +146 -0
  159. data/vendor/assets/fonts/bastion/rcue/OpenSans-Italic-webfont.ttf +0 -0
  160. data/vendor/assets/fonts/bastion/rcue/OpenSans-Italic-webfont.woff +0 -0
  161. data/vendor/assets/fonts/bastion/rcue/OpenSans-Light-webfont.eot +0 -0
  162. data/vendor/assets/fonts/bastion/rcue/OpenSans-Light-webfont.svg +146 -0
  163. data/vendor/assets/fonts/bastion/rcue/OpenSans-Light-webfont.ttf +0 -0
  164. data/vendor/assets/fonts/bastion/rcue/OpenSans-Light-webfont.woff +0 -0
  165. data/vendor/assets/fonts/bastion/rcue/OpenSans-LightItalic-webfont.eot +0 -0
  166. data/vendor/assets/fonts/bastion/rcue/OpenSans-LightItalic-webfont.svg +146 -0
  167. data/vendor/assets/fonts/bastion/rcue/OpenSans-LightItalic-webfont.ttf +0 -0
  168. data/vendor/assets/fonts/bastion/rcue/OpenSans-LightItalic-webfont.woff +0 -0
  169. data/vendor/assets/fonts/bastion/rcue/OpenSans-Regular-webfont.eot +0 -0
  170. data/vendor/assets/fonts/bastion/rcue/OpenSans-Regular-webfont.svg +146 -0
  171. data/vendor/assets/fonts/bastion/rcue/OpenSans-Regular-webfont.ttf +0 -0
  172. data/vendor/assets/fonts/bastion/rcue/OpenSans-Regular-webfont.woff +0 -0
  173. data/vendor/assets/fonts/bastion/rcue/OpenSans-Semibold-webfont.eot +0 -0
  174. data/vendor/assets/fonts/bastion/rcue/OpenSans-Semibold-webfont.svg +146 -0
  175. data/vendor/assets/fonts/bastion/rcue/OpenSans-Semibold-webfont.ttf +0 -0
  176. data/vendor/assets/fonts/bastion/rcue/OpenSans-Semibold-webfont.woff +0 -0
  177. data/vendor/assets/fonts/bastion/rcue/OpenSans-SemiboldItalic-webfont.eot +0 -0
  178. data/vendor/assets/fonts/bastion/rcue/OpenSans-SemiboldItalic-webfont.svg +146 -0
  179. data/vendor/assets/fonts/bastion/rcue/OpenSans-SemiboldItalic-webfont.ttf +0 -0
  180. data/vendor/assets/fonts/bastion/rcue/OpenSans-SemiboldItalic-webfont.woff +0 -0
  181. data/vendor/assets/fonts/bastion/rcue/Overpass-Bold-webfont.eot +0 -0
  182. data/vendor/assets/fonts/bastion/rcue/Overpass-Bold-webfont.svg +454 -0
  183. data/vendor/assets/fonts/bastion/rcue/Overpass-Bold-webfont.ttf +0 -0
  184. data/vendor/assets/fonts/bastion/rcue/Overpass-Bold-webfont.woff +0 -0
  185. data/vendor/assets/fonts/bastion/rcue/Overpass-Regular-webfont.eot +0 -0
  186. data/vendor/assets/fonts/bastion/rcue/Overpass-Regular-webfont.svg +454 -0
  187. data/vendor/assets/fonts/bastion/rcue/Overpass-Regular-webfont.ttf +0 -0
  188. data/vendor/assets/fonts/bastion/rcue/Overpass-Regular-webfont.woff +0 -0
  189. data/vendor/assets/javascripts/bastion/alchemy/alchemy.js +20 -0
  190. data/vendor/assets/javascripts/bastion/angular-animate/angular-animate.js +1226 -0
  191. data/vendor/assets/javascripts/bastion/angular-blocks/angular-blocks.js +79 -0
  192. data/vendor/assets/javascripts/bastion/angular-bootstrap/ui-bootstrap-tpls.js +3677 -0
  193. data/vendor/assets/javascripts/bastion/angular-bootstrap/ui-bootstrap.js +3427 -0
  194. data/vendor/assets/javascripts/bastion/angular-gettext/angular-gettext.js +345 -0
  195. data/vendor/assets/javascripts/bastion/angular-resource/angular-resource.js +594 -0
  196. data/vendor/assets/javascripts/bastion/angular-route/angular-route.js +920 -0
  197. data/vendor/assets/javascripts/bastion/angular-sanitize/angular-sanitize.js +622 -0
  198. data/vendor/assets/javascripts/bastion/angular-ui-bootstrap/datepicker.js +447 -0
  199. data/vendor/assets/javascripts/bastion/angular-ui-bootstrap/timepicker.js +232 -0
  200. data/vendor/assets/javascripts/bastion/angular-ui-router/angular-ui-router.js +3223 -0
  201. data/vendor/assets/javascripts/bastion/angular-uuid4/angular-uuid4.js +21 -0
  202. data/vendor/assets/javascripts/bastion/angular/angular.js +20560 -0
  203. data/vendor/assets/javascripts/bastion/es5-shim/es5-shim.js +1216 -0
  204. data/vendor/assets/javascripts/bastion/json3/json3.js +861 -0
  205. data/vendor/assets/javascripts/bastion/ngUpload/ng-upload.js +205 -0
  206. data/vendor/assets/javascripts/bastion/underscore/underscore.js +1276 -0
  207. data/vendor/assets/stylesheets/bastion/alchemy/_colors.scss +99 -0
  208. data/vendor/assets/stylesheets/bastion/alchemy/_media_object.scss +22 -0
  209. data/vendor/assets/stylesheets/bastion/alchemy/_mixins.scss +24 -0
  210. data/vendor/assets/stylesheets/bastion/alchemy/_normalize.scss +396 -0
  211. data/vendor/assets/stylesheets/bastion/alchemy/_vars.scss +31 -0
  212. data/vendor/assets/stylesheets/bastion/alchemy/alchemy.scss +8 -0
  213. data/vendor/assets/stylesheets/bastion/bootstrap/alerts.less +67 -0
  214. data/vendor/assets/stylesheets/bastion/bootstrap/badges.less +51 -0
  215. data/vendor/assets/stylesheets/bastion/bootstrap/bootstrap.less +49 -0
  216. data/vendor/assets/stylesheets/bastion/bootstrap/breadcrumbs.less +23 -0
  217. data/vendor/assets/stylesheets/bastion/bootstrap/button-groups.less +227 -0
  218. data/vendor/assets/stylesheets/bastion/bootstrap/buttons.less +155 -0
  219. data/vendor/assets/stylesheets/bastion/bootstrap/carousel.less +232 -0
  220. data/vendor/assets/stylesheets/bastion/bootstrap/close.less +33 -0
  221. data/vendor/assets/stylesheets/bastion/bootstrap/code.less +53 -0
  222. data/vendor/assets/stylesheets/bastion/bootstrap/component-animations.less +29 -0
  223. data/vendor/assets/stylesheets/bastion/bootstrap/dropdowns.less +187 -0
  224. data/vendor/assets/stylesheets/bastion/bootstrap/forms.less +375 -0
  225. data/vendor/assets/stylesheets/bastion/bootstrap/glyphicons.less +237 -0
  226. data/vendor/assets/stylesheets/bastion/bootstrap/grid.less +79 -0
  227. data/vendor/assets/stylesheets/bastion/bootstrap/input-groups.less +136 -0
  228. data/vendor/assets/stylesheets/bastion/bootstrap/jumbotron.less +46 -0
  229. data/vendor/assets/stylesheets/bastion/bootstrap/labels.less +64 -0
  230. data/vendor/assets/stylesheets/bastion/bootstrap/list-group.less +88 -0
  231. data/vendor/assets/stylesheets/bastion/bootstrap/media.less +56 -0
  232. data/vendor/assets/stylesheets/bastion/bootstrap/mixins.less +845 -0
  233. data/vendor/assets/stylesheets/bastion/bootstrap/modals.less +129 -0
  234. data/vendor/assets/stylesheets/bastion/bootstrap/navbar.less +612 -0
  235. data/vendor/assets/stylesheets/bastion/bootstrap/navs.less +242 -0
  236. data/vendor/assets/stylesheets/bastion/bootstrap/normalize.less +406 -0
  237. data/vendor/assets/stylesheets/bastion/bootstrap/pager.less +55 -0
  238. data/vendor/assets/stylesheets/bastion/bootstrap/pagination.less +85 -0
  239. data/vendor/assets/stylesheets/bastion/bootstrap/panels.less +182 -0
  240. data/vendor/assets/stylesheets/bastion/bootstrap/popovers.less +133 -0
  241. data/vendor/assets/stylesheets/bastion/bootstrap/print.less +105 -0
  242. data/vendor/assets/stylesheets/bastion/bootstrap/progress-bars.less +80 -0
  243. data/vendor/assets/stylesheets/bastion/bootstrap/responsive-utilities.less +209 -0
  244. data/vendor/assets/stylesheets/bastion/bootstrap/scaffolding.less +119 -0
  245. data/vendor/assets/stylesheets/bastion/bootstrap/tables.less +231 -0
  246. data/vendor/assets/stylesheets/bastion/bootstrap/theme.less +247 -0
  247. data/vendor/assets/stylesheets/bastion/bootstrap/thumbnails.less +36 -0
  248. data/vendor/assets/stylesheets/bastion/bootstrap/tooltip.less +95 -0
  249. data/vendor/assets/stylesheets/bastion/bootstrap/type.less +281 -0
  250. data/vendor/assets/stylesheets/bastion/bootstrap/utilities.less +56 -0
  251. data/vendor/assets/stylesheets/bastion/bootstrap/variables.less +642 -0
  252. data/vendor/assets/stylesheets/bastion/bootstrap/wells.less +29 -0
  253. data/vendor/assets/stylesheets/bastion/font-awesome/less/bootstrap.less +84 -0
  254. data/vendor/assets/stylesheets/bastion/font-awesome/less/core.less +129 -0
  255. data/vendor/assets/stylesheets/bastion/font-awesome/less/extras.less +93 -0
  256. data/vendor/assets/stylesheets/bastion/font-awesome/less/font-awesome-ie7.less +1953 -0
  257. data/vendor/assets/stylesheets/bastion/font-awesome/less/font-awesome.less +33 -0
  258. data/vendor/assets/stylesheets/bastion/font-awesome/less/icons.less +381 -0
  259. data/vendor/assets/stylesheets/bastion/font-awesome/less/mixins.less +48 -0
  260. data/vendor/assets/stylesheets/bastion/font-awesome/less/path.less +14 -0
  261. data/vendor/assets/stylesheets/bastion/font-awesome/less/variables.less +735 -0
  262. data/vendor/assets/stylesheets/bastion/font-awesome/scss/_bootstrap.scss +84 -0
  263. data/vendor/assets/stylesheets/bastion/font-awesome/scss/_core.scss +129 -0
  264. data/vendor/assets/stylesheets/bastion/font-awesome/scss/_extras.scss +93 -0
  265. data/vendor/assets/stylesheets/bastion/font-awesome/scss/_icons.scss +381 -0
  266. data/vendor/assets/stylesheets/bastion/font-awesome/scss/_mixins.scss +48 -0
  267. data/vendor/assets/stylesheets/bastion/font-awesome/scss/_path.scss +14 -0
  268. data/vendor/assets/stylesheets/bastion/font-awesome/scss/_variables.scss +734 -0
  269. data/vendor/assets/stylesheets/bastion/font-awesome/scss/font-awesome-ie7.scss +1953 -0
  270. data/vendor/assets/stylesheets/bastion/font-awesome/scss/font-awesome.scss +33 -0
  271. data/vendor/assets/stylesheets/bastion/rcue/buttons.less +44 -0
  272. data/vendor/assets/stylesheets/bastion/rcue/fonts.less +52 -0
  273. data/vendor/assets/stylesheets/bastion/rcue/forms.less +19 -0
  274. data/vendor/assets/stylesheets/bastion/rcue/mixins.less +50 -0
  275. data/vendor/assets/stylesheets/bastion/rcue/navbar.less +481 -0
  276. data/vendor/assets/stylesheets/bastion/rcue/rcue.less +15 -0
  277. data/vendor/assets/stylesheets/bastion/rcue/variables.less +47 -0
  278. metadata +376 -0
@@ -0,0 +1,345 @@
1
+ angular.module('gettext', []);
2
+ angular.module('gettext').constant('gettext', function (str) {
3
+ /*
4
+ * Does nothing, simply returns the input string.
5
+ *
6
+ * This function serves as a marker for `grunt-angular-gettext` to know that
7
+ * this string should be extracted for translations.
8
+ */
9
+ return str;
10
+ });
11
+ angular.module('gettext').factory('gettextCatalog', [
12
+ 'gettextPlurals',
13
+ '$http',
14
+ '$cacheFactory',
15
+ '$interpolate',
16
+ '$rootScope',
17
+ function (gettextPlurals, $http, $cacheFactory, $interpolate, $rootScope) {
18
+ var catalog;
19
+ var prefixDebug = function (string) {
20
+ if (catalog.debug && catalog.currentLanguage !== catalog.baseLanguage) {
21
+ return '[MISSING]: ' + string;
22
+ } else {
23
+ return string;
24
+ }
25
+ };
26
+ catalog = {
27
+ debug: false,
28
+ strings: {},
29
+ baseLanguage: 'en',
30
+ currentLanguage: 'en',
31
+ cache: $cacheFactory('strings'),
32
+ setCurrentLanguage: function (lang) {
33
+ this.currentLanguage = lang;
34
+ $rootScope.$broadcast('gettextLanguageChanged');
35
+ },
36
+ setStrings: function (language, strings) {
37
+ if (!this.strings[language]) {
38
+ this.strings[language] = {};
39
+ }
40
+ for (var key in strings) {
41
+ var val = strings[key];
42
+ if (typeof val === 'string') {
43
+ this.strings[language][key] = [val];
44
+ } else {
45
+ this.strings[language][key] = val;
46
+ }
47
+ }
48
+ },
49
+ getStringForm: function (string, n) {
50
+ var stringTable = this.strings[this.currentLanguage] || {};
51
+ var plurals = stringTable[string] || [];
52
+ return plurals[n];
53
+ },
54
+ getString: function (string, context) {
55
+ string = this.getStringForm(string, 0) || prefixDebug(string);
56
+ return context ? $interpolate(string)(context) : string;
57
+ },
58
+ getPlural: function (n, string, stringPlural, context) {
59
+ var form = gettextPlurals(this.currentLanguage, n);
60
+ string = this.getStringForm(string, form) || prefixDebug(n === 1 ? string : stringPlural);
61
+ return context ? $interpolate(string)(context) : string;
62
+ },
63
+ loadRemote: function (url) {
64
+ return $http({
65
+ method: 'GET',
66
+ url: url,
67
+ cache: catalog.cache
68
+ }).success(function (data) {
69
+ for (var lang in data) {
70
+ catalog.setStrings(lang, data[lang]);
71
+ }
72
+ });
73
+ }
74
+ };
75
+ return catalog;
76
+ }
77
+ ]);
78
+ angular.module('gettext').directive('translate', [
79
+ 'gettextCatalog',
80
+ '$parse',
81
+ '$animate',
82
+ function (gettextCatalog, $parse, $animate) {
83
+ // Trim polyfill for old browsers (instead of jQuery)
84
+ // Based on AngularJS-v1.2.2 (angular.js#620)
85
+ var trim = function () {
86
+ if (!String.prototype.trim) {
87
+ return function (value) {
88
+ return typeof value === 'string' ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value;
89
+ };
90
+ }
91
+ return function (value) {
92
+ return typeof value === 'string' ? value.trim() : value;
93
+ };
94
+ }();
95
+ function assert(condition, missing, found) {
96
+ if (!condition) {
97
+ throw new Error('You should add a ' + missing + ' attribute whenever you add a ' + found + ' attribute.');
98
+ }
99
+ }
100
+ return {
101
+ restrict: 'A',
102
+ terminal: true,
103
+ priority: 350,
104
+ transclude: 'element',
105
+ link: function (scope, element, attrs, ctrl, transclude) {
106
+ // Validate attributes
107
+ assert(!attrs.translatePlural || attrs.translateN, 'translate-n', 'translate-plural');
108
+ assert(!attrs.translateN || attrs.translatePlural, 'translate-plural', 'translate-n');
109
+ var currentEl = null;
110
+ var countFn = $parse(attrs.translateN);
111
+ var pluralScope = null;
112
+ function update() {
113
+ var prevEl = currentEl;
114
+ currentEl = transclude(scope, function (clone) {
115
+ var msgid = trim(clone.html());
116
+ // Fetch correct translated string.
117
+ var translated;
118
+ if (attrs.translatePlural) {
119
+ scope = pluralScope || (pluralScope = scope.$new());
120
+ scope.$count = countFn(scope);
121
+ translated = gettextCatalog.getPlural(scope.$count, msgid, attrs.translatePlural);
122
+ } else {
123
+ translated = gettextCatalog.getString(msgid);
124
+ }
125
+ clone.prop('__msgstr', translated);
126
+ $animate.enter(clone, null, element);
127
+ if (prevEl !== null) {
128
+ $animate.leave(prevEl, function () {
129
+ prevEl = null;
130
+ });
131
+ }
132
+ });
133
+ }
134
+ if (attrs.translateN) {
135
+ scope.$watch(attrs.translateN, update);
136
+ }
137
+ scope.$on('gettextLanguageChanged', update);
138
+ update();
139
+ }
140
+ };
141
+ }
142
+ ]).directive('translate', [
143
+ '$compile',
144
+ function ($compile) {
145
+ return {
146
+ restrict: 'A',
147
+ priority: -350,
148
+ link: function (scope, element) {
149
+ var msgstr = element.prop('__msgstr');
150
+ element.html(msgstr);
151
+ $compile(element.contents())(scope);
152
+ }
153
+ };
154
+ }
155
+ ]);
156
+ angular.module('gettext').filter('translate', [
157
+ 'gettextCatalog',
158
+ function (gettextCatalog) {
159
+ return function (input) {
160
+ return gettextCatalog.getString(input);
161
+ };
162
+ }
163
+ ]);
164
+ // Do not edit this file, it is autogenerated using genplurals.py!
165
+ angular.module('gettext').factory('gettextPlurals', function () {
166
+ return function (langCode, n) {
167
+ switch (langCode) {
168
+ case 'ay':
169
+ // Aymará
170
+ case 'bo':
171
+ // Tibetan
172
+ case 'cgg':
173
+ // Chiga
174
+ case 'dz':
175
+ // Dzongkha
176
+ case 'fa':
177
+ // Persian
178
+ case 'id':
179
+ // Indonesian
180
+ case 'ja':
181
+ // Japanese
182
+ case 'jbo':
183
+ // Lojban
184
+ case 'ka':
185
+ // Georgian
186
+ case 'kk':
187
+ // Kazakh
188
+ case 'km':
189
+ // Khmer
190
+ case 'ko':
191
+ // Korean
192
+ case 'ky':
193
+ // Kyrgyz
194
+ case 'lo':
195
+ // Lao
196
+ case 'ms':
197
+ // Malay
198
+ case 'my':
199
+ // Burmese
200
+ case 'sah':
201
+ // Yakut
202
+ case 'su':
203
+ // Sundanese
204
+ case 'th':
205
+ // Thai
206
+ case 'tt':
207
+ // Tatar
208
+ case 'ug':
209
+ // Uyghur
210
+ case 'vi':
211
+ // Vietnamese
212
+ case 'wo':
213
+ // Wolof
214
+ case 'zh':
215
+ // Chinese
216
+ // 1 form
217
+ return 0;
218
+ case 'is':
219
+ // Icelandic
220
+ // 2 forms
221
+ return n % 10 != 1 || n % 100 == 11 ? 1 : 0;
222
+ case 'jv':
223
+ // Javanese
224
+ // 2 forms
225
+ return n != 0 ? 1 : 0;
226
+ case 'mk':
227
+ // Macedonian
228
+ // 2 forms
229
+ return n == 1 || n % 10 == 1 ? 0 : 1;
230
+ case 'ach':
231
+ // Acholi
232
+ case 'ak':
233
+ // Akan
234
+ case 'am':
235
+ // Amharic
236
+ case 'arn':
237
+ // Mapudungun
238
+ case 'br':
239
+ // Breton
240
+ case 'fil':
241
+ // Filipino
242
+ case 'fr':
243
+ // French
244
+ case 'gun':
245
+ // Gun
246
+ case 'ln':
247
+ // Lingala
248
+ case 'mfe':
249
+ // Mauritian Creole
250
+ case 'mg':
251
+ // Malagasy
252
+ case 'mi':
253
+ // Maori
254
+ case 'oc':
255
+ // Occitan
256
+ case 'pt_BR':
257
+ // Brazilian Portuguese
258
+ case 'tg':
259
+ // Tajik
260
+ case 'ti':
261
+ // Tigrinya
262
+ case 'tr':
263
+ // Turkish
264
+ case 'uz':
265
+ // Uzbek
266
+ case 'wa':
267
+ // Walloon
268
+ case 'zh':
269
+ // Chinese
270
+ // 2 forms
271
+ return n > 1 ? 1 : 0;
272
+ case 'lv':
273
+ // Latvian
274
+ // 3 forms
275
+ return n % 10 == 1 && n % 100 != 11 ? 0 : n != 0 ? 1 : 2;
276
+ case 'lt':
277
+ // Lithuanian
278
+ // 3 forms
279
+ return n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2;
280
+ case 'be':
281
+ // Belarusian
282
+ case 'bs':
283
+ // Bosnian
284
+ case 'hr':
285
+ // Croatian
286
+ case 'ru':
287
+ // Russian
288
+ case 'sr':
289
+ // Serbian
290
+ case 'uk':
291
+ // Ukrainian
292
+ // 3 forms
293
+ return n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2;
294
+ case 'mnk':
295
+ // Mandinka
296
+ // 3 forms
297
+ return n == 0 ? 0 : n == 1 ? 1 : 2;
298
+ case 'ro':
299
+ // Romanian
300
+ // 3 forms
301
+ return n == 1 ? 0 : n == 0 || n % 100 > 0 && n % 100 < 20 ? 1 : 2;
302
+ case 'pl':
303
+ // Polish
304
+ // 3 forms
305
+ return n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2;
306
+ case 'cs':
307
+ // Czech
308
+ case 'sk':
309
+ // Slovak
310
+ // 3 forms
311
+ return n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2;
312
+ case 'sl':
313
+ // Slovenian
314
+ // 4 forms
315
+ return n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0;
316
+ case 'mt':
317
+ // Maltese
318
+ // 4 forms
319
+ return n == 1 ? 0 : n == 0 || n % 100 > 1 && n % 100 < 11 ? 1 : n % 100 > 10 && n % 100 < 20 ? 2 : 3;
320
+ case 'gd':
321
+ // Scottish Gaelic
322
+ // 4 forms
323
+ return n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3;
324
+ case 'cy':
325
+ // Welsh
326
+ // 4 forms
327
+ return n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3;
328
+ case 'kw':
329
+ // Cornish
330
+ // 4 forms
331
+ return n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3;
332
+ case 'ga':
333
+ // Irish
334
+ // 5 forms
335
+ return n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4;
336
+ case 'ar':
337
+ // Arabic
338
+ // 6 forms
339
+ return n == 0 ? 0 : n == 1 ? 1 : n == 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5;
340
+ default:
341
+ // Everything else
342
+ return n != 1 ? 1 : 0;
343
+ }
344
+ };
345
+ });
@@ -0,0 +1,594 @@
1
+ /**
2
+ * @license AngularJS v1.2.9
3
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
4
+ * License: MIT
5
+ */
6
+ (function(window, angular, undefined) {'use strict';
7
+
8
+ var $resourceMinErr = angular.$$minErr('$resource');
9
+
10
+ // Helper functions and regex to lookup a dotted path on an object
11
+ // stopping at undefined/null. The path must be composed of ASCII
12
+ // identifiers (just like $parse)
13
+ var MEMBER_NAME_REGEX = /^(\.[a-zA-Z_$][0-9a-zA-Z_$]*)+$/;
14
+
15
+ function isValidDottedPath(path) {
16
+ return (path != null && path !== '' && path !== 'hasOwnProperty' &&
17
+ MEMBER_NAME_REGEX.test('.' + path));
18
+ }
19
+
20
+ function lookupDottedPath(obj, path) {
21
+ if (!isValidDottedPath(path)) {
22
+ throw $resourceMinErr('badmember', 'Dotted member path "@{0}" is invalid.', path);
23
+ }
24
+ var keys = path.split('.');
25
+ for (var i = 0, ii = keys.length; i < ii && obj !== undefined; i++) {
26
+ var key = keys[i];
27
+ obj = (obj !== null) ? obj[key] : undefined;
28
+ }
29
+ return obj;
30
+ }
31
+
32
+ /**
33
+ * Create a shallow copy of an object and clear other fields from the destination
34
+ */
35
+ function shallowClearAndCopy(src, dst) {
36
+ dst = dst || {};
37
+
38
+ angular.forEach(dst, function(value, key){
39
+ delete dst[key];
40
+ });
41
+
42
+ for (var key in src) {
43
+ if (src.hasOwnProperty(key) && key.charAt(0) !== '$' && key.charAt(1) !== '$') {
44
+ dst[key] = src[key];
45
+ }
46
+ }
47
+
48
+ return dst;
49
+ }
50
+
51
+ /**
52
+ * @ngdoc overview
53
+ * @name ngResource
54
+ * @description
55
+ *
56
+ * # ngResource
57
+ *
58
+ * The `ngResource` module provides interaction support with RESTful services
59
+ * via the $resource service.
60
+ *
61
+ * {@installModule resource}
62
+ *
63
+ * <div doc-module-components="ngResource"></div>
64
+ *
65
+ * See {@link ngResource.$resource `$resource`} for usage.
66
+ */
67
+
68
+ /**
69
+ * @ngdoc object
70
+ * @name ngResource.$resource
71
+ * @requires $http
72
+ *
73
+ * @description
74
+ * A factory which creates a resource object that lets you interact with
75
+ * [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources.
76
+ *
77
+ * The returned resource object has action methods which provide high-level behaviors without
78
+ * the need to interact with the low level {@link ng.$http $http} service.
79
+ *
80
+ * Requires the {@link ngResource `ngResource`} module to be installed.
81
+ *
82
+ * @param {string} url A parametrized URL template with parameters prefixed by `:` as in
83
+ * `/user/:username`. If you are using a URL with a port number (e.g.
84
+ * `http://example.com:8080/api`), it will be respected.
85
+ *
86
+ * If you are using a url with a suffix, just add the suffix, like this:
87
+ * `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')`
88
+ * or even `$resource('http://example.com/resource/:resource_id.:format')`
89
+ * If the parameter before the suffix is empty, :resource_id in this case, then the `/.` will be
90
+ * collapsed down to a single `.`. If you need this sequence to appear and not collapse then you
91
+ * can escape it with `/\.`.
92
+ *
93
+ * @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in
94
+ * `actions` methods. If any of the parameter value is a function, it will be executed every time
95
+ * when a param value needs to be obtained for a request (unless the param was overridden).
96
+ *
97
+ * Each key value in the parameter object is first bound to url template if present and then any
98
+ * excess keys are appended to the url search query after the `?`.
99
+ *
100
+ * Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in
101
+ * URL `/path/greet?salutation=Hello`.
102
+ *
103
+ * If the parameter value is prefixed with `@` then the value of that parameter is extracted from
104
+ * the data object (useful for non-GET operations).
105
+ *
106
+ * @param {Object.<Object>=} actions Hash with declaration of custom action that should extend the
107
+ * default set of resource actions. The declaration should be created in the format of {@link
108
+ * ng.$http#usage_parameters $http.config}:
109
+ *
110
+ * {action1: {method:?, params:?, isArray:?, headers:?, ...},
111
+ * action2: {method:?, params:?, isArray:?, headers:?, ...},
112
+ * ...}
113
+ *
114
+ * Where:
115
+ *
116
+ * - **`action`** – {string} – The name of action. This name becomes the name of the method on
117
+ * your resource object.
118
+ * - **`method`** – {string} – HTTP request method. Valid methods are: `GET`, `POST`, `PUT`,
119
+ * `DELETE`, and `JSONP`.
120
+ * - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of
121
+ * the parameter value is a function, it will be executed every time when a param value needs to
122
+ * be obtained for a request (unless the param was overridden).
123
+ * - **`url`** – {string} – action specific `url` override. The url templating is supported just
124
+ * like for the resource-level urls.
125
+ * - **`isArray`** – {boolean=} – If true then the returned object for this action is an array,
126
+ * see `returns` section.
127
+ * - **`transformRequest`** –
128
+ * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
129
+ * transform function or an array of such functions. The transform function takes the http
130
+ * request body and headers and returns its transformed (typically serialized) version.
131
+ * - **`transformResponse`** –
132
+ * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
133
+ * transform function or an array of such functions. The transform function takes the http
134
+ * response body and headers and returns its transformed (typically deserialized) version.
135
+ * - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
136
+ * GET request, otherwise if a cache instance built with
137
+ * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
138
+ * caching.
139
+ * - **`timeout`** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} that
140
+ * should abort the request when resolved.
141
+ * - **`withCredentials`** - `{boolean}` - whether to set the `withCredentials` flag on the
142
+ * XHR object. See {@link https://developer.mozilla.org/en/http_access_control#section_5
143
+ * requests with credentials} for more information.
144
+ * - **`responseType`** - `{string}` - see {@link
145
+ * https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType requestType}.
146
+ * - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
147
+ * `response` and `responseError`. Both `response` and `responseError` interceptors get called
148
+ * with `http response` object. See {@link ng.$http $http interceptors}.
149
+ *
150
+ * @returns {Object} A resource "class" object with methods for the default set of resource actions
151
+ * optionally extended with custom `actions`. The default set contains these actions:
152
+ *
153
+ * { 'get': {method:'GET'},
154
+ * 'save': {method:'POST'},
155
+ * 'query': {method:'GET', isArray:true},
156
+ * 'remove': {method:'DELETE'},
157
+ * 'delete': {method:'DELETE'} };
158
+ *
159
+ * Calling these methods invoke an {@link ng.$http} with the specified http method,
160
+ * destination and parameters. When the data is returned from the server then the object is an
161
+ * instance of the resource class. The actions `save`, `remove` and `delete` are available on it
162
+ * as methods with the `$` prefix. This allows you to easily perform CRUD operations (create,
163
+ * read, update, delete) on server-side data like this:
164
+ * <pre>
165
+ var User = $resource('/user/:userId', {userId:'@id'});
166
+ var user = User.get({userId:123}, function() {
167
+ user.abc = true;
168
+ user.$save();
169
+ });
170
+ </pre>
171
+ *
172
+ * It is important to realize that invoking a $resource object method immediately returns an
173
+ * empty reference (object or array depending on `isArray`). Once the data is returned from the
174
+ * server the existing reference is populated with the actual data. This is a useful trick since
175
+ * usually the resource is assigned to a model which is then rendered by the view. Having an empty
176
+ * object results in no rendering, once the data arrives from the server then the object is
177
+ * populated with the data and the view automatically re-renders itself showing the new data. This
178
+ * means that in most cases one never has to write a callback function for the action methods.
179
+ *
180
+ * The action methods on the class object or instance object can be invoked with the following
181
+ * parameters:
182
+ *
183
+ * - HTTP GET "class" actions: `Resource.action([parameters], [success], [error])`
184
+ * - non-GET "class" actions: `Resource.action([parameters], postData, [success], [error])`
185
+ * - non-GET instance actions: `instance.$action([parameters], [success], [error])`
186
+ *
187
+ * Success callback is called with (value, responseHeaders) arguments. Error callback is called
188
+ * with (httpResponse) argument.
189
+ *
190
+ * Class actions return empty instance (with additional properties below).
191
+ * Instance actions return promise of the action.
192
+ *
193
+ * The Resource instances and collection have these additional properties:
194
+ *
195
+ * - `$promise`: the {@link ng.$q promise} of the original server interaction that created this
196
+ * instance or collection.
197
+ *
198
+ * On success, the promise is resolved with the same resource instance or collection object,
199
+ * updated with data from server. This makes it easy to use in
200
+ * {@link ngRoute.$routeProvider resolve section of $routeProvider.when()} to defer view
201
+ * rendering until the resource(s) are loaded.
202
+ *
203
+ * On failure, the promise is resolved with the {@link ng.$http http response} object, without
204
+ * the `resource` property.
205
+ *
206
+ * - `$resolved`: `true` after first server interaction is completed (either with success or
207
+ * rejection), `false` before that. Knowing if the Resource has been resolved is useful in
208
+ * data-binding.
209
+ *
210
+ * @example
211
+ *
212
+ * # Credit card resource
213
+ *
214
+ * <pre>
215
+ // Define CreditCard class
216
+ var CreditCard = $resource('/user/:userId/card/:cardId',
217
+ {userId:123, cardId:'@id'}, {
218
+ charge: {method:'POST', params:{charge:true}}
219
+ });
220
+
221
+ // We can retrieve a collection from the server
222
+ var cards = CreditCard.query(function() {
223
+ // GET: /user/123/card
224
+ // server returns: [ {id:456, number:'1234', name:'Smith'} ];
225
+
226
+ var card = cards[0];
227
+ // each item is an instance of CreditCard
228
+ expect(card instanceof CreditCard).toEqual(true);
229
+ card.name = "J. Smith";
230
+ // non GET methods are mapped onto the instances
231
+ card.$save();
232
+ // POST: /user/123/card/456 {id:456, number:'1234', name:'J. Smith'}
233
+ // server returns: {id:456, number:'1234', name: 'J. Smith'};
234
+
235
+ // our custom method is mapped as well.
236
+ card.$charge({amount:9.99});
237
+ // POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'}
238
+ });
239
+
240
+ // we can create an instance as well
241
+ var newCard = new CreditCard({number:'0123'});
242
+ newCard.name = "Mike Smith";
243
+ newCard.$save();
244
+ // POST: /user/123/card {number:'0123', name:'Mike Smith'}
245
+ // server returns: {id:789, number:'0123', name: 'Mike Smith'};
246
+ expect(newCard.id).toEqual(789);
247
+ * </pre>
248
+ *
249
+ * The object returned from this function execution is a resource "class" which has "static" method
250
+ * for each action in the definition.
251
+ *
252
+ * Calling these methods invoke `$http` on the `url` template with the given `method`, `params` and
253
+ * `headers`.
254
+ * When the data is returned from the server then the object is an instance of the resource type and
255
+ * all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
256
+ * operations (create, read, update, delete) on server-side data.
257
+
258
+ <pre>
259
+ var User = $resource('/user/:userId', {userId:'@id'});
260
+ var user = User.get({userId:123}, function() {
261
+ user.abc = true;
262
+ user.$save();
263
+ });
264
+ </pre>
265
+ *
266
+ * It's worth noting that the success callback for `get`, `query` and other methods gets passed
267
+ * in the response that came from the server as well as $http header getter function, so one
268
+ * could rewrite the above example and get access to http headers as:
269
+ *
270
+ <pre>
271
+ var User = $resource('/user/:userId', {userId:'@id'});
272
+ User.get({userId:123}, function(u, getResponseHeaders){
273
+ u.abc = true;
274
+ u.$save(function(u, putResponseHeaders) {
275
+ //u => saved user object
276
+ //putResponseHeaders => $http header getter
277
+ });
278
+ });
279
+ </pre>
280
+
281
+ * # Creating a custom 'PUT' request
282
+ * In this example we create a custom method on our resource to make a PUT request
283
+ * <pre>
284
+ * var app = angular.module('app', ['ngResource', 'ngRoute']);
285
+ *
286
+ * // Some APIs expect a PUT request in the format URL/object/ID
287
+ * // Here we are creating an 'update' method
288
+ * app.factory('Notes', ['$resource', function($resource) {
289
+ * return $resource('/notes/:id', null,
290
+ * {
291
+ * 'update': { method:'PUT' }
292
+ * });
293
+ * }]);
294
+ *
295
+ * // In our controller we get the ID from the URL using ngRoute and $routeParams
296
+ * // We pass in $routeParams and our Notes factory along with $scope
297
+ * app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes',
298
+ function($scope, $routeParams, Notes) {
299
+ * // First get a note object from the factory
300
+ * var note = Notes.get({ id:$routeParams.id });
301
+ * $id = note.id;
302
+ *
303
+ * // Now call update passing in the ID first then the object you are updating
304
+ * Notes.update({ id:$id }, note);
305
+ *
306
+ * // This will PUT /notes/ID with the note object in the request payload
307
+ * }]);
308
+ * </pre>
309
+ */
310
+ angular.module('ngResource', ['ng']).
311
+ factory('$resource', ['$http', '$q', function($http, $q) {
312
+
313
+ var DEFAULT_ACTIONS = {
314
+ 'get': {method:'GET'},
315
+ 'save': {method:'POST'},
316
+ 'query': {method:'GET', isArray:true},
317
+ 'remove': {method:'DELETE'},
318
+ 'delete': {method:'DELETE'}
319
+ };
320
+ var noop = angular.noop,
321
+ forEach = angular.forEach,
322
+ extend = angular.extend,
323
+ copy = angular.copy,
324
+ isFunction = angular.isFunction;
325
+
326
+ /**
327
+ * We need our custom method because encodeURIComponent is too aggressive and doesn't follow
328
+ * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
329
+ * segments:
330
+ * segment = *pchar
331
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
332
+ * pct-encoded = "%" HEXDIG HEXDIG
333
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
334
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
335
+ * / "*" / "+" / "," / ";" / "="
336
+ */
337
+ function encodeUriSegment(val) {
338
+ return encodeUriQuery(val, true).
339
+ replace(/%26/gi, '&').
340
+ replace(/%3D/gi, '=').
341
+ replace(/%2B/gi, '+');
342
+ }
343
+
344
+
345
+ /**
346
+ * This method is intended for encoding *key* or *value* parts of query component. We need a
347
+ * custom method because encodeURIComponent is too aggressive and encodes stuff that doesn't
348
+ * have to be encoded per http://tools.ietf.org/html/rfc3986:
349
+ * query = *( pchar / "/" / "?" )
350
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
351
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
352
+ * pct-encoded = "%" HEXDIG HEXDIG
353
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
354
+ * / "*" / "+" / "," / ";" / "="
355
+ */
356
+ function encodeUriQuery(val, pctEncodeSpaces) {
357
+ return encodeURIComponent(val).
358
+ replace(/%40/gi, '@').
359
+ replace(/%3A/gi, ':').
360
+ replace(/%24/g, '$').
361
+ replace(/%2C/gi, ',').
362
+ replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
363
+ }
364
+
365
+ function Route(template, defaults) {
366
+ this.template = template;
367
+ this.defaults = defaults || {};
368
+ this.urlParams = {};
369
+ }
370
+
371
+ Route.prototype = {
372
+ setUrlParams: function(config, params, actionUrl) {
373
+ var self = this,
374
+ url = actionUrl || self.template,
375
+ val,
376
+ encodedVal;
377
+
378
+ var urlParams = self.urlParams = {};
379
+ forEach(url.split(/\W/), function(param){
380
+ if (param === 'hasOwnProperty') {
381
+ throw $resourceMinErr('badname', "hasOwnProperty is not a valid parameter name.");
382
+ }
383
+ if (!(new RegExp("^\\d+$").test(param)) && param &&
384
+ (new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) {
385
+ urlParams[param] = true;
386
+ }
387
+ });
388
+ url = url.replace(/\\:/g, ':');
389
+
390
+ params = params || {};
391
+ forEach(self.urlParams, function(_, urlParam){
392
+ val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
393
+ if (angular.isDefined(val) && val !== null) {
394
+ encodedVal = encodeUriSegment(val);
395
+ url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), encodedVal + "$1");
396
+ } else {
397
+ url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W|$)", "g"), function(match,
398
+ leadingSlashes, tail) {
399
+ if (tail.charAt(0) == '/') {
400
+ return tail;
401
+ } else {
402
+ return leadingSlashes + tail;
403
+ }
404
+ });
405
+ }
406
+ });
407
+
408
+ // strip trailing slashes and set the url
409
+ url = url.replace(/\/+$/, '') || '/';
410
+ // then replace collapse `/.` if found in the last URL path segment before the query
411
+ // E.g. `http://url.com/id./format?q=x` becomes `http://url.com/id.format?q=x`
412
+ url = url.replace(/\/\.(?=\w+($|\?))/, '.');
413
+ // replace escaped `/\.` with `/.`
414
+ config.url = url.replace(/\/\\\./, '/.');
415
+
416
+
417
+ // set params - delegate param encoding to $http
418
+ forEach(params, function(value, key){
419
+ if (!self.urlParams[key]) {
420
+ config.params = config.params || {};
421
+ config.params[key] = value;
422
+ }
423
+ });
424
+ }
425
+ };
426
+
427
+
428
+ function resourceFactory(url, paramDefaults, actions) {
429
+ var route = new Route(url);
430
+
431
+ actions = extend({}, DEFAULT_ACTIONS, actions);
432
+
433
+ function extractParams(data, actionParams){
434
+ var ids = {};
435
+ actionParams = extend({}, paramDefaults, actionParams);
436
+ forEach(actionParams, function(value, key){
437
+ if (isFunction(value)) { value = value(); }
438
+ ids[key] = value && value.charAt && value.charAt(0) == '@' ?
439
+ lookupDottedPath(data, value.substr(1)) : value;
440
+ });
441
+ return ids;
442
+ }
443
+
444
+ function defaultResponseInterceptor(response) {
445
+ return response.resource;
446
+ }
447
+
448
+ function Resource(value){
449
+ shallowClearAndCopy(value || {}, this);
450
+ }
451
+
452
+ forEach(actions, function(action, name) {
453
+ var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method);
454
+
455
+ Resource[name] = function(a1, a2, a3, a4) {
456
+ var params = {}, data, success, error;
457
+
458
+ /* jshint -W086 */ /* (purposefully fall through case statements) */
459
+ switch(arguments.length) {
460
+ case 4:
461
+ error = a4;
462
+ success = a3;
463
+ //fallthrough
464
+ case 3:
465
+ case 2:
466
+ if (isFunction(a2)) {
467
+ if (isFunction(a1)) {
468
+ success = a1;
469
+ error = a2;
470
+ break;
471
+ }
472
+
473
+ success = a2;
474
+ error = a3;
475
+ //fallthrough
476
+ } else {
477
+ params = a1;
478
+ data = a2;
479
+ success = a3;
480
+ break;
481
+ }
482
+ case 1:
483
+ if (isFunction(a1)) success = a1;
484
+ else if (hasBody) data = a1;
485
+ else params = a1;
486
+ break;
487
+ case 0: break;
488
+ default:
489
+ throw $resourceMinErr('badargs',
490
+ "Expected up to 4 arguments [params, data, success, error], got {0} arguments",
491
+ arguments.length);
492
+ }
493
+ /* jshint +W086 */ /* (purposefully fall through case statements) */
494
+
495
+ var isInstanceCall = this instanceof Resource;
496
+ var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
497
+ var httpConfig = {};
498
+ var responseInterceptor = action.interceptor && action.interceptor.response ||
499
+ defaultResponseInterceptor;
500
+ var responseErrorInterceptor = action.interceptor && action.interceptor.responseError ||
501
+ undefined;
502
+
503
+ forEach(action, function(value, key) {
504
+ if (key != 'params' && key != 'isArray' && key != 'interceptor') {
505
+ httpConfig[key] = copy(value);
506
+ }
507
+ });
508
+
509
+ if (hasBody) httpConfig.data = data;
510
+ route.setUrlParams(httpConfig,
511
+ extend({}, extractParams(data, action.params || {}), params),
512
+ action.url);
513
+
514
+ var promise = $http(httpConfig).then(function(response) {
515
+ var data = response.data,
516
+ promise = value.$promise;
517
+
518
+ if (data) {
519
+ // Need to convert action.isArray to boolean in case it is undefined
520
+ // jshint -W018
521
+ if (angular.isArray(data) !== (!!action.isArray)) {
522
+ throw $resourceMinErr('badcfg', 'Error in resource configuration. Expected ' +
523
+ 'response to contain an {0} but got an {1}',
524
+ action.isArray?'array':'object', angular.isArray(data)?'array':'object');
525
+ }
526
+ // jshint +W018
527
+ if (action.isArray) {
528
+ value.length = 0;
529
+ forEach(data, function(item) {
530
+ value.push(new Resource(item));
531
+ });
532
+ } else {
533
+ shallowClearAndCopy(data, value);
534
+ value.$promise = promise;
535
+ }
536
+ }
537
+
538
+ value.$resolved = true;
539
+
540
+ response.resource = value;
541
+
542
+ return response;
543
+ }, function(response) {
544
+ value.$resolved = true;
545
+
546
+ (error||noop)(response);
547
+
548
+ return $q.reject(response);
549
+ });
550
+
551
+ promise = promise.then(
552
+ function(response) {
553
+ var value = responseInterceptor(response);
554
+ (success||noop)(value, response.headers);
555
+ return value;
556
+ },
557
+ responseErrorInterceptor);
558
+
559
+ if (!isInstanceCall) {
560
+ // we are creating instance / collection
561
+ // - set the initial promise
562
+ // - return the instance / collection
563
+ value.$promise = promise;
564
+ value.$resolved = false;
565
+
566
+ return value;
567
+ }
568
+
569
+ // instance call
570
+ return promise;
571
+ };
572
+
573
+
574
+ Resource.prototype['$' + name] = function(params, success, error) {
575
+ if (isFunction(params)) {
576
+ error = success; success = params; params = {};
577
+ }
578
+ var result = Resource[name].call(this, params, this, success, error);
579
+ return result.$promise || result;
580
+ };
581
+ });
582
+
583
+ Resource.bind = function(additionalParamDefaults){
584
+ return resourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions);
585
+ };
586
+
587
+ return Resource;
588
+ }
589
+
590
+ return resourceFactory;
591
+ }]);
592
+
593
+
594
+ })(window, window.angular);