artfully_ose 1.2.0.beta.1 → 1.2.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (539) hide show
  1. checksums.yaml +9 -9
  2. data/app/assets/fonts/FontAwesome.otf +0 -0
  3. data/app/assets/fonts/fontawesome-webfont.eot +0 -0
  4. data/app/assets/fonts/fontawesome-webfont.svg +252 -472
  5. data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
  6. data/app/assets/fonts/fontawesome-webfont.woff +0 -0
  7. data/app/assets/images/person-default-avatar.psd +0 -0
  8. data/app/assets/javascripts/application.js +10 -163
  9. data/app/assets/javascripts/box-office.js +262 -0
  10. data/app/assets/javascripts/custom/inline-people-search.js +40 -40
  11. data/app/assets/javascripts/custom/people.js +5 -68
  12. data/app/assets/javascripts/custom/prices.js +0 -1
  13. data/app/assets/javascripts/custom/show.js +8 -18
  14. data/app/assets/javascripts/jquery-lib/jquery.mask-money.js +0 -1
  15. data/app/assets/javascripts/locationselector.js +1 -1
  16. data/app/assets/javascripts/store/jquery.validate.additional-methods.js +159 -476
  17. data/app/assets/javascripts/store/jquery.validate.js +406 -449
  18. data/app/assets/javascripts/store/store.js +5 -29
  19. data/app/assets/stylesheets/application.sass +60 -223
  20. data/app/assets/stylesheets/bootstrap-overrides.css +3 -13
  21. data/app/assets/stylesheets/bootstrap.css +0 -1
  22. data/app/assets/stylesheets/font-awesome.sass +759 -0
  23. data/app/assets/stylesheets/sass/_event_list.sass +1 -12
  24. data/app/assets/stylesheets/sass/_tags.sass +2 -13
  25. data/app/assets/stylesheets/sass/box-office.sass +1 -2
  26. data/app/assets/stylesheets/sass/cart.sass +6 -0
  27. data/app/assets/stylesheets/sass/store.sass +68 -123
  28. data/app/assets/stylesheets/storefront.css +1 -2
  29. data/app/concerns/itemable.rb +1 -1
  30. data/app/controllers/artfully_ose_controller.rb +7 -29
  31. data/app/controllers/discounts_controller.rb +1 -8
  32. data/app/controllers/events_controller.rb +33 -41
  33. data/app/controllers/exchanges_controller.rb +2 -8
  34. data/app/controllers/export_controller.rb +0 -6
  35. data/app/controllers/imports_controller.rb +0 -19
  36. data/app/controllers/members/index_controller.rb +1 -1
  37. data/app/controllers/members/members_controller.rb +1 -6
  38. data/app/controllers/membership_awards_controller.rb +58 -0
  39. data/app/controllers/membership_types_controller.rb +3 -40
  40. data/app/controllers/memberships_controller.rb +4 -6
  41. data/app/controllers/orders_controller.rb +2 -86
  42. data/app/controllers/organizations_controller.rb +3 -4
  43. data/app/controllers/people_controller.rb +23 -54
  44. data/app/controllers/refunds_controller.rb +7 -7
  45. data/app/controllers/sales_controller.rb +28 -67
  46. data/app/controllers/searches_controller.rb +9 -15
  47. data/app/controllers/sections_controller.rb +2 -2
  48. data/app/controllers/segments_controller.rb +4 -4
  49. data/app/controllers/shows_controller.rb +49 -79
  50. data/app/controllers/slices_controller.rb +2 -3
  51. data/app/controllers/statements_controller.rb +1 -1
  52. data/app/controllers/store/checkouts_controller.rb +3 -8
  53. data/app/controllers/store/donations_controller.rb +1 -19
  54. data/app/controllers/store/events_controller.rb +1 -14
  55. data/app/controllers/store/memberships_controller.rb +1 -12
  56. data/app/controllers/store/orders_controller.rb +17 -36
  57. data/app/controllers/store/passes_controller.rb +0 -9
  58. data/app/controllers/store/store_controller.rb +2 -7
  59. data/app/controllers/tickets_controller.rb +2 -2
  60. data/app/helpers/artfully_ose_helper.rb +21 -79
  61. data/app/helpers/link_helper.rb +2 -12
  62. data/app/mailers/order_mailer.rb +1 -28
  63. data/app/mailers/reports_mailer.rb +4 -5
  64. data/app/models/ability.rb +0 -1
  65. data/app/models/action.rb +1 -1
  66. data/app/models/actions/go_action.rb +2 -3
  67. data/app/{concerns → models/actions}/immutable_action.rb +0 -0
  68. data/app/models/address.rb +11 -32
  69. data/app/models/{cart.rb → carts/cart.rb} +37 -46
  70. data/app/models/carts/cart_finder.rb +33 -0
  71. data/app/models/checkout.rb +41 -85
  72. data/app/models/comp.rb +17 -24
  73. data/app/models/company.rb +1 -1
  74. data/app/models/contribution.rb +0 -1
  75. data/app/models/database_views/item_view.rb +28 -169
  76. data/app/models/database_views/order_view.rb +34 -0
  77. data/app/models/donation.rb +0 -4
  78. data/app/models/door_list.rb +3 -6
  79. data/app/models/event.rb +10 -60
  80. data/app/models/exchange.rb +5 -7
  81. data/app/models/{ext.rb → ext/ext.rb} +1 -14
  82. data/app/models/ext/integrations.rb +21 -39
  83. data/app/models/fee_strategy.rb +1 -47
  84. data/app/models/import.rb +2 -22
  85. data/app/models/imports/donations_import.rb +19 -1
  86. data/app/models/imports/events_import.rb +51 -43
  87. data/app/models/individual.rb +1 -3
  88. data/app/models/item.rb +11 -28
  89. data/app/models/job/daily_email_report_job.rb +6 -20
  90. data/app/models/job/mailchimp_sync_job.rb +3 -1
  91. data/app/models/job/order_processor.rb +12 -78
  92. data/app/models/job/show_creator.rb +3 -8
  93. data/app/models/kit.rb +4 -2
  94. data/app/models/kits/mailchimp_kit.rb +10 -18
  95. data/app/models/kits/regular_donation_kit.rb +8 -38
  96. data/app/models/member.rb +17 -152
  97. data/app/models/membership.rb +23 -59
  98. data/app/models/membership_award.rb +23 -0
  99. data/app/models/membership_type.rb +2 -44
  100. data/app/models/note.rb +1 -1
  101. data/app/models/order_handler.rb +39 -100
  102. data/app/models/orders/comp_order.rb +0 -4
  103. data/app/models/orders/imported_order.rb +0 -4
  104. data/app/models/{order.rb → orders/order.rb} +18 -113
  105. data/app/models/orders/refund_order.rb +0 -4
  106. data/app/{concerns → models/orders}/unrefundable.rb +0 -0
  107. data/app/models/organization.rb +15 -55
  108. data/app/models/organization_ability.rb +0 -1
  109. data/app/models/parsed_row.rb +3 -58
  110. data/app/models/payments/cash_payment.rb +1 -3
  111. data/app/models/payments/comp_payment.rb +1 -3
  112. data/app/models/payments/credit_card_payment.rb +23 -44
  113. data/app/models/{payment.rb → payments/payment.rb} +1 -29
  114. data/app/models/person.rb +36 -140
  115. data/app/models/phone.rb +8 -0
  116. data/app/models/refund.rb +2 -5
  117. data/app/models/sale.rb +10 -14
  118. data/app/models/sale_search.rb +21 -3
  119. data/app/models/search.rb +67 -320
  120. data/app/models/section.rb +2 -18
  121. data/app/models/show.rb +20 -67
  122. data/app/models/slices.rb +8 -25
  123. data/app/models/statement.rb +5 -32
  124. data/app/models/ticket.rb +15 -50
  125. data/app/models/ticket/locker.rb +1 -2
  126. data/app/models/ticket/pricing.rb +1 -11
  127. data/app/models/ticket/reports.rb +0 -16
  128. data/app/models/ticket/sale_transitions.rb +0 -4
  129. data/app/models/ticket/template.rb +0 -1
  130. data/app/models/ticket/transfers.rb +2 -12
  131. data/app/models/ticket_summary.rb +1 -7
  132. data/app/models/ticket_type.rb +7 -59
  133. data/app/models/user.rb +5 -18
  134. data/app/models/user_membership.rb +3 -21
  135. data/app/models/valuation/lifetime_ticket_value.rb +1 -1
  136. data/app/models/venue.rb +7 -21
  137. data/app/presenters/event_presenter.rb +1 -1
  138. data/app/views/actions/_form.html.haml +6 -6
  139. data/app/views/actions/get/_show.html.haml +13 -2
  140. data/app/views/actions/give/_show.html.haml +1 -1
  141. data/app/views/actions/shared/_show.html.haml +1 -1
  142. data/app/views/addresses/_address.html.haml +6 -7
  143. data/app/views/contributions/_form.html.haml +1 -1
  144. data/app/views/contributions/index.html.haml +2 -2
  145. data/app/views/discounts/_discount_section_fields.html.haml +1 -1
  146. data/app/views/discounts/_form.html.haml +1 -1
  147. data/app/views/discounts/index.html.haml +1 -1
  148. data/app/views/events/_day_date_show.html.haml +2 -2
  149. data/app/views/events/_discount_section_fields.html.haml +1 -1
  150. data/app/views/events/_header.html.haml +0 -1
  151. data/app/views/events/_list.html.haml +5 -10
  152. data/app/views/events/_menu.html.haml +15 -6
  153. data/app/views/events/_section_fields.html.haml +1 -1
  154. data/app/views/events/_share_and_sell.haml +2 -3
  155. data/app/views/events/_ticket_type_fields.html.haml +4 -43
  156. data/app/views/events/edit.html.haml +1 -6
  157. data/app/views/events/image.html.haml +1 -2
  158. data/app/views/events/index.html.haml +3 -20
  159. data/app/views/events/show.html.haml +1 -3
  160. data/app/views/events/temp_discount_form.html.haml +1 -1
  161. data/app/views/events/temp_discounts_index.html.haml +1 -1
  162. data/app/views/exchanges/new.html.haml +28 -51
  163. data/app/views/imports/donations/_pending.html.haml +1 -1
  164. data/app/views/imports/events/_pending.html.haml +1 -1
  165. data/app/views/imports/index.html.haml +3 -6
  166. data/app/views/imports/people/_imported.html.haml +2 -2
  167. data/app/views/imports/people/_new.html.haml +8 -20
  168. data/app/views/imports/people/_pending.html.haml +2 -2
  169. data/app/views/imports/people/_recalled.html.haml +1 -1
  170. data/app/views/imports/shared/_sidebar.html.haml +1 -1
  171. data/app/views/index/dashboard.html.haml +4 -4
  172. data/app/views/layouts/_flash.html.haml +3 -3
  173. data/app/views/layouts/_google_analytics.html.haml +2 -5
  174. data/app/views/layouts/_menu.html.haml +5 -9
  175. data/app/views/layouts/application.html.haml +2 -2
  176. data/app/views/layouts/devise_layout.html.haml +2 -2
  177. data/app/views/layouts/members.html.haml +1 -1
  178. data/app/views/layouts/storefront.html.haml +15 -27
  179. data/app/views/members/index/index.html.haml +13 -7
  180. data/app/views/membership_awards/confirm.html.haml +59 -0
  181. data/app/views/membership_awards/create.html.haml +1 -0
  182. data/app/views/membership_awards/new.html.haml +74 -0
  183. data/app/views/membership_types/_form.html.haml +19 -67
  184. data/app/views/membership_types/index.html.haml +14 -15
  185. data/app/views/memberships/index.html.haml +50 -116
  186. data/app/views/merges/find_person.html.haml +1 -1
  187. data/app/views/notes/_note.html.haml +4 -4
  188. data/app/views/order_mailer/confirmation_for.html.haml +21 -33
  189. data/app/views/order_mailer/confirmation_for.text.haml +3 -6
  190. data/app/views/orders/_item_table.haml +8 -25
  191. data/app/views/orders/_order_sidebar.html.haml +4 -2
  192. data/app/views/orders/sales.html.haml +3 -3
  193. data/app/views/organizations/_connection_form.html.haml +1 -1
  194. data/app/views/organizations/_form.html.haml +20 -25
  195. data/app/views/organizations/edit.html.haml +2 -2
  196. data/app/views/organizations/show.html.haml +16 -22
  197. data/app/views/people/_edit_modal.html.haml +28 -48
  198. data/app/views/people/_header.html.haml +9 -18
  199. data/app/views/people/_phone_fields.html.haml +1 -1
  200. data/app/views/people/index.html.haml +6 -18
  201. data/app/views/people/new.html.haml +1 -1
  202. data/app/views/people/show.html.haml +24 -71
  203. data/app/views/refunds/new.html.haml +27 -45
  204. data/app/views/reports_mailer/daily.html.haml +21 -86
  205. data/app/views/sales/new.html.haml +125 -33
  206. data/app/views/searches/_form.html.haml +50 -115
  207. data/app/views/searches/_person.html.haml +2 -5
  208. data/app/views/searches/new.html.haml +1 -1
  209. data/app/views/searches/show.html.haml +6 -17
  210. data/app/views/segments/show.html.haml +4 -7
  211. data/app/views/shared/_error_messages.html.haml +1 -1
  212. data/app/views/shared/_tags.html.haml +2 -2
  213. data/app/views/shows/_controls.html.haml +20 -4
  214. data/app/views/shows/_glance.html.haml +5 -1
  215. data/app/views/shows/_sections_table.html.haml +6 -8
  216. data/app/views/shows/_ticket_table.html.haml +3 -3
  217. data/app/views/shows/_work_with.html.haml +5 -5
  218. data/app/views/shows/door_list.html.haml +2 -2
  219. data/app/views/shows/index.html.haml +19 -88
  220. data/app/views/shows/new.html.haml +11 -10
  221. data/app/views/shows/show.html.haml +2 -2
  222. data/app/views/slices/index.html.haml +1 -2
  223. data/app/views/statements/_discounts_table.html.haml +1 -1
  224. data/app/views/statements/_order_location_table.html.haml +1 -1
  225. data/app/views/statements/_payment_method_table.haml +1 -1
  226. data/app/views/statements/_ticket_type_table.haml +2 -5
  227. data/app/views/statements/show.html.haml +2 -5
  228. data/app/views/store/checkouts/thanks.html.haml +16 -38
  229. data/app/views/store/donations/index.html.haml +2 -19
  230. data/app/views/store/events/_calendar.html.haml +4 -1
  231. data/app/views/store/events/index.html.haml +4 -11
  232. data/app/views/store/events/show.html.haml +19 -10
  233. data/app/views/store/memberships/index.html.haml +17 -17
  234. data/app/views/store/orders/show.html.haml +22 -33
  235. data/app/views/store/shared/_donate_form.html.haml +12 -31
  236. data/app/views/store/shows/_show.html.haml +29 -37
  237. data/app/views/user_memberships/_list.html.haml +29 -28
  238. data/app/views/users/invitations/edit.html.haml +9 -19
  239. data/app/views/users/mailer/invitation_instructions.html.erb +8 -0
  240. data/app/views/users/passwords/edit.html.haml +2 -2
  241. data/app/views/users/registrations/edit.html.erb +3 -3
  242. data/app/views/users/sessions/new.html.haml +2 -2
  243. data/app/views/venues/edit.html.haml +1 -3
  244. data/config/initializers/devise.rb +5 -2
  245. data/config/locales/devise.en.yml +1 -1
  246. data/config/locales/devise_invitable.en.yml +1 -1
  247. data/config/locales/en.yml +3 -18
  248. data/config/routes.rb +12 -101
  249. data/lib/artfully_ose.rb +4 -6
  250. data/lib/artfully_ose/common_abilities.rb +2 -8
  251. data/lib/artfully_ose/engine.rb +10 -34
  252. data/lib/artfully_ose/version.rb +1 -1
  253. metadata +45 -349
  254. data/README.md +0 -28
  255. data/app/assets/images/household-default-avatar.png +0 -0
  256. data/app/assets/javascripts/angular-resource.js +0 -546
  257. data/app/assets/javascripts/angular.js +0 -20311
  258. data/app/assets/javascripts/bootstrap-wysihtml5.js +0 -511
  259. data/app/assets/javascripts/boxoffice.js +0 -558
  260. data/app/assets/javascripts/change-membership.js +0 -152
  261. data/app/assets/javascripts/custom/kits-config.js +0 -33
  262. data/app/assets/javascripts/households.js +0 -59
  263. data/app/assets/javascripts/jquery-migrate-1.2.1.min.js +0 -2
  264. data/app/assets/javascripts/relationships.js +0 -63
  265. data/app/assets/javascripts/sales-console.js +0 -158
  266. data/app/assets/javascripts/wysihtml5-0.3.0.min.js +0 -261
  267. data/app/assets/stylesheets/bootstrap-wysihtml5.css +0 -102
  268. data/app/assets/stylesheets/boxoffice.css.scss +0 -258
  269. data/app/assets/stylesheets/font-awesome.css.scss +0 -1566
  270. data/app/assets/stylesheets/pages/bootstrap-responsive.css +0 -1109
  271. data/app/assets/stylesheets/wysiwyg-color.css +0 -67
  272. data/app/concerns/cart_finder.rb +0 -50
  273. data/app/concerns/pdf_generation.rb +0 -64
  274. data/app/concerns/search_by_dates.rb +0 -20
  275. data/app/controllers/console_sales_controller.rb +0 -182
  276. data/app/controllers/events_pass_types_controller.rb +0 -87
  277. data/app/controllers/households_controller.rb +0 -71
  278. data/app/controllers/member_cards_controller.rb +0 -44
  279. data/app/controllers/members/invitations_controller.rb +0 -7
  280. data/app/controllers/members/passwords_controller.rb +0 -10
  281. data/app/controllers/members/people_controller.rb +0 -17
  282. data/app/controllers/members/sessions_controller.rb +0 -14
  283. data/app/controllers/membership_cancellations_controller.rb +0 -46
  284. data/app/controllers/membership_changes_controller.rb +0 -39
  285. data/app/controllers/membership_comps_controller.rb +0 -102
  286. data/app/controllers/membership_kits_controller.rb +0 -25
  287. data/app/controllers/mobile/dashboard_controller.rb +0 -17
  288. data/app/controllers/mobile/events_controller.rb +0 -16
  289. data/app/controllers/mobile/orders_controller.rb +0 -61
  290. data/app/controllers/mobile/shows_controller.rb +0 -39
  291. data/app/controllers/mobile/tickets_controller.rb +0 -114
  292. data/app/controllers/mobile/users_controller.rb +0 -30
  293. data/app/controllers/pass_types_controller.rb +0 -53
  294. data/app/controllers/passes_controller.rb +0 -52
  295. data/app/controllers/passes_kits_controller.rb +0 -25
  296. data/app/controllers/passes_reports_controller.rb +0 -25
  297. data/app/controllers/regular_donation_kits_controller.rb +0 -32
  298. data/app/controllers/relationships_controller.rb +0 -15
  299. data/app/controllers/store/retrievals_controller.rb +0 -29
  300. data/app/controllers/users/sessions_controller.rb +0 -3
  301. data/app/helpers/households_helper.rb +0 -7
  302. data/app/helpers/membership_types_helper.rb +0 -22
  303. data/app/helpers/relationships_helper.rb +0 -26
  304. data/app/helpers/sales_helper.rb +0 -29
  305. data/app/helpers/searches_helper.rb +0 -13
  306. data/app/helpers/suggested_households_helper.rb +0 -5
  307. data/app/mailers/pass_mailer.rb +0 -17
  308. data/app/models/actions/change_action.rb +0 -13
  309. data/app/models/actions/comp_action.rb +0 -15
  310. data/app/models/console_sale.rb +0 -30
  311. data/app/models/daily_membership_report.rb +0 -50
  312. data/app/models/daily_pass_report.rb +0 -48
  313. data/app/models/events_pass_type.rb +0 -18
  314. data/app/models/ext/preprocessor.rb +0 -7
  315. data/app/models/extendable.rb +0 -6
  316. data/app/models/household.rb +0 -61
  317. data/app/models/household_suggester.rb +0 -58
  318. data/app/models/imports/memberships_import.rb +0 -43
  319. data/app/models/job/checkout_processor.rb +0 -46
  320. data/app/models/job/cleanup_suggested_households_job.rb +0 -17
  321. data/app/models/job/destroy_show_job.rb +0 -10
  322. data/app/models/job/geocode_address_job.rb +0 -11
  323. data/app/models/job/order_mailer_job.rb +0 -8
  324. data/app/models/job/refund_order_processor.rb +0 -16
  325. data/app/models/kits/membership_kit.rb +0 -62
  326. data/app/models/kits/passes_kit.rb +0 -62
  327. data/app/models/kits/scannable_tickets_kit.rb +0 -23
  328. data/app/models/member_card_generator.rb +0 -63
  329. data/app/models/member_walkup.rb +0 -150
  330. data/app/models/membership_cancellation.rb +0 -80
  331. data/app/models/membership_change.rb +0 -187
  332. data/app/models/membership_comp.rb +0 -105
  333. data/app/models/membership_comp_job.rb +0 -32
  334. data/app/models/membership_sale_search.rb +0 -18
  335. data/app/models/pass.rb +0 -197
  336. data/app/models/pass_sale_search.rb +0 -18
  337. data/app/models/pass_summary.rb +0 -18
  338. data/app/models/pass_type.rb +0 -46
  339. data/app/models/passes_report.rb +0 -117
  340. data/app/models/payments/check_payment.rb +0 -33
  341. data/app/models/relation.rb +0 -27
  342. data/app/models/relation_builder.rb +0 -32
  343. data/app/models/relationship.rb +0 -55
  344. data/app/models/relationship_builder.rb +0 -12
  345. data/app/models/relationship_validator.rb +0 -46
  346. data/app/models/relationships_kit.rb +0 -31
  347. data/app/models/rolling_membership_type.rb +0 -11
  348. data/app/models/seasonal_membership_type.rb +0 -3
  349. data/app/models/suggested_household.rb +0 -24
  350. data/app/models/ticket/qr_code.rb +0 -21
  351. data/app/models/valuation/lifetime_memberships.rb +0 -24
  352. data/app/serializers/show_serializer.rb +0 -15
  353. data/app/views/console_sales/_aloha.html.haml +0 -26
  354. data/app/views/console_sales/_cart.html.haml +0 -60
  355. data/app/views/console_sales/_payment.html.haml +0 -111
  356. data/app/views/console_sales/_shows.html.haml +0 -24
  357. data/app/views/console_sales/new.html.haml +0 -143
  358. data/app/views/events_pass_types/_form.html.haml +0 -42
  359. data/app/views/events_pass_types/edit.html.haml +0 -22
  360. data/app/views/events_pass_types/index.html.haml +0 -47
  361. data/app/views/events_pass_types/new.html.haml +0 -22
  362. data/app/views/households/_action.html.haml +0 -24
  363. data/app/views/households/_edit_modal.html.haml +0 -143
  364. data/app/views/households/_form.html.haml +0 -26
  365. data/app/views/households/_header.html.haml +0 -25
  366. data/app/views/households/_individual_fields.html.haml +0 -8
  367. data/app/views/households/_list.html.haml +0 -10
  368. data/app/views/households/_note.html.haml +0 -33
  369. data/app/views/households/edit.html.haml +0 -1
  370. data/app/views/households/index.html.haml +0 -13
  371. data/app/views/households/new.html.haml +0 -14
  372. data/app/views/households/show.html.haml +0 -72
  373. data/app/views/households/suggested.html.haml +0 -38
  374. data/app/views/imports/_export_links.html.haml +0 -3
  375. data/app/views/kits/_list.html.haml +0 -9
  376. data/app/views/members/invitations/edit.html.haml +0 -17
  377. data/app/views/members/invitations/new.html.erb +0 -14
  378. data/app/views/members/mailer/_invitation_body.html.haml +0 -18
  379. data/app/views/members/mailer/invitation_instructions.html.haml +0 -6
  380. data/app/views/members/mailer/reset_password_instructions.html.erb +0 -8
  381. data/app/views/members/passwords/edit.html.haml +0 -18
  382. data/app/views/members/sessions/new.html.haml +0 -19
  383. data/app/views/membership_cancellations/_form.html.haml +0 -39
  384. data/app/views/membership_cancellations/_modal.html.haml +0 -2
  385. data/app/views/membership_cancellations/_processing.html.haml +0 -12
  386. data/app/views/membership_cancellations/create.js.erb +0 -3
  387. data/app/views/membership_cancellations/new.js.erb +0 -3
  388. data/app/views/membership_comps/confirm.html.haml +0 -86
  389. data/app/views/membership_comps/create.html.haml +0 -20
  390. data/app/views/membership_comps/new.html.haml +0 -95
  391. data/app/views/membership_kits/edit.html.haml +0 -52
  392. data/app/views/membership_mailer/cancellation_confirmation.html.haml +0 -9
  393. data/app/views/membership_mailer/cancellation_confirmation.text.haml +0 -6
  394. data/app/views/membership_mailer/refund_problem.html.haml +0 -18
  395. data/app/views/membership_mailer/refund_problem.text.haml +0 -14
  396. data/app/views/membership_types/_membership_type_fees.html.haml +0 -0
  397. data/app/views/membership_types/_rolling_membership_type_form.html.haml +0 -5
  398. data/app/views/membership_types/_seasonal_membership_type_form.html.haml +0 -8
  399. data/app/views/membership_types/type.html.haml +0 -19
  400. data/app/views/memberships/_membership_scripts.js.erb +0 -15
  401. data/app/views/order_mailer/confirmation_for_exchange.html.haml +0 -34
  402. data/app/views/order_mailer/confirmation_for_exchange.text.haml +0 -26
  403. data/app/views/order_mailer/confirmation_for_refund.html.haml +0 -36
  404. data/app/views/order_mailer/confirmation_for_refund.text.haml +0 -22
  405. data/app/views/orders/membership.html.haml +0 -100
  406. data/app/views/orders/passes.html.haml +0 -97
  407. data/app/views/pass_mailer/pass_info_for.html.haml +0 -21
  408. data/app/views/pass_types/_form.html.haml +0 -76
  409. data/app/views/pass_types/_pass_type_fees.html.haml +0 -0
  410. data/app/views/pass_types/edit.html.haml +0 -4
  411. data/app/views/pass_types/index.html.haml +0 -34
  412. data/app/views/pass_types/new.html.haml +0 -4
  413. data/app/views/passes/index.html.haml +0 -108
  414. data/app/views/passes_kits/edit.html.haml +0 -30
  415. data/app/views/passes_reports/index.html.haml +0 -80
  416. data/app/views/pdfs/member.html.haml +0 -66
  417. data/app/views/pdfs/member_card_generator/blanks_usa_idc6.html.haml +0 -109
  418. data/app/views/pdfs/order.html.haml +0 -84
  419. data/app/views/people/_household_fields.html.haml +0 -5
  420. data/app/views/people/_relationship_fields.html.haml +0 -14
  421. data/app/views/people/_work_with_menu.html.haml +0 -39
  422. data/app/views/producer_mailer/donation_kit_notification.html.haml +0 -8
  423. data/app/views/producer_mailer/donation_kit_notification.text.erb +0 -8
  424. data/app/views/producer_mailer/mailchimp_kit_initial_sync_notification.html.haml +0 -21
  425. data/app/views/producer_mailer/ticket_offer_accepted.html.haml +0 -7
  426. data/app/views/producer_mailer/ticket_offer_accepted.text.erb +0 -7
  427. data/app/views/producer_mailer/ticket_offer_rejected.html.haml +0 -11
  428. data/app/views/producer_mailer/ticket_offer_rejected.text.erb +0 -13
  429. data/app/views/regular_donation_kits/edit.html.haml +0 -140
  430. data/app/views/relationships/index.html.haml +0 -32
  431. data/app/views/sales/_boxoffice.html.haml +0 -141
  432. data/app/views/sales/_doorlist.html.haml +0 -79
  433. data/app/views/searches/_household.html.haml +0 -7
  434. data/app/views/shared/_show_time_and_calendar.html.haml +0 -21
  435. data/app/views/shows/door_list.pdf.haml +0 -29
  436. data/app/views/statements/_passes_table.html.haml +0 -22
  437. data/app/views/store/checkouts/_membership_info.html.haml +0 -12
  438. data/app/views/store/events/_venue.html.haml +0 -9
  439. data/app/views/store/events/calendar.html.haml +0 -50
  440. data/app/views/store/events/single_show.html.haml +0 -45
  441. data/app/views/store/passes/index.html.haml +0 -33
  442. data/app/views/store/retrievals/index.html.haml +0 -11
  443. data/app/views/store/shared/_small_donate_form.html.haml +0 -21
  444. data/app/views/users/mailer/invitation_instructions.html.haml +0 -14
  445. data/config/initializers/paperclip.rb +0 -69
  446. data/db/migrate/20130411162346_add_country_zip_state_phone_number_discipline_to_organizations.rb +0 -9
  447. data/db/migrate/20130412184415_add_first_name_and_last_name_to_users.rb +0 -6
  448. data/db/migrate/20130722153731_add_autentication_token_to_users.rb +0 -5
  449. data/db/migrate/20130723212712_add_qr_code_to_tickets.rb +0 -9
  450. data/db/migrate/20130820011240_add_uuid_to_tickets.rb +0 -13
  451. data/db/migrate/20130820025134_make_ticket_uuid_not_null.rb +0 -11
  452. data/db/migrate/20130823191625_add_pdf_to_orders.rb +0 -5
  453. data/db/migrate/20130916194547_add_relationships.rb +0 -21
  454. data/db/migrate/20131002191646_create_show_stats_view.rb +0 -16
  455. data/db/migrate/20131003134821_add_relationships_to_search.rb +0 -7
  456. data/db/migrate/20131003200508_add_starred_to_relationships.rb +0 -5
  457. data/db/migrate/20131007141421_add_counters_to_member.rb +0 -7
  458. data/db/migrate/20131007144456_remove_expires_at_from_membership.rb +0 -6
  459. data/db/migrate/20131011154027_add_purchased_to_searches.rb +0 -5
  460. data/db/migrate/20131013144010_add_type_to_membership_type.rb +0 -5
  461. data/db/migrate/20131013150230_add_duration_to_membership_type.rb +0 -6
  462. data/db/migrate/20131013192807_change_number_of_shows_to_tickets.rb +0 -5
  463. data/db/migrate/20131015151550_add_households.rb +0 -18
  464. data/db/migrate/20131022183913_add_search_output_options.rb +0 -24
  465. data/db/migrate/20131023200559_add_admin_to_user_memberships.rb +0 -14
  466. data/db/migrate/20131025162155_default_search_filter_values.rb +0 -10
  467. data/db/migrate/20131025180139_unique_household_names.rb +0 -8
  468. data/db/migrate/20131029173612_add_sales_start_to_membership_typ.rb +0 -6
  469. data/db/migrate/20131106191847_add_suggested_households.rb +0 -13
  470. data/db/migrate/20131127162818_add_buyer_id_index_to_tickets.rb +0 -5
  471. data/db/migrate/20131127164000_member_tickets.rb +0 -9
  472. data/db/migrate/20131204162642_add_shared_address.rb +0 -9
  473. data/db/migrate/20131206153323_add_membership_kit.rb +0 -5
  474. data/db/migrate/20131206175325_add_marketing_to_membership_type.rb +0 -6
  475. data/db/migrate/20131210212342_add_show_fee_to_memberhsip_type.rb +0 -5
  476. data/db/migrate/20131210222814_add_renewal_price_to_membership_type.rb +0 -6
  477. data/db/migrate/20131212164553_add_copy_to_individuals_option.rb +0 -5
  478. data/db/migrate/20131223215615_goodbye_order_view.rb +0 -6
  479. data/db/migrate/20140114011856_add_welcome_message_to_memberships.rb +0 -5
  480. data/db/migrate/20140114212127_add_send_email_to_memberships.rb +0 -5
  481. data/db/migrate/20140125183606_index_memberships_and_types.rb +0 -6
  482. data/db/migrate/20140128213101_add_pdf_to_members.rb +0 -5
  483. data/db/migrate/20140128223140_add_uuid_to_member.rb +0 -6
  484. data/db/migrate/20140128223948_add_qr_code_to_member.rb +0 -9
  485. data/db/migrate/20140207135731_update_items_view.rb +0 -38
  486. data/db/migrate/20140210154723_add_cached_stats.rb +0 -5
  487. data/db/migrate/20140218202726_cache_stats.rb +0 -7
  488. data/db/migrate/20140304171625_passes_ahoy.rb +0 -52
  489. data/db/migrate/20140304174807_add_passes_kit.rb +0 -5
  490. data/db/migrate/20140307144454_add_events_pass_types.rb +0 -9
  491. data/db/migrate/20140307193350_add_pass_id_to_cart.rb +0 -7
  492. data/db/migrate/20140314162422_add_total_paid_to_membership.rb +0 -13
  493. data/db/migrate/20140319191237_add_show_dates_to_advanced_search.rb +0 -6
  494. data/db/migrate/20140328172333_add_cols_to_events_pass_types.rb +0 -6
  495. data/db/migrate/20140328174217_add_deleted_at_to_ept.rb +0 -9
  496. data/db/migrate/20140328185432_add_active_to_ept.rb +0 -5
  497. data/db/migrate/20140328192612_add_pass_type_id_to_search.rb +0 -5
  498. data/db/migrate/20140415212841_add_min_max_start_dates_to_searches.artfully_ose_engine.rb +0 -6
  499. data/db/migrate/20140422193345_add_email_copy_to_pass_type.rb +0 -5
  500. data/db/migrate/20140423181639_add_min_max_end_dates_to_searches.artfully_ose_engine.rb +0 -6
  501. data/db/migrate/20140423185921_add_cached_stats_to_event.rb +0 -9
  502. data/db/migrate/20140424174423_add_lifetime_memberships_to_people.artfully_ose_engine.rb +0 -5
  503. data/db/migrate/20140506155241_add_lpt_to_membership_type.rb +0 -5
  504. data/db/migrate/20140507184646_add_bday_attributes_to_person.rb +0 -7
  505. data/db/migrate/20140507201048_add_check_number_to_orders.rb +0 -5
  506. data/db/migrate/20140515143651_remove_show_stats_view.rb +0 -6
  507. data/db/migrate/20140521195853_add_deleted_at_to_pass_type.rb +0 -5
  508. data/db/migrate/20140522205554_add_limit_to_events_pass_types.rb +0 -5
  509. data/db/migrate/20140523180444_remove_tickets_purchased_from_passes.rb +0 -5
  510. data/db/migrate/20140603200735_add_subtitle_to_events.rb +0 -5
  511. data/db/migrate/20140619194127_add_do_not_call_to_people.artfully_ose_engine.rb +0 -5
  512. data/db/migrate/20140623160543_add_index_to_items.rb +0 -7
  513. data/spec/factories/action_factories.rb +0 -19
  514. data/spec/factories/address_factories.rb +0 -11
  515. data/spec/factories/cart_factories.rb +0 -26
  516. data/spec/factories/chart_factories.rb +0 -52
  517. data/spec/factories/discount_factories.rb +0 -11
  518. data/spec/factories/donation_factories.rb +0 -14
  519. data/spec/factories/event_factories.rb +0 -29
  520. data/spec/factories/household_factories.rb +0 -8
  521. data/spec/factories/import_factories.rb +0 -61
  522. data/spec/factories/item_factories.rb +0 -51
  523. data/spec/factories/kit_factories.rb +0 -33
  524. data/spec/factories/member_factories.rb +0 -19
  525. data/spec/factories/membership_factories.rb +0 -9
  526. data/spec/factories/membership_type_factories.rb +0 -18
  527. data/spec/factories/order_factories.rb +0 -40
  528. data/spec/factories/organization_factories.rb +0 -48
  529. data/spec/factories/pass_type_factories.rb +0 -11
  530. data/spec/factories/payments_factories.rb +0 -97
  531. data/spec/factories/person_factories.rb +0 -47
  532. data/spec/factories/phone_factories.rb +0 -6
  533. data/spec/factories/section_factories.rb +0 -21
  534. data/spec/factories/segment_factories.rb +0 -6
  535. data/spec/factories/show_factories.rb +0 -33
  536. data/spec/factories/ticket_factories.rb +0 -57
  537. data/spec/factories/ticket_offer_factories.rb +0 -16
  538. data/spec/factories/ticket_type_factories.rb +0 -8
  539. data/spec/factories/user_factories.rb +0 -24
data/README.md DELETED
@@ -1,28 +0,0 @@
1
- # Artful.ly OSE
2
-
3
- Welcome to Artful.ly OSE
4
-
5
- ## About
6
-
7
- Artful.ly Open Source Edition is the core code of the Artful.ly app downloadable for free and ready for you to roll up your sleeves and build a custom management system for your arts business. The Artful.ly OSE framework gives software developers a base from which they can add features, integrate with other apps, and much more!
8
-
9
- ## Before You Begin
10
-
11
- You'll want the following running on your machine:
12
-
13
- - Ruby 1.9.3
14
- - MySQL
15
-
16
- ## Usage
17
-
18
- Artful.ly Open Source Engine is a Rails Engine. **It is not intended to be mounted into an existing project** but rather to be used with the reference implementation [here](http://www.github.com/fracturedatlas/artfully_app)
19
-
20
- ## Branch strategy
21
-
22
- Master is the current development branch. Every effort is made to make master tidy and working at all times but it is the edge and problems do happen. For any stable production applications, you'll *absolutely* want to be pointing to a published, stable gem. A list can be found [on Rubygems](https://rubygems.org/gems/artfully_ose)
23
-
24
- ## Contributors
25
-
26
- Gary Moore - Lead Developer at Fractured Atlas
27
-
28
- Clinton Judy - Open Source Lead at Fractured Atlas
@@ -1,546 +0,0 @@
1
- /**
2
- * @license AngularJS v1.2.4
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
- * @ngdoc overview
34
- * @name ngResource
35
- * @description
36
- *
37
- * # ngResource
38
- *
39
- * The `ngResource` module provides interaction support with RESTful services
40
- * via the $resource service.
41
- *
42
- * {@installModule resource}
43
- *
44
- * <div doc-module-components="ngResource"></div>
45
- *
46
- * See {@link ngResource.$resource `$resource`} for usage.
47
- */
48
-
49
- /**
50
- * @ngdoc object
51
- * @name ngResource.$resource
52
- * @requires $http
53
- *
54
- * @description
55
- * A factory which creates a resource object that lets you interact with
56
- * [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources.
57
- *
58
- * The returned resource object has action methods which provide high-level behaviors without
59
- * the need to interact with the low level {@link ng.$http $http} service.
60
- *
61
- * Requires the {@link ngResource `ngResource`} module to be installed.
62
- *
63
- * @param {string} url A parametrized URL template with parameters prefixed by `:` as in
64
- * `/user/:username`. If you are using a URL with a port number (e.g.
65
- * `http://example.com:8080/api`), it will be respected.
66
- *
67
- * If you are using a url with a suffix, just add the suffix, like this:
68
- * `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')`
69
- * or even `$resource('http://example.com/resource/:resource_id.:format')`
70
- * If the parameter before the suffix is empty, :resource_id in this case, then the `/.` will be
71
- * collapsed down to a single `.`. If you need this sequence to appear and not collapse then you
72
- * can escape it with `/\.`.
73
- *
74
- * @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in
75
- * `actions` methods. If any of the parameter value is a function, it will be executed every time
76
- * when a param value needs to be obtained for a request (unless the param was overridden).
77
- *
78
- * Each key value in the parameter object is first bound to url template if present and then any
79
- * excess keys are appended to the url search query after the `?`.
80
- *
81
- * Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in
82
- * URL `/path/greet?salutation=Hello`.
83
- *
84
- * If the parameter value is prefixed with `@` then the value of that parameter is extracted from
85
- * the data object (useful for non-GET operations).
86
- *
87
- * @param {Object.<Object>=} actions Hash with declaration of custom action that should extend the
88
- * default set of resource actions. The declaration should be created in the format of {@link
89
- * ng.$http#usage_parameters $http.config}:
90
- *
91
- * {action1: {method:?, params:?, isArray:?, headers:?, ...},
92
- * action2: {method:?, params:?, isArray:?, headers:?, ...},
93
- * ...}
94
- *
95
- * Where:
96
- *
97
- * - **`action`** – {string} – The name of action. This name becomes the name of the method on
98
- * your resource object.
99
- * - **`method`** – {string} – HTTP request method. Valid methods are: `GET`, `POST`, `PUT`,
100
- * `DELETE`, and `JSONP`.
101
- * - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of
102
- * the parameter value is a function, it will be executed every time when a param value needs to
103
- * be obtained for a request (unless the param was overridden).
104
- * - **`url`** – {string} – action specific `url` override. The url templating is supported just
105
- * like for the resource-level urls.
106
- * - **`isArray`** – {boolean=} – If true then the returned object for this action is an array,
107
- * see `returns` section.
108
- * - **`transformRequest`** –
109
- * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
110
- * transform function or an array of such functions. The transform function takes the http
111
- * request body and headers and returns its transformed (typically serialized) version.
112
- * - **`transformResponse`** –
113
- * `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
114
- * transform function or an array of such functions. The transform function takes the http
115
- * response body and headers and returns its transformed (typically deserialized) version.
116
- * - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
117
- * GET request, otherwise if a cache instance built with
118
- * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
119
- * caching.
120
- * - **`timeout`** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} that
121
- * should abort the request when resolved.
122
- * - **`withCredentials`** - `{boolean}` - whether to set the `withCredentials` flag on the
123
- * XHR object. See {@link https://developer.mozilla.org/en/http_access_control#section_5
124
- * requests with credentials} for more information.
125
- * - **`responseType`** - `{string}` - see {@link
126
- * https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType requestType}.
127
- * - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
128
- * `response` and `responseError`. Both `response` and `responseError` interceptors get called
129
- * with `http response` object. See {@link ng.$http $http interceptors}.
130
- *
131
- * @returns {Object} A resource "class" object with methods for the default set of resource actions
132
- * optionally extended with custom `actions`. The default set contains these actions:
133
- *
134
- * { 'get': {method:'GET'},
135
- * 'save': {method:'POST'},
136
- * 'query': {method:'GET', isArray:true},
137
- * 'remove': {method:'DELETE'},
138
- * 'delete': {method:'DELETE'} };
139
- *
140
- * Calling these methods invoke an {@link ng.$http} with the specified http method,
141
- * destination and parameters. When the data is returned from the server then the object is an
142
- * instance of the resource class. The actions `save`, `remove` and `delete` are available on it
143
- * as methods with the `$` prefix. This allows you to easily perform CRUD operations (create,
144
- * read, update, delete) on server-side data like this:
145
- * <pre>
146
- var User = $resource('/user/:userId', {userId:'@id'});
147
- var user = User.get({userId:123}, function() {
148
- user.abc = true;
149
- user.$save();
150
- });
151
- </pre>
152
- *
153
- * It is important to realize that invoking a $resource object method immediately returns an
154
- * empty reference (object or array depending on `isArray`). Once the data is returned from the
155
- * server the existing reference is populated with the actual data. This is a useful trick since
156
- * usually the resource is assigned to a model which is then rendered by the view. Having an empty
157
- * object results in no rendering, once the data arrives from the server then the object is
158
- * populated with the data and the view automatically re-renders itself showing the new data. This
159
- * means that in most cases one never has to write a callback function for the action methods.
160
- *
161
- * The action methods on the class object or instance object can be invoked with the following
162
- * parameters:
163
- *
164
- * - HTTP GET "class" actions: `Resource.action([parameters], [success], [error])`
165
- * - non-GET "class" actions: `Resource.action([parameters], postData, [success], [error])`
166
- * - non-GET instance actions: `instance.$action([parameters], [success], [error])`
167
- *
168
- * Success callback is called with (value, responseHeaders) arguments. Error callback is called
169
- * with (httpResponse) argument.
170
- *
171
- * Class actions return empty instance (with additional properties below).
172
- * Instance actions return promise of the action.
173
- *
174
- * The Resource instances and collection have these additional properties:
175
- *
176
- * - `$promise`: the {@link ng.$q promise} of the original server interaction that created this
177
- * instance or collection.
178
- *
179
- * On success, the promise is resolved with the same resource instance or collection object,
180
- * updated with data from server. This makes it easy to use in
181
- * {@link ngRoute.$routeProvider resolve section of $routeProvider.when()} to defer view
182
- * rendering until the resource(s) are loaded.
183
- *
184
- * On failure, the promise is resolved with the {@link ng.$http http response} object, without
185
- * the `resource` property.
186
- *
187
- * - `$resolved`: `true` after first server interaction is completed (either with success or
188
- * rejection), `false` before that. Knowing if the Resource has been resolved is useful in
189
- * data-binding.
190
- *
191
- * @example
192
- *
193
- * # Credit card resource
194
- *
195
- * <pre>
196
- // Define CreditCard class
197
- var CreditCard = $resource('/user/:userId/card/:cardId',
198
- {userId:123, cardId:'@id'}, {
199
- charge: {method:'POST', params:{charge:true}}
200
- });
201
-
202
- // We can retrieve a collection from the server
203
- var cards = CreditCard.query(function() {
204
- // GET: /user/123/card
205
- // server returns: [ {id:456, number:'1234', name:'Smith'} ];
206
-
207
- var card = cards[0];
208
- // each item is an instance of CreditCard
209
- expect(card instanceof CreditCard).toEqual(true);
210
- card.name = "J. Smith";
211
- // non GET methods are mapped onto the instances
212
- card.$save();
213
- // POST: /user/123/card/456 {id:456, number:'1234', name:'J. Smith'}
214
- // server returns: {id:456, number:'1234', name: 'J. Smith'};
215
-
216
- // our custom method is mapped as well.
217
- card.$charge({amount:9.99});
218
- // POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'}
219
- });
220
-
221
- // we can create an instance as well
222
- var newCard = new CreditCard({number:'0123'});
223
- newCard.name = "Mike Smith";
224
- newCard.$save();
225
- // POST: /user/123/card {number:'0123', name:'Mike Smith'}
226
- // server returns: {id:789, number:'01234', name: 'Mike Smith'};
227
- expect(newCard.id).toEqual(789);
228
- * </pre>
229
- *
230
- * The object returned from this function execution is a resource "class" which has "static" method
231
- * for each action in the definition.
232
- *
233
- * Calling these methods invoke `$http` on the `url` template with the given `method`, `params` and
234
- * `headers`.
235
- * When the data is returned from the server then the object is an instance of the resource type and
236
- * all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
237
- * operations (create, read, update, delete) on server-side data.
238
-
239
- <pre>
240
- var User = $resource('/user/:userId', {userId:'@id'});
241
- var user = User.get({userId:123}, function() {
242
- user.abc = true;
243
- user.$save();
244
- });
245
- </pre>
246
- *
247
- * It's worth noting that the success callback for `get`, `query` and other methods gets passed
248
- * in the response that came from the server as well as $http header getter function, so one
249
- * could rewrite the above example and get access to http headers as:
250
- *
251
- <pre>
252
- var User = $resource('/user/:userId', {userId:'@id'});
253
- User.get({userId:123}, function(u, getResponseHeaders){
254
- u.abc = true;
255
- u.$save(function(u, putResponseHeaders) {
256
- //u => saved user object
257
- //putResponseHeaders => $http header getter
258
- });
259
- });
260
- </pre>
261
- */
262
- angular.module('ngResource', ['ng']).
263
- factory('$resource', ['$http', '$q', function($http, $q) {
264
-
265
- var DEFAULT_ACTIONS = {
266
- 'get': {method:'GET'},
267
- 'save': {method:'POST'},
268
- 'query': {method:'GET', isArray:true},
269
- 'remove': {method:'DELETE'},
270
- 'delete': {method:'DELETE'}
271
- };
272
- var noop = angular.noop,
273
- forEach = angular.forEach,
274
- extend = angular.extend,
275
- copy = angular.copy,
276
- isFunction = angular.isFunction;
277
-
278
- /**
279
- * We need our custom method because encodeURIComponent is too aggressive and doesn't follow
280
- * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
281
- * segments:
282
- * segment = *pchar
283
- * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
284
- * pct-encoded = "%" HEXDIG HEXDIG
285
- * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
286
- * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
287
- * / "*" / "+" / "," / ";" / "="
288
- */
289
- function encodeUriSegment(val) {
290
- return encodeUriQuery(val, true).
291
- replace(/%26/gi, '&').
292
- replace(/%3D/gi, '=').
293
- replace(/%2B/gi, '+');
294
- }
295
-
296
-
297
- /**
298
- * This method is intended for encoding *key* or *value* parts of query component. We need a
299
- * custom method because encodeURIComponent is too aggressive and encodes stuff that doesn't
300
- * have to be encoded per http://tools.ietf.org/html/rfc3986:
301
- * query = *( pchar / "/" / "?" )
302
- * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
303
- * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
304
- * pct-encoded = "%" HEXDIG HEXDIG
305
- * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
306
- * / "*" / "+" / "," / ";" / "="
307
- */
308
- function encodeUriQuery(val, pctEncodeSpaces) {
309
- return encodeURIComponent(val).
310
- replace(/%40/gi, '@').
311
- replace(/%3A/gi, ':').
312
- replace(/%24/g, '$').
313
- replace(/%2C/gi, ',').
314
- replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
315
- }
316
-
317
- function Route(template, defaults) {
318
- this.template = template;
319
- this.defaults = defaults || {};
320
- this.urlParams = {};
321
- }
322
-
323
- Route.prototype = {
324
- setUrlParams: function(config, params, actionUrl) {
325
- var self = this,
326
- url = actionUrl || self.template,
327
- val,
328
- encodedVal;
329
-
330
- var urlParams = self.urlParams = {};
331
- forEach(url.split(/\W/), function(param){
332
- if (param === 'hasOwnProperty') {
333
- throw $resourceMinErr('badname', "hasOwnProperty is not a valid parameter name.");
334
- }
335
- if (!(new RegExp("^\\d+$").test(param)) && param &&
336
- (new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) {
337
- urlParams[param] = true;
338
- }
339
- });
340
- url = url.replace(/\\:/g, ':');
341
-
342
- params = params || {};
343
- forEach(self.urlParams, function(_, urlParam){
344
- val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
345
- if (angular.isDefined(val) && val !== null) {
346
- encodedVal = encodeUriSegment(val);
347
- url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), encodedVal + "$1");
348
- } else {
349
- url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W|$)", "g"), function(match,
350
- leadingSlashes, tail) {
351
- if (tail.charAt(0) == '/') {
352
- return tail;
353
- } else {
354
- return leadingSlashes + tail;
355
- }
356
- });
357
- }
358
- });
359
-
360
- // strip trailing slashes and set the url
361
- url = url.replace(/\/+$/, '');
362
- // then replace collapse `/.` if found in the last URL path segment before the query
363
- // E.g. `http://url.com/id./format?q=x` becomes `http://url.com/id.format?q=x`
364
- url = url.replace(/\/\.(?=\w+($|\?))/, '.');
365
- // replace escaped `/\.` with `/.`
366
- config.url = url.replace(/\/\\\./, '/.');
367
-
368
-
369
- // set params - delegate param encoding to $http
370
- forEach(params, function(value, key){
371
- if (!self.urlParams[key]) {
372
- config.params = config.params || {};
373
- config.params[key] = value;
374
- }
375
- });
376
- }
377
- };
378
-
379
-
380
- function resourceFactory(url, paramDefaults, actions) {
381
- var route = new Route(url);
382
-
383
- actions = extend({}, DEFAULT_ACTIONS, actions);
384
-
385
- function extractParams(data, actionParams){
386
- var ids = {};
387
- actionParams = extend({}, paramDefaults, actionParams);
388
- forEach(actionParams, function(value, key){
389
- if (isFunction(value)) { value = value(); }
390
- ids[key] = value && value.charAt && value.charAt(0) == '@' ?
391
- lookupDottedPath(data, value.substr(1)) : value;
392
- });
393
- return ids;
394
- }
395
-
396
- function defaultResponseInterceptor(response) {
397
- return response.resource;
398
- }
399
-
400
- function Resource(value){
401
- copy(value || {}, this);
402
- }
403
-
404
- forEach(actions, function(action, name) {
405
- var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method);
406
-
407
- Resource[name] = function(a1, a2, a3, a4) {
408
- var params = {}, data, success, error;
409
-
410
- /* jshint -W086 */ /* (purposefully fall through case statements) */
411
- switch(arguments.length) {
412
- case 4:
413
- error = a4;
414
- success = a3;
415
- //fallthrough
416
- case 3:
417
- case 2:
418
- if (isFunction(a2)) {
419
- if (isFunction(a1)) {
420
- success = a1;
421
- error = a2;
422
- break;
423
- }
424
-
425
- success = a2;
426
- error = a3;
427
- //fallthrough
428
- } else {
429
- params = a1;
430
- data = a2;
431
- success = a3;
432
- break;
433
- }
434
- case 1:
435
- if (isFunction(a1)) success = a1;
436
- else if (hasBody) data = a1;
437
- else params = a1;
438
- break;
439
- case 0: break;
440
- default:
441
- throw $resourceMinErr('badargs',
442
- "Expected up to 4 arguments [params, data, success, error], got {0} arguments",
443
- arguments.length);
444
- }
445
- /* jshint +W086 */ /* (purposefully fall through case statements) */
446
-
447
- var isInstanceCall = this instanceof Resource;
448
- var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
449
- var httpConfig = {};
450
- var responseInterceptor = action.interceptor && action.interceptor.response ||
451
- defaultResponseInterceptor;
452
- var responseErrorInterceptor = action.interceptor && action.interceptor.responseError ||
453
- undefined;
454
-
455
- forEach(action, function(value, key) {
456
- if (key != 'params' && key != 'isArray' && key != 'interceptor') {
457
- httpConfig[key] = copy(value);
458
- }
459
- });
460
-
461
- if (hasBody) httpConfig.data = data;
462
- route.setUrlParams(httpConfig,
463
- extend({}, extractParams(data, action.params || {}), params),
464
- action.url);
465
-
466
- var promise = $http(httpConfig).then(function(response) {
467
- var data = response.data,
468
- promise = value.$promise;
469
-
470
- if (data) {
471
- // Need to convert action.isArray to boolean in case it is undefined
472
- // jshint -W018
473
- if ( angular.isArray(data) !== (!!action.isArray) ) {
474
- throw $resourceMinErr('badcfg', 'Error in resource configuration. Expected ' +
475
- 'response to contain an {0} but got an {1}',
476
- action.isArray?'array':'object', angular.isArray(data)?'array':'object');
477
- }
478
- // jshint +W018
479
- if (action.isArray) {
480
- value.length = 0;
481
- forEach(data, function(item) {
482
- value.push(new Resource(item));
483
- });
484
- } else {
485
- copy(data, value);
486
- value.$promise = promise;
487
- }
488
- }
489
-
490
- value.$resolved = true;
491
-
492
- response.resource = value;
493
-
494
- return response;
495
- }, function(response) {
496
- value.$resolved = true;
497
-
498
- (error||noop)(response);
499
-
500
- return $q.reject(response);
501
- });
502
-
503
- promise = promise.then(
504
- function(response) {
505
- var value = responseInterceptor(response);
506
- (success||noop)(value, response.headers);
507
- return value;
508
- },
509
- responseErrorInterceptor);
510
-
511
- if (!isInstanceCall) {
512
- // we are creating instance / collection
513
- // - set the initial promise
514
- // - return the instance / collection
515
- value.$promise = promise;
516
- value.$resolved = false;
517
-
518
- return value;
519
- }
520
-
521
- // instance call
522
- return promise;
523
- };
524
-
525
-
526
- Resource.prototype['$' + name] = function(params, success, error) {
527
- if (isFunction(params)) {
528
- error = success; success = params; params = {};
529
- }
530
- var result = Resource[name].call(this, params, this, success, error);
531
- return result.$promise || result;
532
- };
533
- });
534
-
535
- Resource.bind = function(additionalParamDefaults){
536
- return resourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions);
537
- };
538
-
539
- return Resource;
540
- }
541
-
542
- return resourceFactory;
543
- }]);
544
-
545
-
546
- })(window, window.angular);