railscart 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (463) hide show
  1. data/History.txt +3 -0
  2. data/License.txt +26 -0
  3. data/Manifest.txt +462 -0
  4. data/README.txt +1 -0
  5. data/Rakefile +4 -0
  6. data/bin/railscart +114 -0
  7. data/config/hoe.rb +78 -0
  8. data/config/requirements.rb +19 -0
  9. data/lib/railscart.rb +5 -0
  10. data/lib/railscart/version.rb +9 -0
  11. data/log/debug.log +0 -0
  12. data/script/destroy +14 -0
  13. data/script/generate +14 -0
  14. data/script/txt2html +74 -0
  15. data/setup.rb +1585 -0
  16. data/starter-app/README +182 -0
  17. data/starter-app/Rakefile +10 -0
  18. data/starter-app/app/controllers/application.rb +14 -0
  19. data/starter-app/app/helpers/application_helper.rb +3 -0
  20. data/starter-app/app/models/role.rb +3 -0
  21. data/starter-app/app/models/tag.rb +37 -0
  22. data/starter-app/app/models/tagging.rb +16 -0
  23. data/starter-app/app/models/user.rb +101 -0
  24. data/starter-app/app/views/layouts/application.rhtml +20 -0
  25. data/starter-app/config/boot.rb +45 -0
  26. data/starter-app/config/database.yml +23 -0
  27. data/starter-app/config/environment.rb +119 -0
  28. data/starter-app/config/environments/development.rb +21 -0
  29. data/starter-app/config/environments/production.rb +21 -0
  30. data/starter-app/config/environments/test.rb +19 -0
  31. data/starter-app/config/routes.rb +28 -0
  32. data/starter-app/db/migrate/001_add_sessions.rb +16 -0
  33. data/starter-app/db/migrate/002_create_tags_and_taggings.rb +28 -0
  34. data/starter-app/db/migrate/003_railscart_to_version_19.rb +9 -0
  35. data/starter-app/db/migrate/004_railscart_to_version_20.rb +9 -0
  36. data/starter-app/db/migrate/005_create_users.rb +17 -0
  37. data/starter-app/db/migrate/006_create_roles.rb +20 -0
  38. data/starter-app/db/sample/addresses.yml +29 -0
  39. data/starter-app/db/sample/categories.yml +35 -0
  40. data/starter-app/db/sample/countries.yml +4 -0
  41. data/starter-app/db/sample/line_items.yml +32 -0
  42. data/starter-app/db/sample/option_groups.yml +16 -0
  43. data/starter-app/db/sample/option_values.yml +13 -0
  44. data/starter-app/db/sample/options.yml +3 -0
  45. data/starter-app/db/sample/orders.yml +17 -0
  46. data/starter-app/db/sample/products.yml +70 -0
  47. data/starter-app/db/sample/roles.yml +3 -0
  48. data/starter-app/db/sample/skus.yml +35 -0
  49. data/starter-app/db/sample/states.yml +204 -0
  50. data/starter-app/db/sample/taggings.yml +16 -0
  51. data/starter-app/db/sample/tags.yml +6 -0
  52. data/starter-app/db/sample/txns.yml +13 -0
  53. data/starter-app/db/sample/users.yml +10 -0
  54. data/starter-app/db/sample/variations.yml +20 -0
  55. data/starter-app/doc/README_FOR_APP +2 -0
  56. data/starter-app/lib/authenticated_system.rb +116 -0
  57. data/starter-app/lib/authenticated_test_helper.rb +10 -0
  58. data/starter-app/lib/custom_fixtures.rb +7 -0
  59. data/starter-app/lib/hijacker.rb +78 -0
  60. data/starter-app/lib/role_requirement_system.rb +142 -0
  61. data/starter-app/lib/role_requirement_test_helper.rb +86 -0
  62. data/starter-app/lib/tagging_extensions.rb +104 -0
  63. data/starter-app/lib/tasks/rc_sample_data.rake +31 -0
  64. data/starter-app/lib/tasks/sample/images/ror_bag.jpg +0 -0
  65. data/starter-app/lib/tasks/sample/images/ror_baseball_jersey.jpg +0 -0
  66. data/starter-app/lib/tasks/sample/images/ror_jr_spaghetti.jpg +0 -0
  67. data/starter-app/lib/tasks/sample/images/ror_mug.jpg +0 -0
  68. data/starter-app/lib/tasks/sample/images/ror_ringer_tshirt.jpg +0 -0
  69. data/starter-app/lib/tasks/sample/images/ror_stein.jpg +0 -0
  70. data/starter-app/lib/tasks/sample/images/ror_tote.jpg +0 -0
  71. data/starter-app/public/.htaccess +40 -0
  72. data/starter-app/public/404.html +30 -0
  73. data/starter-app/public/500.html +30 -0
  74. data/starter-app/public/dispatch.cgi +10 -0
  75. data/starter-app/public/dispatch.fcgi +24 -0
  76. data/starter-app/public/dispatch.rb +10 -0
  77. data/starter-app/public/favicon.ico +0 -0
  78. data/starter-app/public/images/rails.png +0 -0
  79. data/starter-app/public/index.html +277 -0
  80. data/starter-app/public/javascripts/application.js +2 -0
  81. data/starter-app/public/javascripts/controls.js +833 -0
  82. data/starter-app/public/javascripts/dragdrop.js +942 -0
  83. data/starter-app/public/javascripts/effects.js +1088 -0
  84. data/starter-app/public/javascripts/prototype.js +4184 -0
  85. data/starter-app/public/robots.txt +1 -0
  86. data/starter-app/public/stylesheets/application.css +186 -0
  87. data/starter-app/public/stylesheets/cart/_controller.css +4 -0
  88. data/starter-app/public/stylesheets/checkout/_controller.css +13 -0
  89. data/starter-app/script/about +3 -0
  90. data/starter-app/script/breakpointer +3 -0
  91. data/starter-app/script/console +3 -0
  92. data/starter-app/script/destroy +3 -0
  93. data/starter-app/script/generate +3 -0
  94. data/starter-app/script/performance/benchmarker +3 -0
  95. data/starter-app/script/performance/profiler +3 -0
  96. data/starter-app/script/plugin +3 -0
  97. data/starter-app/script/process/inspector +3 -0
  98. data/starter-app/script/process/reaper +3 -0
  99. data/starter-app/script/process/spawner +3 -0
  100. data/starter-app/script/runner +3 -0
  101. data/starter-app/script/server +3 -0
  102. data/starter-app/test/fixtures/users.yml +7 -0
  103. data/starter-app/test/test_helper.rb +28 -0
  104. data/starter-app/test/unit/user_test.rb +8 -0
  105. data/starter-app/vendor/plugins/acts_as_list/README +23 -0
  106. data/starter-app/vendor/plugins/acts_as_list/init.rb +3 -0
  107. data/starter-app/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
  108. data/starter-app/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
  109. data/starter-app/vendor/plugins/acts_as_tree/README +26 -0
  110. data/starter-app/vendor/plugins/acts_as_tree/Rakefile +22 -0
  111. data/starter-app/vendor/plugins/acts_as_tree/init.rb +1 -0
  112. data/starter-app/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
  113. data/starter-app/vendor/plugins/acts_as_tree/test/abstract_unit.rb +0 -0
  114. data/starter-app/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
  115. data/starter-app/vendor/plugins/acts_as_tree/test/database.yml +0 -0
  116. data/starter-app/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
  117. data/starter-app/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
  118. data/starter-app/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
  119. data/starter-app/vendor/plugins/calendar_date_select/CHANGELOG +170 -0
  120. data/starter-app/vendor/plugins/calendar_date_select/MIT-LICENSE +20 -0
  121. data/starter-app/vendor/plugins/calendar_date_select/README +10 -0
  122. data/starter-app/vendor/plugins/calendar_date_select/init.rb +15 -0
  123. data/starter-app/vendor/plugins/calendar_date_select/js_test/functional/.tmp_cds_test.html +306 -0
  124. data/starter-app/vendor/plugins/calendar_date_select/js_test/functional/cds_test.html +324 -0
  125. data/starter-app/vendor/plugins/calendar_date_select/js_test/prototype.js +4184 -0
  126. data/starter-app/vendor/plugins/calendar_date_select/js_test/test.css +40 -0
  127. data/starter-app/vendor/plugins/calendar_date_select/js_test/unit/cds_helper_methods.html +46 -0
  128. data/starter-app/vendor/plugins/calendar_date_select/js_test/unittest.js +564 -0
  129. data/starter-app/vendor/plugins/calendar_date_select/lib/calendar_date_select.rb +192 -0
  130. data/starter-app/vendor/plugins/calendar_date_select/lib/includes_helper.rb +22 -0
  131. data/starter-app/vendor/plugins/calendar_date_select/public/images/calendar_date_select/calendar.gif +0 -0
  132. data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/calendar_date_select.js +439 -0
  133. data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_american.js +34 -0
  134. data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_euro_24hr.js +7 -0
  135. data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_finnish.js +24 -0
  136. data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_hyphen_ampm.js +36 -0
  137. data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_italian.js +24 -0
  138. data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/fi.js +10 -0
  139. data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/blue.css +130 -0
  140. data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/default.css +135 -0
  141. data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/plain.css +128 -0
  142. data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/red.css +135 -0
  143. data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/silver.css +133 -0
  144. data/starter-app/vendor/plugins/calendar_date_select/test/functional/calendar_date_select_test.rb +95 -0
  145. data/starter-app/vendor/plugins/calendar_date_select/test/functional/helper_methods_test.rb +15 -0
  146. data/starter-app/vendor/plugins/calendar_date_select/test/test_helper.rb +26 -0
  147. data/starter-app/vendor/plugins/engines/CHANGELOG +258 -0
  148. data/starter-app/vendor/plugins/engines/MIT-LICENSE +21 -0
  149. data/starter-app/vendor/plugins/engines/README +63 -0
  150. data/starter-app/vendor/plugins/engines/Rakefile +32 -0
  151. data/starter-app/vendor/plugins/engines/about.yml +7 -0
  152. data/starter-app/vendor/plugins/engines/boot.rb +18 -0
  153. data/starter-app/vendor/plugins/engines/generators/plugin_migration/USAGE +45 -0
  154. data/starter-app/vendor/plugins/engines/generators/plugin_migration/plugin_migration_generator.rb +79 -0
  155. data/starter-app/vendor/plugins/engines/generators/plugin_migration/templates/plugin_migration.erb +13 -0
  156. data/starter-app/vendor/plugins/engines/init.rb +2 -0
  157. data/starter-app/vendor/plugins/engines/lib/engines.rb +169 -0
  158. data/starter-app/vendor/plugins/engines/lib/engines/assets.rb +38 -0
  159. data/starter-app/vendor/plugins/engines/lib/engines/plugin.rb +125 -0
  160. data/starter-app/vendor/plugins/engines/lib/engines/plugin/list.rb +30 -0
  161. data/starter-app/vendor/plugins/engines/lib/engines/plugin/loader.rb +18 -0
  162. data/starter-app/vendor/plugins/engines/lib/engines/plugin/locator.rb +11 -0
  163. data/starter-app/vendor/plugins/engines/lib/engines/plugin/migrator.rb +60 -0
  164. data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/action_mailer.rb +85 -0
  165. data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/active_record.rb +24 -0
  166. data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/asset_helpers.rb +119 -0
  167. data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb +145 -0
  168. data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb +161 -0
  169. data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/rails.rb +11 -0
  170. data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/routing.rb +84 -0
  171. data/starter-app/vendor/plugins/engines/lib/engines/testing.rb +87 -0
  172. data/starter-app/vendor/plugins/engines/tasks/engines.rake +148 -0
  173. data/starter-app/vendor/plugins/in_place_editing/README +14 -0
  174. data/starter-app/vendor/plugins/in_place_editing/Rakefile +22 -0
  175. data/starter-app/vendor/plugins/in_place_editing/init.rb +2 -0
  176. data/starter-app/vendor/plugins/in_place_editing/lib/in_place_editing.rb +25 -0
  177. data/starter-app/vendor/plugins/in_place_editing/lib/in_place_macros_helper.rb +71 -0
  178. data/starter-app/vendor/plugins/in_place_editing/test/in_place_editing_test.rb +69 -0
  179. data/starter-app/vendor/plugins/paginating_find/CHANGELOG +117 -0
  180. data/starter-app/vendor/plugins/paginating_find/README +89 -0
  181. data/starter-app/vendor/plugins/paginating_find/init.rb +2 -0
  182. data/starter-app/vendor/plugins/paginating_find/lib/paginating_find.rb +135 -0
  183. data/starter-app/vendor/plugins/paginating_find/lib/paging_enumerator.rb +158 -0
  184. data/starter-app/vendor/plugins/paginating_find/lib/paging_helper.rb +47 -0
  185. data/starter-app/vendor/plugins/paginating_find/test_app/Rakefile +10 -0
  186. data/starter-app/vendor/plugins/paginating_find/test_app/app/controllers/application.rb +2 -0
  187. data/starter-app/vendor/plugins/paginating_find/test_app/config/boot.rb +44 -0
  188. data/starter-app/vendor/plugins/paginating_find/test_app/config/database.yml +6 -0
  189. data/starter-app/vendor/plugins/paginating_find/test_app/config/environment.rb +53 -0
  190. data/starter-app/vendor/plugins/paginating_find/test_app/config/environments/test.rb +19 -0
  191. data/starter-app/vendor/plugins/paginating_find/test_app/config/routes.rb +22 -0
  192. data/starter-app/vendor/plugins/paginating_find/test_app/db/schema.rb +16 -0
  193. data/starter-app/vendor/plugins/paginating_find/test_app/script/breakpointer +3 -0
  194. data/starter-app/vendor/plugins/paginating_find/test_app/script/console +3 -0
  195. data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/articles.yml +19 -0
  196. data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/authors.yml +7 -0
  197. data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/edits.yml +11 -0
  198. data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/models.rb +18 -0
  199. data/starter-app/vendor/plugins/paginating_find/test_app/test/test_helper.rb +33 -0
  200. data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/abstract_test.rb +7 -0
  201. data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/group_test.rb +40 -0
  202. data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/paginating_find_test.rb +194 -0
  203. data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/paging_enumerator_test.rb +143 -0
  204. data/starter-app/vendor/plugins/railscart/.rakeTasks +7 -0
  205. data/starter-app/vendor/plugins/railscart/CHANGELOG +1 -0
  206. data/starter-app/vendor/plugins/railscart/LICENSE +26 -0
  207. data/starter-app/vendor/plugins/railscart/README +2 -0
  208. data/starter-app/vendor/plugins/railscart/Rakefile +10 -0
  209. data/starter-app/vendor/plugins/railscart/VERSION +1 -0
  210. data/starter-app/vendor/plugins/railscart/app/controllers/account_controller.rb +48 -0
  211. data/starter-app/vendor/plugins/railscart/app/controllers/admin/base_controller.rb +7 -0
  212. data/starter-app/vendor/plugins/railscart/app/controllers/admin/categories_controller.rb +107 -0
  213. data/starter-app/vendor/plugins/railscart/app/controllers/admin/option_groups_controller.rb +36 -0
  214. data/starter-app/vendor/plugins/railscart/app/controllers/admin/option_values_controller.rb +42 -0
  215. data/starter-app/vendor/plugins/railscart/app/controllers/admin/options_controller.rb +52 -0
  216. data/starter-app/vendor/plugins/railscart/app/controllers/admin/orders_controller.rb +194 -0
  217. data/starter-app/vendor/plugins/railscart/app/controllers/admin/overview_controller.rb +14 -0
  218. data/starter-app/vendor/plugins/railscart/app/controllers/admin/products_controller.rb +147 -0
  219. data/starter-app/vendor/plugins/railscart/app/controllers/admin/reports_controller.rb +53 -0
  220. data/starter-app/vendor/plugins/railscart/app/controllers/admin/users_controller.rb +45 -0
  221. data/starter-app/vendor/plugins/railscart/app/controllers/admin/variations_controller.rb +73 -0
  222. data/starter-app/vendor/plugins/railscart/app/controllers/cart_controller.rb +45 -0
  223. data/starter-app/vendor/plugins/railscart/app/controllers/checkout_controller.rb +179 -0
  224. data/starter-app/vendor/plugins/railscart/app/controllers/rails_cart/base_controller.rb +41 -0
  225. data/starter-app/vendor/plugins/railscart/app/controllers/store_controller.rb +20 -0
  226. data/starter-app/vendor/plugins/railscart/app/helpers/account_helper.rb +2 -0
  227. data/starter-app/vendor/plugins/railscart/app/helpers/admin/base_helper.rb +15 -0
  228. data/starter-app/vendor/plugins/railscart/app/helpers/admin/categories_helper.rb +3 -0
  229. data/starter-app/vendor/plugins/railscart/app/helpers/admin/option_groups_helper.rb +2 -0
  230. data/starter-app/vendor/plugins/railscart/app/helpers/admin/option_values_helper.rb +2 -0
  231. data/starter-app/vendor/plugins/railscart/app/helpers/admin/orders_helper.rb +11 -0
  232. data/starter-app/vendor/plugins/railscart/app/helpers/admin/overview_helper.rb +12 -0
  233. data/starter-app/vendor/plugins/railscart/app/helpers/admin/users_helper.rb +2 -0
  234. data/starter-app/vendor/plugins/railscart/app/helpers/admin/variations_helper.rb +2 -0
  235. data/starter-app/vendor/plugins/railscart/app/helpers/cart_helper.rb +6 -0
  236. data/starter-app/vendor/plugins/railscart/app/helpers/checkout_helper.rb +17 -0
  237. data/starter-app/vendor/plugins/railscart/app/helpers/rails_cart/base_helper.rb +67 -0
  238. data/starter-app/vendor/plugins/railscart/app/helpers/search_helper.rb +10 -0
  239. data/starter-app/vendor/plugins/railscart/app/helpers/store_helper.rb +3 -0
  240. data/starter-app/vendor/plugins/railscart/app/models/address.rb +17 -0
  241. data/starter-app/vendor/plugins/railscart/app/models/cart.rb +37 -0
  242. data/starter-app/vendor/plugins/railscart/app/models/cart_item.rb +28 -0
  243. data/starter-app/vendor/plugins/railscart/app/models/category.rb +66 -0
  244. data/starter-app/vendor/plugins/railscart/app/models/country.rb +3 -0
  245. data/starter-app/vendor/plugins/railscart/app/models/line_item.rb +24 -0
  246. data/starter-app/vendor/plugins/railscart/app/models/option.rb +4 -0
  247. data/starter-app/vendor/plugins/railscart/app/models/option_group.rb +6 -0
  248. data/starter-app/vendor/plugins/railscart/app/models/option_value.rb +4 -0
  249. data/starter-app/vendor/plugins/railscart/app/models/order.rb +86 -0
  250. data/starter-app/vendor/plugins/railscart/app/models/order_mailer.rb +20 -0
  251. data/starter-app/vendor/plugins/railscart/app/models/payment.rb +49 -0
  252. data/starter-app/vendor/plugins/railscart/app/models/product.rb +76 -0
  253. data/starter-app/vendor/plugins/railscart/app/models/search_criteria.rb +27 -0
  254. data/starter-app/vendor/plugins/railscart/app/models/sku.rb +7 -0
  255. data/starter-app/vendor/plugins/railscart/app/models/state.rb +3 -0
  256. data/starter-app/vendor/plugins/railscart/app/models/tax_treatment.rb +2 -0
  257. data/starter-app/vendor/plugins/railscart/app/models/txn.rb +7 -0
  258. data/starter-app/vendor/plugins/railscart/app/models/variation.rb +5 -0
  259. data/starter-app/vendor/plugins/railscart/app/views/account/index.rhtml +3 -0
  260. data/starter-app/vendor/plugins/railscart/app/views/account/login.rhtml +12 -0
  261. data/starter-app/vendor/plugins/railscart/app/views/account/signup.rhtml +16 -0
  262. data/starter-app/vendor/plugins/railscart/app/views/admin/categories/_form.rhtml +27 -0
  263. data/starter-app/vendor/plugins/railscart/app/views/admin/categories/edit.rhtml +9 -0
  264. data/starter-app/vendor/plugins/railscart/app/views/admin/categories/list.rhtml +47 -0
  265. data/starter-app/vendor/plugins/railscart/app/views/admin/categories/new.rhtml +8 -0
  266. data/starter-app/vendor/plugins/railscart/app/views/admin/option_groups/_form.rhtml +19 -0
  267. data/starter-app/vendor/plugins/railscart/app/views/admin/option_groups/new.rhtml +8 -0
  268. data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/_form.rhtml +8 -0
  269. data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/edit.rhtml +8 -0
  270. data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/list.rhtml +22 -0
  271. data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/new.rhtml +8 -0
  272. data/starter-app/vendor/plugins/railscart/app/views/admin/options/_form.rhtml +7 -0
  273. data/starter-app/vendor/plugins/railscart/app/views/admin/options/edit.rhtml +26 -0
  274. data/starter-app/vendor/plugins/railscart/app/views/admin/options/list.rhtml +23 -0
  275. data/starter-app/vendor/plugins/railscart/app/views/admin/options/new.rhtml +8 -0
  276. data/starter-app/vendor/plugins/railscart/app/views/admin/orders/_address.rhtml +37 -0
  277. data/starter-app/vendor/plugins/railscart/app/views/admin/orders/index.rhtml +99 -0
  278. data/starter-app/vendor/plugins/railscart/app/views/admin/orders/show.rhtml +43 -0
  279. data/starter-app/vendor/plugins/railscart/app/views/admin/overview/index.rhtml +0 -0
  280. data/starter-app/vendor/plugins/railscart/app/views/admin/products/_form.rhtml +55 -0
  281. data/starter-app/vendor/plugins/railscart/app/views/admin/products/_menu.rhtml +8 -0
  282. data/starter-app/vendor/plugins/railscart/app/views/admin/products/_new_variation.rhtml +0 -0
  283. data/starter-app/vendor/plugins/railscart/app/views/admin/products/edit.rhtml +8 -0
  284. data/starter-app/vendor/plugins/railscart/app/views/admin/products/index.rhtml +66 -0
  285. data/starter-app/vendor/plugins/railscart/app/views/admin/products/new.rhtml +13 -0
  286. data/starter-app/vendor/plugins/railscart/app/views/admin/products/show.rhtml +26 -0
  287. data/starter-app/vendor/plugins/railscart/app/views/admin/reports/index.rhtml +29 -0
  288. data/starter-app/vendor/plugins/railscart/app/views/admin/reports/sales_total.rhtml +28 -0
  289. data/starter-app/vendor/plugins/railscart/app/views/admin/users/_form.rhtml +29 -0
  290. data/starter-app/vendor/plugins/railscart/app/views/admin/users/_menu.rhtml +5 -0
  291. data/starter-app/vendor/plugins/railscart/app/views/admin/users/edit.rhtml +8 -0
  292. data/starter-app/vendor/plugins/railscart/app/views/admin/users/index.rhtml +26 -0
  293. data/starter-app/vendor/plugins/railscart/app/views/admin/users/new.rhtml +6 -0
  294. data/starter-app/vendor/plugins/railscart/app/views/admin/users/show.rhtml +9 -0
  295. data/starter-app/vendor/plugins/railscart/app/views/admin/variations/_form.rhtml +33 -0
  296. data/starter-app/vendor/plugins/railscart/app/views/admin/variations/_option_values.rhtml +5 -0
  297. data/starter-app/vendor/plugins/railscart/app/views/admin/variations/list.rhtml +23 -0
  298. data/starter-app/vendor/plugins/railscart/app/views/admin/variations/new.rhtml +14 -0
  299. data/starter-app/vendor/plugins/railscart/app/views/cart/index.rhtml +49 -0
  300. data/starter-app/vendor/plugins/railscart/app/views/checkout/_address.rhtml +51 -0
  301. data/starter-app/vendor/plugins/railscart/app/views/checkout/_address_ro.rhtml +18 -0
  302. data/starter-app/vendor/plugins/railscart/app/views/checkout/_cart_item.rhtml +5 -0
  303. data/starter-app/vendor/plugins/railscart/app/views/checkout/_extra.rhtml +1 -0
  304. data/starter-app/vendor/plugins/railscart/app/views/checkout/addresses.rhtml +49 -0
  305. data/starter-app/vendor/plugins/railscart/app/views/checkout/cvv.rhtml +15 -0
  306. data/starter-app/vendor/plugins/railscart/app/views/checkout/empty_cart.rhtml +4 -0
  307. data/starter-app/vendor/plugins/railscart/app/views/checkout/final_confirmation.rhtml +92 -0
  308. data/starter-app/vendor/plugins/railscart/app/views/checkout/incomplete.rhtml +7 -0
  309. data/starter-app/vendor/plugins/railscart/app/views/checkout/thank_you.rhtml +11 -0
  310. data/starter-app/vendor/plugins/railscart/app/views/layouts/admin.rhtml +69 -0
  311. data/starter-app/vendor/plugins/railscart/app/views/layouts/products.rhtml +20 -0
  312. data/starter-app/vendor/plugins/railscart/app/views/layouts/simple.rhtml +37 -0
  313. data/starter-app/vendor/plugins/railscart/app/views/order_mailer/cancel.rhtml +15 -0
  314. data/starter-app/vendor/plugins/railscart/app/views/order_mailer/confirm.rhtml +18 -0
  315. data/starter-app/vendor/plugins/railscart/app/views/shared/_order_details.rhtml +35 -0
  316. data/starter-app/vendor/plugins/railscart/app/views/shared/_paginate.rhtml +34 -0
  317. data/starter-app/vendor/plugins/railscart/app/views/shared/_report_criteria.rhtml +32 -0
  318. data/starter-app/vendor/plugins/railscart/app/views/shared/_tax_treatments.rhtml +12 -0
  319. data/starter-app/vendor/plugins/railscart/app/views/shared/_variations.rhtml +60 -0
  320. data/starter-app/vendor/plugins/railscart/app/views/store/_menu.rhtml +7 -0
  321. data/starter-app/vendor/plugins/railscart/app/views/store/_products.rhtml +10 -0
  322. data/starter-app/vendor/plugins/railscart/app/views/store/list.rhtml +16 -0
  323. data/starter-app/vendor/plugins/railscart/app/views/store/show.rhtml +71 -0
  324. data/starter-app/vendor/plugins/railscart/assets/.htaccess +40 -0
  325. data/starter-app/vendor/plugins/railscart/assets/404.html +30 -0
  326. data/starter-app/vendor/plugins/railscart/assets/500.html +30 -0
  327. data/starter-app/vendor/plugins/railscart/assets/dispatch.cgi +10 -0
  328. data/starter-app/vendor/plugins/railscart/assets/dispatch.fcgi +24 -0
  329. data/starter-app/vendor/plugins/railscart/assets/dispatch.rb +10 -0
  330. data/starter-app/vendor/plugins/railscart/assets/favicon.ico +0 -0
  331. data/starter-app/vendor/plugins/railscart/assets/images/amex_cid.gif +0 -0
  332. data/starter-app/vendor/plugins/railscart/assets/images/creditcard.gif +0 -0
  333. data/starter-app/vendor/plugins/railscart/assets/images/discover_cid.gif +0 -0
  334. data/starter-app/vendor/plugins/railscart/assets/images/master_cid.jpg +0 -0
  335. data/starter-app/vendor/plugins/railscart/assets/images/products/ror_bag.jpg +0 -0
  336. data/starter-app/vendor/plugins/railscart/assets/images/products/ror_baseball_jersey.jpg +0 -0
  337. data/starter-app/vendor/plugins/railscart/assets/images/products/ror_jr_spaghetti.jpg +0 -0
  338. data/starter-app/vendor/plugins/railscart/assets/images/products/ror_mug.jpg +0 -0
  339. data/starter-app/vendor/plugins/railscart/assets/images/products/ror_ringer_tshirt.jpg +0 -0
  340. data/starter-app/vendor/plugins/railscart/assets/images/products/ror_stein.jpg +0 -0
  341. data/starter-app/vendor/plugins/railscart/assets/images/products/ror_tote.jpg +0 -0
  342. data/starter-app/vendor/plugins/railscart/assets/images/rails.png +0 -0
  343. data/starter-app/vendor/plugins/railscart/assets/images/railscart/progress.gif +0 -0
  344. data/starter-app/vendor/plugins/railscart/assets/images/railscart/railscart_logo142x65.gif +0 -0
  345. data/starter-app/vendor/plugins/railscart/assets/images/railscart/railscart_logo245x112.gif +0 -0
  346. data/starter-app/vendor/plugins/railscart/assets/images/railscart/spinner.gif +0 -0
  347. data/starter-app/vendor/plugins/railscart/assets/images/spinner.gif +0 -0
  348. data/starter-app/vendor/plugins/railscart/assets/images/visa_cid.gif +0 -0
  349. data/starter-app/vendor/plugins/railscart/assets/javascripts/application.js +2 -0
  350. data/starter-app/vendor/plugins/railscart/assets/javascripts/controls.js +833 -0
  351. data/starter-app/vendor/plugins/railscart/assets/javascripts/dragdrop.js +942 -0
  352. data/starter-app/vendor/plugins/railscart/assets/javascripts/effects.js +1088 -0
  353. data/starter-app/vendor/plugins/railscart/assets/javascripts/lowpro.js +307 -0
  354. data/starter-app/vendor/plugins/railscart/assets/javascripts/prototype.js +2515 -0
  355. data/starter-app/vendor/plugins/railscart/assets/robots.txt +1 -0
  356. data/starter-app/vendor/plugins/railscart/assets/stylesheets/cart/_controller.css +71 -0
  357. data/starter-app/vendor/plugins/railscart/assets/stylesheets/checkout/_controller.css +31 -0
  358. data/starter-app/vendor/plugins/railscart/assets/stylesheets/fullscreen.css +63 -0
  359. data/starter-app/vendor/plugins/railscart/assets/stylesheets/orders/_controller.css +3 -0
  360. data/starter-app/vendor/plugins/railscart/assets/stylesheets/products/_controller.css +13 -0
  361. data/starter-app/vendor/plugins/railscart/assets/stylesheets/railscart-admin.css +295 -0
  362. data/starter-app/vendor/plugins/railscart/assets/stylesheets/railscart.css +66 -0
  363. data/starter-app/vendor/plugins/railscart/assets/stylesheets/store/_controller.css +23 -0
  364. data/starter-app/vendor/plugins/railscart/db/migrate/001_create_addresses.rb +22 -0
  365. data/starter-app/vendor/plugins/railscart/db/migrate/002_create_cart_items.rb +14 -0
  366. data/starter-app/vendor/plugins/railscart/db/migrate/003_create_carts.rb +12 -0
  367. data/starter-app/vendor/plugins/railscart/db/migrate/004_create_categories.rb +15 -0
  368. data/starter-app/vendor/plugins/railscart/db/migrate/005_create_categories_products.rb +12 -0
  369. data/starter-app/vendor/plugins/railscart/db/migrate/006_create_line_items.rb +17 -0
  370. data/starter-app/vendor/plugins/railscart/db/migrate/007_create_option_groups.rb +12 -0
  371. data/starter-app/vendor/plugins/railscart/db/migrate/008_create_option_values.rb +11 -0
  372. data/starter-app/vendor/plugins/railscart/db/migrate/009_create_options.rb +11 -0
  373. data/starter-app/vendor/plugins/railscart/db/migrate/010_create_orders.rb +24 -0
  374. data/starter-app/vendor/plugins/railscart/db/migrate/011_create_products.rb +22 -0
  375. data/starter-app/vendor/plugins/railscart/db/migrate/012_ignore_users.rb +9 -0
  376. data/starter-app/vendor/plugins/railscart/db/migrate/013_create_txns.rb +21 -0
  377. data/starter-app/vendor/plugins/railscart/db/migrate/014_ignore_roles.rb +9 -0
  378. data/starter-app/vendor/plugins/railscart/db/migrate/015_create_variations.rb +14 -0
  379. data/starter-app/vendor/plugins/railscart/db/migrate/016_create_tax_treatments.rb +23 -0
  380. data/starter-app/vendor/plugins/railscart/db/migrate/017_create_skus.rb +13 -0
  381. data/starter-app/vendor/plugins/railscart/db/migrate/018_create_countries.rb +11 -0
  382. data/starter-app/vendor/plugins/railscart/db/migrate/019_create_states.rb +13 -0
  383. data/starter-app/vendor/plugins/railscart/db/migrate/020_modify_users.rb +9 -0
  384. data/starter-app/vendor/plugins/railscart/init.rb +16 -0
  385. data/starter-app/vendor/plugins/railscart/install.rb +3 -0
  386. data/starter-app/vendor/plugins/railscart/lib/constants/enumerable_constants.rb +207 -0
  387. data/starter-app/vendor/plugins/railscart/lib/format.rb +12 -0
  388. data/starter-app/vendor/plugins/railscart/lib/gateway/bogus_gateway.rb +63 -0
  389. data/starter-app/vendor/plugins/railscart/lib/shipping/flat_rate.rb +10 -0
  390. data/starter-app/vendor/plugins/railscart/lib/tasks/rc_bootstrap.rake +24 -0
  391. data/starter-app/vendor/plugins/railscart/lib/tax/sales_tax.rb +26 -0
  392. data/starter-app/vendor/plugins/railscart/routes.rb +3 -0
  393. data/starter-app/vendor/plugins/railscart/script/about +3 -0
  394. data/starter-app/vendor/plugins/railscart/script/breakpointer +3 -0
  395. data/starter-app/vendor/plugins/railscart/script/console +3 -0
  396. data/starter-app/vendor/plugins/railscart/script/destroy +3 -0
  397. data/starter-app/vendor/plugins/railscart/script/generate +3 -0
  398. data/starter-app/vendor/plugins/railscart/script/performance/benchmarker +3 -0
  399. data/starter-app/vendor/plugins/railscart/script/performance/profiler +3 -0
  400. data/starter-app/vendor/plugins/railscart/script/plugin +3 -0
  401. data/starter-app/vendor/plugins/railscart/script/process/inspector +3 -0
  402. data/starter-app/vendor/plugins/railscart/script/process/reaper +3 -0
  403. data/starter-app/vendor/plugins/railscart/script/process/spawner +3 -0
  404. data/starter-app/vendor/plugins/railscart/script/runner +3 -0
  405. data/starter-app/vendor/plugins/railscart/script/server +3 -0
  406. data/starter-app/vendor/plugins/railscart/test/fixtures/addresses.yml +29 -0
  407. data/starter-app/vendor/plugins/railscart/test/fixtures/categories.yml +40 -0
  408. data/starter-app/vendor/plugins/railscart/test/fixtures/line_items.yml +32 -0
  409. data/starter-app/vendor/plugins/railscart/test/fixtures/orders.yml +17 -0
  410. data/starter-app/vendor/plugins/railscart/test/fixtures/products.yml +63 -0
  411. data/starter-app/vendor/plugins/railscart/test/fixtures/products_tags.yml +10 -0
  412. data/starter-app/vendor/plugins/railscart/test/fixtures/roles.yml +6 -0
  413. data/starter-app/vendor/plugins/railscart/test/fixtures/roles_users.yml +3 -0
  414. data/starter-app/vendor/plugins/railscart/test/fixtures/skus.yml +5 -0
  415. data/starter-app/vendor/plugins/railscart/test/fixtures/tags.yml +7 -0
  416. data/starter-app/vendor/plugins/railscart/test/fixtures/tax_treatments.yml +7 -0
  417. data/starter-app/vendor/plugins/railscart/test/fixtures/txns.yml +13 -0
  418. data/starter-app/vendor/plugins/railscart/test/fixtures/users.yml +40 -0
  419. data/starter-app/vendor/plugins/railscart/test/fixtures/variations.yml +16 -0
  420. data/starter-app/vendor/plugins/railscart/test/functional/account_controller_test.rb +129 -0
  421. data/starter-app/vendor/plugins/railscart/test/functional/admin/base_controller_test.rb +18 -0
  422. data/starter-app/vendor/plugins/railscart/test/functional/admin/option_groups_controller_test.rb +18 -0
  423. data/starter-app/vendor/plugins/railscart/test/functional/admin/option_values_controller_test.rb +18 -0
  424. data/starter-app/vendor/plugins/railscart/test/functional/admin/orders_controller_test.rb +18 -0
  425. data/starter-app/vendor/plugins/railscart/test/functional/admin/overview_controller_test.rb +18 -0
  426. data/starter-app/vendor/plugins/railscart/test/functional/admin/products_controller_test.rb +125 -0
  427. data/starter-app/vendor/plugins/railscart/test/functional/admin/users_controller_test.rb +58 -0
  428. data/starter-app/vendor/plugins/railscart/test/functional/admin/variations_controller_test.rb +18 -0
  429. data/starter-app/vendor/plugins/railscart/test/functional/application_controller_test.rb +30 -0
  430. data/starter-app/vendor/plugins/railscart/test/functional/cart_controller_test.rb +76 -0
  431. data/starter-app/vendor/plugins/railscart/test/functional/checkout_controller_test.rb +20 -0
  432. data/starter-app/vendor/plugins/railscart/test/integration/authentication_test.rb +53 -0
  433. data/starter-app/vendor/plugins/railscart/test/integration/product_admin_test.rb +135 -0
  434. data/starter-app/vendor/plugins/railscart/test/integration/user_stories_test.rb +59 -0
  435. data/starter-app/vendor/plugins/railscart/test/integration/variations_test.rb +24 -0
  436. data/starter-app/vendor/plugins/railscart/test/test_helper.rb +45 -0
  437. data/starter-app/vendor/plugins/railscart/test/unit/address_test.rb +10 -0
  438. data/starter-app/vendor/plugins/railscart/test/unit/cart_item_test.rb +55 -0
  439. data/starter-app/vendor/plugins/railscart/test/unit/cart_test.rb +35 -0
  440. data/starter-app/vendor/plugins/railscart/test/unit/category_test.rb +52 -0
  441. data/starter-app/vendor/plugins/railscart/test/unit/line_item_test.rb +61 -0
  442. data/starter-app/vendor/plugins/railscart/test/unit/option_group_test.rb +12 -0
  443. data/starter-app/vendor/plugins/railscart/test/unit/order_test.rb +49 -0
  444. data/starter-app/vendor/plugins/railscart/test/unit/product_test.rb +107 -0
  445. data/starter-app/vendor/plugins/railscart/test/unit/role_test.rb +10 -0
  446. data/starter-app/vendor/plugins/railscart/test/unit/sales_tax_test.rb +46 -0
  447. data/starter-app/vendor/plugins/railscart/test/unit/sku_test.rb +10 -0
  448. data/starter-app/vendor/plugins/railscart/test/unit/tag_test.rb +9 -0
  449. data/starter-app/vendor/plugins/railscart/test/unit/tax_treatment_test.rb +10 -0
  450. data/starter-app/vendor/plugins/railscart/test/unit/txn_test.rb +10 -0
  451. data/starter-app/vendor/plugins/railscart/test/unit/variation_test.rb +9 -0
  452. data/starter-app/vendor/plugins/railscart/uninstall.rb +1 -0
  453. data/tasks/deployment.rake +34 -0
  454. data/tasks/environment.rake +7 -0
  455. data/tasks/website.rake +17 -0
  456. data/test/test_helper.rb +2 -0
  457. data/test/test_railscart.rb +11 -0
  458. data/website/index.html +93 -0
  459. data/website/index.txt +39 -0
  460. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  461. data/website/stylesheets/screen.css +138 -0
  462. data/website/template.rhtml +48 -0
  463. metadata +557 -0
@@ -0,0 +1,192 @@
1
+ class CalendarDateSelect
2
+ FORMATS = {
3
+ :natural => {
4
+ :date => "%B %d, %Y",
5
+ :time => " %I:%M %p"
6
+ },
7
+ :hyphen_ampm => {
8
+ :date => "%Y-%m-%d",
9
+ :time => " %I:%M %p",
10
+ :javascript_include => "format_hyphen_ampm"
11
+ },
12
+ :finnish => {
13
+ :date => "%d.%m.%Y",
14
+ :time => " %H:%M",
15
+ :javascript_include => "format_finnish"
16
+ },
17
+ :american => {
18
+ :date => "%m/%d/%Y",
19
+ :time => " %I:%M %p",
20
+ :javascript_include => "format_american"
21
+ },
22
+ :euro_24hr => {
23
+ :date => "%d %B %Y",
24
+ :time => " %H:%M",
25
+ :javascript_include => "format_euro_24hr"
26
+ },
27
+ :italian => {
28
+ :date => "%d/%m/%Y",
29
+ :time => " %H:%M",
30
+ :javascript_include => "format_italian"
31
+ }
32
+ }
33
+
34
+ cattr_accessor :image
35
+ @@image = "calendar_date_select/calendar.gif"
36
+
37
+ cattr_reader :format
38
+ @@format = FORMATS[:natural]
39
+
40
+ class << self
41
+ def format=(format)
42
+ raise "CalendarDateSelect: Unrecognized format specification: #{format}" unless FORMATS.has_key?(format)
43
+ @@format = FORMATS[format]
44
+ end
45
+
46
+ def javascript_format_include
47
+ @@format[:javascript_include] && "calendar_date_select/#{@@format[:javascript_include]}"
48
+ end
49
+
50
+ def date_format_string(time=false)
51
+ @@format[:date] + ( time ? @@format[:time] : "" )
52
+ end
53
+
54
+ def format_date(date)
55
+ if Date===date
56
+ date.strftime(date_format_string(false))
57
+ else
58
+ date.strftime(date_format_string(true))
59
+ end
60
+ end
61
+
62
+ def has_time?(value)
63
+ /[0-9]:[0-9]{2}/.match(value.to_s)
64
+ end
65
+ end
66
+
67
+ module FormHelper
68
+ def calendar_date_select_tag( name, value = nil, options = {})
69
+ calendar_options = calendar_date_select_process_options(options)
70
+ value = (value.strftime(calendar_options[:format]) rescue value) if (value.respond_to?("strftime"))
71
+
72
+ calendar_options.delete(:format)
73
+
74
+ options[:id] ||= name
75
+ tag = calendar_options[:hidden] || calendar_options[:embedded] ?
76
+ hidden_field_tag(name, value, options) :
77
+ text_field_tag(name, value, options)
78
+
79
+ calendar_date_select_output(tag, calendar_options)
80
+ end
81
+
82
+ # extracts any options passed into calendar date select, appropriating them to either the Javascript call or the html tag.
83
+ def calendar_date_select_process_options(options)
84
+ calendar_options = {}
85
+ callbacks = [:before_show, :before_close, :after_show, :after_close, :after_navigate]
86
+ for key in [:time, :valid_date_check, :embedded, :buttons, :format, :year_range, :month_year, :popup, :hidden] + callbacks
87
+ calendar_options[key] = options.delete(key) if options.has_key?(key)
88
+ end
89
+
90
+ # if passing in mixed, pad it with single quotes
91
+ calendar_options[:time] = "'mixed'" if calendar_options[:time].to_s=="mixed"
92
+ calendar_options[:month_year] = "'#{calendar_options[:month_year]}'" if calendar_options[:month_year]
93
+
94
+ # if we are forcing the popup, automatically set the readonly property on the input control.
95
+ if calendar_options[:popup].to_s == "force"
96
+ calendar_options[:popup] = "'force'"
97
+ options[:readonly] = true
98
+ end
99
+
100
+ if (vdc=calendar_options.delete(:valid_date_check))
101
+ if vdc.include?(";") || vdc.include?("function")
102
+ throw ":valid_date_check function is missing a 'return' statement. Try something like: :valid_date_check => 'if (date > new(Date)) return true; else return false;'" unless vdc.include?("return");
103
+ end
104
+
105
+ vdc = "return(#{vdc})" unless vdc.include?("return")
106
+ vdc = "function(date) { #{vdc} }" unless vdc.include?("function")
107
+ calendar_options[:valid_date_check] = vdc
108
+ end
109
+
110
+ calendar_options[:popup_by] ||= "this" if calendar_options[:hidden]
111
+
112
+ # surround any callbacks with a function, if not already done so
113
+ for key in callbacks
114
+ calendar_options[key] = "function(param) { #{calendar_options[key]} }" unless calendar_options[key].include?("function") if calendar_options[key]
115
+ end
116
+
117
+ calendar_options[:year_range] = format_year_range(calendar_options[:year_range] || 10)
118
+ calendar_options
119
+ end
120
+
121
+ def calendar_date_select(object, method, options={})
122
+ obj = options.include?(:object) ? options[:object] : instance_eval("@#{object}")
123
+
124
+ if !options.include?(:time) && obj.class.respond_to?("columns_hash")
125
+ column_type = (obj.class.columns_hash[method.to_s].type rescue nil)
126
+ options[:time] = true if column_type == :datetime
127
+ end
128
+
129
+ use_time = options[:time]
130
+
131
+ if options[:time].to_s=="mixed"
132
+ use_time = false if Date===obj.send(method)
133
+ end
134
+
135
+ calendar_options = calendar_date_select_process_options(options)
136
+
137
+ options[:value] ||=
138
+ if(obj.respond_to?(method) && obj.send(method).respond_to?(:strftime))
139
+ obj.send(method).strftime(CalendarDateSelect.date_format_string(use_time))
140
+ elsif obj.respond_to?("#{method}_before_type_cast")
141
+ obj.send("#{method}_before_type_cast")
142
+ elsif obj.respond_to?(method)
143
+ obj.send(method).to_s
144
+ else
145
+ nil
146
+ end
147
+
148
+ tag = ActionView::Helpers::InstanceTag.new(object, method, self, nil, options.delete(:object))
149
+ calendar_date_select_output(
150
+ tag.to_input_field_tag( (calendar_options[:hidden] || calendar_options[:embedded]) ? "hidden" : "text", options),
151
+ calendar_options
152
+ )
153
+ end
154
+
155
+ def calendar_date_select_output(input, calendar_options = {})
156
+ out = input
157
+ if calendar_options[:embedded]
158
+ uniq_id = "cds_placeholder_#{(rand*100000).to_i}"
159
+ # we need to be able to locate the target input element, so lets stick an invisible span tag here we can easily locate
160
+ out << content_tag(:span, nil, :style => "display: none; position: absolute;", :id => uniq_id)
161
+
162
+ out << javascript_tag("new CalendarDateSelect( $('#{uniq_id}').previous(), #{options_for_javascript(calendar_options)} ); ")
163
+ else
164
+ out << " "
165
+
166
+ out << image_tag(CalendarDateSelect.image,
167
+ :onclick => "new CalendarDateSelect( $(this).previous(), #{options_for_javascript(calendar_options)} );",
168
+ :style => 'border:0px; cursor:pointer;')
169
+ end
170
+
171
+ out
172
+ end
173
+
174
+ private
175
+ def format_year_range(year) # nodoc
176
+ return year unless year.respond_to?(:first)
177
+ return "[#{year.first}, #{year.last}]" unless year.first.respond_to?(:strftime)
178
+ return "[#{year.first.year}, #{year.last.year}]"
179
+ end
180
+ end
181
+ end
182
+
183
+
184
+ module ActionView
185
+ module Helpers
186
+ class FormBuilder
187
+ def calendar_date_select(method, options = {})
188
+ @template.calendar_date_select(@object_name, method, options.merge(:object => @object))
189
+ end
190
+ end
191
+ end
192
+ end
@@ -0,0 +1,22 @@
1
+ class CalendarDateSelect
2
+ module IncludesHelper
3
+ def calendar_date_select_includes(*args)
4
+ return "" if @cds_already_included
5
+ @cds_already_included=true
6
+
7
+ options = (Hash === args.last) ? args.pop : {}
8
+ options.assert_valid_keys(:style, :format, :locale)
9
+
10
+ style = options[:style] || args.shift
11
+ locale = options[:locale]
12
+ cds_css_file = style ? "calendar_date_select/#{style}" : "calendar_date_select/default"
13
+
14
+ output = []
15
+ output << javascript_include_tag("calendar_date_select/calendar_date_select")
16
+ output << javascript_include_tag("calendar_date_select/locale/#{locale}") if locale
17
+ output << javascript_include_tag(CalendarDateSelect.javascript_format_include) if CalendarDateSelect.javascript_format_include
18
+ output << stylesheet_link_tag(cds_css_file)
19
+ output * "\n"
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,439 @@
1
+ // CalendarDateSelect version 1.10.0 - a prototype based date picker
2
+ // Questions, comments, bugs? - email the Author - Tim Harper <"timseeharper@gmail.seeom".gsub("see", "c")>
3
+ if (typeof Prototype == 'undefined') alert("CalendarDateSelect Error: Prototype could not be found. Please make sure that your application's layout includes prototype.js (.g. <%= javascript_include_tag :defaults %>) *before* it includes calendar_date_select.js (.g. <%= calendar_date_select_includes %>).");
4
+ if (Prototype.Version < "1.6") alert("Prototype 1.6.0 is required. If using earlier version of prototype, please use calendar_date_select version 1.8.3");
5
+
6
+ Element.addMethods({
7
+ purgeChildren: function(element) { $A(element.childNodes).each(function(e){$(e).remove();}); },
8
+ build: function(element, type, options, style) {
9
+ var newElement = Element.build(type, options, style);
10
+ element.appendChild(newElement);
11
+ return newElement;
12
+ }
13
+ });
14
+
15
+ Element.build = function(type, options, style)
16
+ {
17
+ var e = $(document.createElement(type));
18
+ $H(options).each(function(pair) { eval("e." + pair.key + " = pair.value" ); });
19
+ if (style)
20
+ $H(style).each(function(pair) { eval("e.style." + pair.key + " = pair.value" ); });
21
+ return e;
22
+ };
23
+ nil = null;
24
+
25
+ Date.one_day = 24*60*60*1000;
26
+ Date.weekdays = $w("S M T W T F S");
27
+ Date.first_day_of_week = 0;
28
+ Date.months = $w("January February March April May June July August September October November December" );
29
+ Date.padded2 = function(hour) { var padded2 = parseInt(hour, 10); if (hour < 10) padded2 = "0" + padded2; return padded2; }
30
+ Date.prototype.getPaddedMinutes = function() { return Date.padded2(this.getMinutes()); }
31
+ Date.prototype.getAMPMHour = function() { var hour = this.getHours(); return (hour == 0) ? 12 : (hour > 12 ? hour - 12 : hour ) }
32
+ Date.prototype.getAMPM = function() { return (this.getHours() < 12) ? "AM" : "PM"; }
33
+ Date.prototype.stripTime = function() { return new Date(this.getFullYear(), this.getMonth(), this.getDate());};
34
+ Date.prototype.daysDistance = function(compare_date) { return Math.round((compare_date - this) / Date.one_day); };
35
+ Date.prototype.toFormattedString = function(include_time){
36
+ var hour, str;
37
+ str = Date.months[this.getMonth()] + " " + this.getDate() + ", " + this.getFullYear();
38
+
39
+ if (include_time) { hour = this.getHours(); str += " " + this.getAMPMHour() + ":" + this.getPaddedMinutes() + " " + this.getAMPM() }
40
+ return str;
41
+ }
42
+ Date.parseFormattedString = function(string) { return new Date(string);}
43
+ Math.floor_to_interval = function(n, i) { return Math.floor(n/i) * i;}
44
+ window.f_height = function() { return( [window.innerHeight ? window.innerHeight : null, document.documentElement ? document.documentElement.clientHeight : null, document.body ? document.body.clientHeight : null].select(function(x){return x>0}).first()||0); }
45
+ window.f_scrollTop = function() { return ([window.pageYOffset ? window.pageYOffset : null, document.documentElement ? document.documentElement.scrollTop : null, document.body ? document.body.scrollTop : null].select(function(x){return x>0}).first()||0 ); }
46
+
47
+ _translations = {
48
+ "OK": "OK",
49
+ "Now": "Now",
50
+ "Today": "Today"
51
+ }
52
+ SelectBox = Class.create();
53
+ SelectBox.prototype = {
54
+ initialize: function(parent_element, values, html_options, style_options) {
55
+ this.element = $(parent_element).build("select", html_options, style_options);
56
+ this.populate(values);
57
+ },
58
+ populate: function(values) {
59
+ this.element.purgeChildren();
60
+ var that = this; $A(values).each(function(pair) { if (typeof(pair)!="object") {pair = [pair, pair]}; that.element.build("option", { value: pair[1], innerHTML: pair[0]}) });
61
+ },
62
+ setValue: function(value) {
63
+ var e = this.element;
64
+ var matched = false;
65
+ $R(0, e.options.length - 1 ).each(function(i) { if(e.options[i].value==value.toString()) {e.selectedIndex = i; matched = true;}; } );
66
+ return matched;
67
+ },
68
+ getValue: function() { return $F(this.element)}
69
+ }
70
+ CalendarDateSelect = Class.create();
71
+ CalendarDateSelect.prototype = {
72
+ initialize: function(target_element, options) {
73
+ this.target_element = $(target_element); // make sure it's an element, not a string
74
+ if (!this.target_element) { alert("Target element " + target_element + " not found!"); return false;}
75
+ if (down = this.target_element.down("INPUT")) this.target_element = down;
76
+
77
+ this.target_element.calendar_date_select = this;
78
+ this.last_click_at = 0;
79
+ // initialize the date control
80
+ this.options = $H({
81
+ embedded: false,
82
+ popup: nil,
83
+ time: false,
84
+ buttons: true,
85
+ year_range: 10,
86
+ calendar_div: nil,
87
+ close_on_click: nil,
88
+ minute_interval: 5,
89
+ popup_by: this.target_element,
90
+ month_year: "dropdowns",
91
+ onchange: this.target_element.onchange,
92
+ valid_date_check: nil
93
+ }).merge(options || {});
94
+
95
+ this.selection_made = $F(this.target_element).strip()!=="";
96
+ this.use_time = this.options.get("time");
97
+
98
+ this.callback("before_show")
99
+ this.calendar_div = $(this.options.get("calendar_div"));
100
+
101
+ this.parseDate();
102
+
103
+ // by default, stick it by the target element (if embedded, that's where we'll want it to show up)
104
+ if (this.calendar_div == nil) { this.calendar_div = $( this.options.get("embedded") ? this.target_element.parentNode : document.body ).build('div'); }
105
+ if (!this.options.get("embedded")) this.calendar_div.setStyle( { position:"absolute", visibility: "hidden", left:0, top:0 } )
106
+
107
+ this.calendar_div.addClassName("calendar_date_select");
108
+
109
+ if (this.options.get("embedded")) this.options.set("close_on_click", false);
110
+ // logic for close on click
111
+ if (this.options.get("close_on_click")===nil )
112
+ {
113
+ if (this.options.get("time"))
114
+ this.options.set("close_on_click", false);
115
+ else
116
+ this.options.set("close_on_click", true);
117
+ }
118
+
119
+ // set the click handler to check if a user has clicked away from the document
120
+ if(!this.options.get("embedded")) {
121
+ Event.observe(document, "mousedown", this.closeIfClickedOut_handler = this.closeIfClickedOut.bindAsEventListener(this));
122
+ Event.observe(document, "keypress", this.keyPress_handler = this.keyPress.bindAsEventListener(this));
123
+ }
124
+
125
+ this.init();
126
+ if(!this.options.get("embedded")) { this.positionCalendarDiv() };
127
+ this.callback("after_show")
128
+ },
129
+ positionCalendarDiv: function() {
130
+ var above = false;
131
+ var c_pos = this.calendar_div.cumulativeOffset(), c_left = c_pos[0], c_top = c_pos[1], c_dim = this.calendar_div.getDimensions(), c_height = c_dim.height, c_width = c_dim.width;
132
+ var w_top = window.f_scrollTop(), w_height = window.f_height();
133
+ var e_dim = $(this.options.get("popup_by")).cumulativeOffset(), e_top = e_dim[1], e_left = e_dim[0], e_height = $(this.options.get("popup_by")).getDimensions().height, e_bottom = e_top + e_height;
134
+
135
+ if ( (( e_bottom + c_height ) > (w_top + w_height)) && ( e_bottom - c_height > w_top )) above = true;
136
+ var left_px = e_left.toString() + "px", top_px = (above ? (e_top - c_height ) : ( e_top + e_height )).toString() + "px";
137
+
138
+ this.calendar_div.style.left = left_px; this.calendar_div.style.top = top_px;
139
+
140
+ this.calendar_div.setStyle({visibility:""});
141
+
142
+ // draw an iframe behind the calendar -- ugly hack to make IE 6 happy
143
+ if(navigator.appName=="Microsoft Internet Explorer") this.iframe = $(document.body).build("iframe", {className: "ie6_blocker"}, { left: left_px, top: top_px, height: c_height.toString()+"px", width: c_width.toString()+"px", border: "0px"})
144
+ },
145
+ init: function() {
146
+ var that = this;
147
+ // create the divs
148
+ $w("top header body buttons footer bottom").each(function(name) {
149
+ eval("var " + name + "_div = that." + name + "_div = that.calendar_div.build('div', { className: 'cds_"+name+"' }, { clear: 'left'} ); ");
150
+ });
151
+
152
+ this.initHeaderDiv();
153
+ this.initButtonsDiv();
154
+ this.initCalendarGrid();
155
+ this.updateFooter("&nbsp;");
156
+
157
+ this.refresh();
158
+ this.setUseTime(this.use_time);
159
+ },
160
+ initHeaderDiv: function() {
161
+ var header_div = this.header_div;
162
+ this.close_button = header_div.build("a", { innerHTML: "x", href:"#", onclick:function () { this.close(); return false; }.bindAsEventListener(this), className: "close" });
163
+ this.next_month_button = header_div.build("a", { innerHTML: "&gt;", href:"#", onclick:function () { this.navMonth(this.date.getMonth() + 1 ); return false; }.bindAsEventListener(this), className: "next" });
164
+ this.prev_month_button = header_div.build("a", { innerHTML: "&lt;", href:"#", onclick:function () { this.navMonth(this.date.getMonth() - 1 ); return false; }.bindAsEventListener(this), className: "prev" });
165
+
166
+ if (this.options.get("month_year")=="dropdowns") {
167
+ this.month_select = new SelectBox(header_div, $R(0,11).map(function(m){return [Date.months[m], m]}), {className: "month", onchange: function () { this.navMonth(this.month_select.getValue()) }.bindAsEventListener(this)});
168
+ this.year_select = new SelectBox(header_div, [], {className: "year", onchange: function () { this.navYear(this.year_select.getValue()) }.bindAsEventListener(this)});
169
+ this.populateYearRange();
170
+ } else {
171
+ this.month_year_label = header_div.build("span")
172
+ }
173
+ },
174
+ initCalendarGrid: function() {
175
+ var body_div = this.body_div;
176
+ this.calendar_day_grid = [];
177
+ var days_table = body_div.build("table", { cellPadding: "0px", cellSpacing: "0px", width: "100%" })
178
+ // make the weekdays!
179
+ var weekdays_row = days_table.build("thead").build("tr");
180
+ Date.weekdays.each( function(weekday) {
181
+ weekdays_row.build("th", {innerHTML: weekday});
182
+ });
183
+
184
+ var days_tbody = days_table.build("tbody")
185
+ // Make the days!
186
+ var row_number = 0, weekday;
187
+ for(var cell_index = 0; cell_index<42; cell_index++)
188
+ {
189
+ weekday = (cell_index+Date.first_day_of_week ) % 7;
190
+ if ( cell_index % 7==0 ) days_row = days_tbody.build("tr", {className: 'row_'+row_number++});
191
+ (this.calendar_day_grid[cell_index] = days_row.build("td", {
192
+ calendar_date_select: this,
193
+ onmouseover: function () { this.calendar_date_select.dayHover(this); },
194
+ onmouseout: function () { this.calendar_date_select.dayHoverOut(this) },
195
+ onclick: function() { this.calendar_date_select.updateSelectedDate(this, true); },
196
+ className: (weekday==0) || (weekday==6) ? " weekend" : "" //clear the class
197
+ },
198
+ { cursor: "pointer" }
199
+ )).build("div");
200
+ this.calendar_day_grid[cell_index];
201
+ }
202
+ },
203
+ initButtonsDiv: function()
204
+ {
205
+ var buttons_div = this.buttons_div;
206
+ if (this.options.get("time"))
207
+ {
208
+ var blank_time = $A(this.options.get("time")=="mixed" ? [[" - ", ""]] : []);
209
+ buttons_div.build("span", {innerHTML:"@", className: "at_sign"});
210
+
211
+ var t = new Date();
212
+ this.hour_select = new SelectBox(buttons_div,
213
+ blank_time.concat($R(0,23).map(function(x) {t.setHours(x); return $A([t.getAMPMHour()+ " " + t.getAMPM(),x])} )),
214
+ {
215
+ calendar_date_select: this,
216
+ onchange: function() { this.calendar_date_select.updateSelectedDate( { hour: this.value });},
217
+ className: "hour"
218
+ }
219
+ );
220
+ buttons_div.build("span", {innerHTML:":", className: "seperator"});
221
+ var that = this;
222
+ this.minute_select = new SelectBox(buttons_div,
223
+ blank_time.concat($R(0,59).select(function(x){return (x % that.options.get('minute_interval')==0)}).map(function(x){ return $A([ Date.padded2(x), x]); } ) ),
224
+ {
225
+ calendar_date_select: this,
226
+ onchange: function() { this.calendar_date_select.updateSelectedDate( {minute: this.value }) },
227
+ className: "minute"
228
+ }
229
+ );
230
+
231
+ } else if (! this.options.get("buttons")) buttons_div.remove();
232
+
233
+ if (this.options.get("buttons")) {
234
+ buttons_div.build("span", {innerHTML: "&nbsp;"});
235
+ if (this.options.get("time")=="mixed" || !this.options.get("time")) b = buttons_div.build("a", {
236
+ innerHTML: _translations["Today"],
237
+ href: "#",
238
+ onclick: function() {this.today(false); return false;}.bindAsEventListener(this)
239
+ });
240
+
241
+ if (this.options.get("time")=="mixed") buttons_div.build("span", {innerHTML: " | ", className:"button_seperator"})
242
+
243
+ if (this.options.get("time")) b = buttons_div.build("a", {
244
+ innerHTML: _translations["Now"],
245
+ href: "#",
246
+ onclick: function() {this.today(true); return false}.bindAsEventListener(this)
247
+ });
248
+
249
+ if (!this.options.get("embedded"))
250
+ {
251
+ buttons_div.build("span", {innerHTML: "&nbsp;"});
252
+ buttons_div.build("a", { innerHTML: _translations["OK"], href: "#", onclick: function() {this.close(); return false;}.bindAsEventListener(this) });
253
+ }
254
+ }
255
+ },
256
+ refresh: function ()
257
+ {
258
+ this.refreshMonthYear();
259
+ this.refreshCalendarGrid();
260
+
261
+ this.setSelectedClass();
262
+ this.updateFooter();
263
+ },
264
+ refreshCalendarGrid: function () {
265
+ this.beginning_date = new Date(this.date).stripTime();
266
+ this.beginning_date.setDate(1);
267
+ this.beginning_date.setHours(12); // Prevent daylight savings time boundaries from showing a duplicate day
268
+ var pre_days = this.beginning_date.getDay() // draw some days before the fact
269
+ if (pre_days < 3) pre_days += 7;
270
+ this.beginning_date.setDate(1 - pre_days + Date.first_day_of_week);
271
+
272
+ var iterator = new Date(this.beginning_date);
273
+
274
+ var today = new Date().stripTime();
275
+ var this_month = this.date.getMonth();
276
+ vdc = this.options.get("valid_date_check");
277
+ for (var cell_index = 0;cell_index<42; cell_index++)
278
+ {
279
+ day = iterator.getDate(); month = iterator.getMonth();
280
+ cell = this.calendar_day_grid[cell_index];
281
+ Element.remove(cell.childNodes[0]); div = cell.build("div", {innerHTML:day});
282
+ if (month!=this_month) div.className = "other";
283
+ cell.day = day; cell.month = month; cell.year = iterator.getFullYear();
284
+ if (vdc) { if (vdc(iterator.stripTime())) cell.removeClassName("disabled"); else cell.addClassName("disabled") };
285
+ iterator.setDate( day + 1);
286
+ }
287
+
288
+ if (this.today_cell) this.today_cell.removeClassName("today");
289
+
290
+ if ( $R( 0, 42 ).include(days_until = this.beginning_date.daysDistance(today)) ) {
291
+ this.today_cell = this.calendar_day_grid[days_until];
292
+ this.today_cell.addClassName("today");
293
+ }
294
+ },
295
+ refreshMonthYear: function() {
296
+ var m = this.date.getMonth();
297
+ var y = this.date.getFullYear();
298
+ // set the month
299
+ if (this.options.get("month_year") == "dropdowns")
300
+ {
301
+ this.month_select.setValue(m, false);
302
+
303
+ var e = this.year_select.element;
304
+ if (this.flexibleYearRange() && (!(this.year_select.setValue(y, false)) || e.selectedIndex <= 1 || e.selectedIndex >= e.options.length - 2 )) this.populateYearRange();
305
+
306
+ this.year_select.setValue(y);
307
+
308
+ } else {
309
+ this.month_year_label.update( Date.months[m] + " " + y.toString() );
310
+ }
311
+ },
312
+ populateYearRange: function() {
313
+ this.year_select.populate(this.yearRange().toArray());
314
+ },
315
+ yearRange: function() {
316
+ if (!this.flexibleYearRange())
317
+ return $R(this.options.get("year_range")[0], this.options.get("year_range")[1]);
318
+
319
+ var y = this.date.getFullYear();
320
+ return $R(y - this.options.get("year_range"), y + this.options.get("year_range"));
321
+ },
322
+ flexibleYearRange: function() { return (typeof(this.options.get("year_range")) == "number"); },
323
+ validYear: function(year) { if (this.flexibleYearRange()) { return true;} else { return this.yearRange().include(year);} },
324
+ dayHover: function(element) {
325
+ var hover_date = new Date(this.selected_date);
326
+ hover_date.setYear(element.year); hover_date.setMonth(element.month); hover_date.setDate(element.day);
327
+ this.updateFooter(hover_date.toFormattedString(this.use_time));
328
+ },
329
+ dayHoverOut: function(element) { this.updateFooter(); },
330
+ setSelectedClass: function() {
331
+ if (!this.selection_made) return;
332
+
333
+ // clear selection
334
+ if (this.selected_cell) this.selected_cell.removeClassName("selected");
335
+
336
+ if ($R(0,42).include( days_until = this.beginning_date.stripTime().daysDistance(this.selected_date.stripTime()) )) {
337
+ this.selected_cell = this.calendar_day_grid[days_until];
338
+ this.selected_cell.addClassName("selected");
339
+ }
340
+ },
341
+ reparse: function() { this.parseDate(); this.refresh(); },
342
+ dateString: function() {
343
+ return (this.selection_made) ? this.selected_date.toFormattedString(this.use_time) : "&nbsp;";
344
+ },
345
+ parseDate: function()
346
+ {
347
+ var value = $F(this.target_element).strip()
348
+ this.date = value=="" ? NaN : Date.parseFormattedString(this.options.get("date") || value);
349
+ if (isNaN(this.date)) this.date = new Date();
350
+ if (!this.validYear(this.date.getFullYear())) this.date.setYear( (this.date.getFullYear() < this.yearRange().start) ? this.yearRange().start : this.yearRange().end);
351
+ this.selected_date = new Date(this.date);
352
+ this.use_time = /[0-9]:[0-9]{2}/.exec(value) ? true : false;
353
+ this.date.setDate(1);
354
+ },
355
+ updateFooter:function(text) { if (!text) text = this.dateString(); this.footer_div.purgeChildren(); this.footer_div.build("span", {innerHTML: text }); },
356
+ updateSelectedDate:function(partsOrElement, via_click) {
357
+ var parts = $H(partsOrElement);
358
+ if ((this.target_element.disabled || this.target_element.readOnly) && this.options.get("popup") != "force") return false;
359
+ if (parts.get("day")) {
360
+ var t_selected_date = this.selected_date, vdc = this.options.get("valid_date_check");
361
+ for (var x = 0; x<=3; x++) t_selected_date.setDate(parts.get("day"));
362
+ t_selected_date.setYear(parts.get("year"));
363
+ t_selected_date.setMonth(parts.get("month"));
364
+
365
+ if (vdc && ! vdc(t_selected_date.stripTime())) { return false; }
366
+ this.selected_date = t_selected_date;
367
+ this.selection_made = true;
368
+ }
369
+
370
+ if (!isNaN(parts.get("hour"))) this.selected_date.setHours(parts.get("hour"));
371
+ if (!isNaN(parts.get("minute"))) this.selected_date.setMinutes( Math.floor_to_interval(parts.get("minute"), this.options.get("minute_interval")) );
372
+ if (parts.get("hour") === "" || parts.get("minute") === "")
373
+ this.setUseTime(false);
374
+ else if (!isNaN(parts.get("hour")) || !isNaN(parts.get("minute")))
375
+ this.setUseTime(true);
376
+
377
+ this.updateFooter();
378
+ this.setSelectedClass();
379
+
380
+ if (this.selection_made) this.updateValue();
381
+ if (this.options.get("close_on_click")) { this.close(); }
382
+ if (via_click && !this.options.get("embedded")) {
383
+ if ((new Date() - this.last_click_at) < 333) this.close();
384
+ this.last_click_at = new Date();
385
+ }
386
+ },
387
+ navMonth: function(month) { (target_date = new Date(this.date)).setMonth(month); return (this.navTo(target_date)); },
388
+ navYear: function(year) { (target_date = new Date(this.date)).setYear(year); return (this.navTo(target_date)); },
389
+ navTo: function(date) {
390
+ if (!this.validYear(date.getFullYear())) return false;
391
+ this.date = date;
392
+ this.date.setDate(1);
393
+ this.refresh();
394
+ this.callback("after_navigate", this.date);
395
+ return true;
396
+ },
397
+ setUseTime: function(turn_on) {
398
+ this.use_time = this.options.get("time") && (this.options.get("time")=="mixed" ? turn_on : true) // force use_time to true if time==true && time!="mixed"
399
+ if (this.use_time && this.selected_date) { // only set hour/minute if a date is already selected
400
+ var minute = Math.floor_to_interval(this.selected_date.getMinutes(), this.options.get("minute_interval"));
401
+ var hour = this.selected_date.getHours();
402
+
403
+ this.hour_select.setValue(hour);
404
+ this.minute_select.setValue(minute)
405
+ } else if (this.options.get("time")=="mixed") {
406
+ this.hour_select.setValue(""); this.minute_select.setValue("");
407
+ }
408
+ },
409
+ updateValue: function() {
410
+ var last_value = this.target_element.value;
411
+ this.target_element.value = this.dateString();
412
+ if (last_value!=this.target_element.value) this.callback("onchange");
413
+ },
414
+ today: function(now) {
415
+ var d = new Date(); this.date = new Date();
416
+ var o = $H({ day: d.getDate(), month: d.getMonth(), year: d.getFullYear(), hour: d.getHours(), minute: d.getMinutes()});
417
+ if ( ! now ) o = o.merge({hour: "", minute:""});
418
+ this.updateSelectedDate(o, true);
419
+ this.refresh();
420
+ },
421
+ close: function() {
422
+ if (this.closed) return false;
423
+ this.callback("before_close");
424
+ this.target_element.calendar_date_select = nil;
425
+ Event.stopObserving(document, "mousedown", this.closeIfClickedOut_handler);
426
+ Event.stopObserving(document, "keypress", this.keyPress_handler);
427
+ this.calendar_div.remove(); this.closed = true;
428
+ if (this.iframe) this.iframe.remove();
429
+ if (this.target_element.type!="hidden") this.target_element.focus();
430
+ this.callback("after_close");
431
+ },
432
+ closeIfClickedOut: function(e) {
433
+ if (! $(Event.element(e)).descendantOf(this.calendar_div) ) this.close();
434
+ },
435
+ keyPress: function(e) {
436
+ if (e.keyCode==Event.KEY_ESC) this.close();
437
+ },
438
+ callback: function(name, param) { if (this.options.get(name)) { this.options.get(name).bind(this.target_element)(param); } }
439
+ }