gluttonberg-core 2.6.4 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (613) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +29 -3
  3. data/Rakefile +32 -15
  4. data/app/assets/images/chosen-sprite-2x.png +0 -0
  5. data/app/assets/images/chosen-sprite.png +0 -0
  6. data/app/assets/images/{library/gb_sort_by_asc.png → gb_sort_by_asc.png} +0 -0
  7. data/app/assets/images/{library/gb_sort_by_desc.png → gb_sort_by_desc.png} +0 -0
  8. data/app/assets/javascripts/chosen-jquery-min.js +2 -0
  9. data/app/assets/javascripts/gb_360player.js +676 -0
  10. data/app/assets/javascripts/gb_application.js +708 -463
  11. data/app/assets/javascripts/gb_html5.js +9 -0
  12. data/app/assets/javascripts/gb_jeditable.js +356 -356
  13. data/app/assets/javascripts/gb_jquery-nestable.js +490 -0
  14. data/app/assets/javascripts/gb_utils.js +1808 -0
  15. data/app/assets/javascripts/gluttonberg.js +26 -0
  16. data/app/assets/javascripts/jcrop/css/gb_jquery-Jcrop.css +163 -31
  17. data/app/assets/javascripts/jcrop/js/jquery-Jcrop-min.js +19 -243
  18. data/app/assets/javascripts/jquery-1-10-1.js +6 -0
  19. data/app/assets/javascripts/jquery-ui-1-10-3.custom-min.js +6 -0
  20. data/app/assets/javascripts/jquery-validate.js +652 -718
  21. data/app/assets/javascripts/rails.js +372 -106
  22. data/app/assets/javascripts/redactormin.js +7348 -0
  23. data/app/assets/stylesheets/chosen.css +430 -0
  24. data/app/assets/stylesheets/gb_360player.css +2 -10
  25. data/app/assets/stylesheets/gb_admin-override.sass +466 -22
  26. data/app/assets/stylesheets/gb_bootstrap.css +7 -1
  27. data/app/assets/stylesheets/gluttonberg.css +17 -0
  28. data/app/assets/stylesheets/redactor.css +864 -0
  29. data/app/assets/stylesheets/user-styles.sass +0 -3
  30. data/app/controllers/gluttonberg/admin/asset_library/assets_ajax_controller.rb +65 -0
  31. data/app/controllers/gluttonberg/admin/asset_library/assets_bulk_controller.rb +47 -0
  32. data/app/controllers/gluttonberg/admin/asset_library/assets_controller.rb +43 -266
  33. data/app/controllers/gluttonberg/admin/asset_library/base_controller.rb +29 -0
  34. data/app/controllers/gluttonberg/admin/asset_library/collections_controller.rb +11 -37
  35. data/app/controllers/gluttonberg/admin/base_controller.rb +117 -178
  36. data/app/controllers/gluttonberg/admin/content/auto_save_controller.rb +63 -0
  37. data/app/controllers/gluttonberg/admin/content/flag_controller.rb +6 -6
  38. data/app/controllers/gluttonberg/admin/content/galleries_controller.rb +29 -37
  39. data/app/controllers/gluttonberg/admin/content/page_localizations_controller.rb +82 -49
  40. data/app/controllers/gluttonberg/admin/content/pages_controller.rb +59 -32
  41. data/app/controllers/gluttonberg/admin/main_controller.rb +77 -7
  42. data/app/controllers/gluttonberg/admin/membership/base_controller.rb +2 -1
  43. data/app/controllers/gluttonberg/admin/membership/groups_controller.rb +27 -33
  44. data/app/controllers/gluttonberg/admin/membership/main_controller.rb +3 -2
  45. data/app/controllers/gluttonberg/admin/membership/members_controller.rb +37 -42
  46. data/app/controllers/gluttonberg/admin/password_resets_controller.rb +16 -28
  47. data/app/controllers/gluttonberg/admin/settings/configurations_controller.rb +101 -0
  48. data/app/controllers/gluttonberg/admin/settings/embeds_controller.rb +79 -0
  49. data/app/controllers/gluttonberg/admin/settings/locales_controller.rb +22 -28
  50. data/app/controllers/gluttonberg/admin/settings/stylesheets_controller.rb +31 -36
  51. data/app/controllers/gluttonberg/admin/settings/users_controller.rb +45 -40
  52. data/app/controllers/gluttonberg/base_controller.rb +95 -0
  53. data/app/controllers/gluttonberg/public/base_controller.rb +104 -157
  54. data/app/controllers/gluttonberg/public/flag_controller.rb +2 -7
  55. data/app/controllers/gluttonberg/public/gallery_controller.rb +1 -0
  56. data/app/controllers/gluttonberg/public/member_password_resets_controller.rb +5 -17
  57. data/app/controllers/gluttonberg/public/members_controller.rb +5 -15
  58. data/app/controllers/gluttonberg/public/pages_controller.rb +25 -14
  59. data/app/controllers/gluttonberg/public/public_assets_controller.rb +4 -2
  60. data/app/helpers/gluttonberg/admin.rb +86 -368
  61. data/app/helpers/gluttonberg/admin/assets.rb +84 -0
  62. data/app/helpers/gluttonberg/admin/form.rb +159 -0
  63. data/app/helpers/gluttonberg/admin/messages.rb +32 -0
  64. data/app/helpers/gluttonberg/admin/versioning.rb +196 -0
  65. data/app/helpers/gluttonberg/application_helper.rb +34 -7
  66. data/app/helpers/gluttonberg/asset_library.rb +29 -254
  67. data/app/helpers/gluttonberg/content_helpers.rb +17 -69
  68. data/app/helpers/gluttonberg/deprecated.rb +24 -0
  69. data/app/helpers/gluttonberg/public.rb +51 -244
  70. data/app/helpers/gluttonberg/public/assets.rb +31 -0
  71. data/app/helpers/gluttonberg/public/cms_stylesheets.rb +35 -0
  72. data/app/helpers/gluttonberg/public/html_truncate.rb +74 -0
  73. data/app/helpers/gluttonberg/public/meta_tags.rb +27 -0
  74. data/app/helpers/gluttonberg/public/nav_tree.rb +99 -0
  75. data/app/helpers/gluttonberg/public/page_info.rb +168 -0
  76. data/app/mailer/gluttonberg/base_notifier.rb +25 -0
  77. data/app/mailer/member_notifier.rb +8 -20
  78. data/app/mailer/notifier.rb +14 -39
  79. data/app/models/ability.rb +48 -34
  80. data/app/models/flag.rb +7 -7
  81. data/app/models/gluttonberg/asset.rb +115 -166
  82. data/app/models/gluttonberg/asset_bulk_import.rb +70 -0
  83. data/app/models/gluttonberg/asset_category.rb +75 -29
  84. data/app/models/gluttonberg/asset_collection.rb +65 -12
  85. data/app/models/gluttonberg/asset_mime_type.rb +5 -0
  86. data/app/models/gluttonberg/asset_thumbnail.rb +6 -1
  87. data/app/models/gluttonberg/asset_type.rb +49 -38
  88. data/app/models/gluttonberg/audio_asset_attribute.rb +7 -3
  89. data/app/models/gluttonberg/authorization.rb +10 -0
  90. data/app/models/gluttonberg/auto_save.rb +32 -0
  91. data/app/models/gluttonberg/collapsed_page.rb +13 -0
  92. data/app/models/gluttonberg/embed.rb +13 -0
  93. data/app/models/gluttonberg/feed.rb +14 -5
  94. data/app/models/gluttonberg/gallery.rb +35 -9
  95. data/app/models/gluttonberg/gallery_image.rb +9 -2
  96. data/app/models/gluttonberg/group.rb +18 -2
  97. data/app/models/gluttonberg/html_content.rb +5 -1
  98. data/app/models/gluttonberg/image_content.rb +5 -1
  99. data/app/models/gluttonberg/locale.rb +28 -9
  100. data/app/models/gluttonberg/member.rb +48 -197
  101. data/app/models/gluttonberg/page.rb +78 -288
  102. data/app/models/gluttonberg/page_localization.rb +63 -66
  103. data/app/models/gluttonberg/plain_text_content.rb +6 -0
  104. data/app/models/gluttonberg/repeater.rb +30 -0
  105. data/app/models/gluttonberg/search.rb +96 -72
  106. data/app/models/gluttonberg/select_content.rb +12 -0
  107. data/app/models/gluttonberg/setting.rb +79 -29
  108. data/app/models/gluttonberg/sitemap.rb +1 -0
  109. data/app/models/gluttonberg/stylesheet.rb +12 -6
  110. data/app/models/gluttonberg/textarea_content.rb +14 -0
  111. data/app/models/gluttonberg/version.rb +9 -0
  112. data/app/models/user.rb +137 -13
  113. data/app/observers/gluttonberg/locale_observer.rb +33 -22
  114. data/app/observers/gluttonberg/page_localization_observer.rb +22 -12
  115. data/app/observers/gluttonberg/page_observer.rb +50 -35
  116. data/app/views/{gluttonberg/public/exceptions → exceptions}/access_denied.html.haml +0 -0
  117. data/app/views/{gluttonberg/public/exceptions → exceptions}/not_found.html.haml +0 -0
  118. data/app/views/gluttonberg/admin/asset_library/assets/_browser_root.html.haml +17 -12
  119. data/app/views/gluttonberg/admin/asset_library/assets/_form.html.haml +5 -7
  120. data/app/views/gluttonberg/admin/asset_library/assets/browser.html.haml +5 -5
  121. data/app/views/gluttonberg/admin/asset_library/assets/show.html.haml +13 -7
  122. data/app/views/gluttonberg/admin/asset_library/assets/show.json.rabl +3 -0
  123. data/app/views/gluttonberg/admin/asset_library/{assets → assets_ajax}/browser_collection.json.haml +0 -0
  124. data/app/views/gluttonberg/admin/asset_library/{assets → assets_bulk}/add_assets_in_bulk.html.haml +6 -20
  125. data/app/views/gluttonberg/admin/asset_library/{assets → assets_bulk}/create_assets_in_bulk.html.haml +0 -0
  126. data/app/views/gluttonberg/admin/asset_library/collections/_form.html.haml +8 -5
  127. data/app/views/gluttonberg/admin/asset_library/shared/_asset_browser.html.haml +34 -0
  128. data/app/views/gluttonberg/admin/asset_library/shared/_asset_panels.html.haml +15 -11
  129. data/app/views/gluttonberg/admin/content/editors/_html_content.html.haml +2 -2
  130. data/app/views/gluttonberg/admin/content/editors/_select_content.html.haml +7 -0
  131. data/app/views/gluttonberg/admin/content/editors/_textarea_content.html.haml +6 -0
  132. data/app/views/gluttonberg/admin/content/flag/index.html.haml +48 -39
  133. data/app/views/gluttonberg/admin/content/galleries/_form.html.haml +46 -9
  134. data/app/views/gluttonberg/admin/content/galleries/_image_repeater.html.haml +30 -0
  135. data/app/views/gluttonberg/admin/content/galleries/edit.html.haml +1 -12
  136. data/app/views/gluttonberg/admin/content/galleries/index.html.haml +18 -9
  137. data/app/views/gluttonberg/admin/content/galleries/new.html.haml +1 -1
  138. data/app/views/gluttonberg/admin/content/main/_sidebar.html.haml +28 -16
  139. data/app/views/gluttonberg/admin/content/page_localizations/_form.html.haml +11 -20
  140. data/app/views/gluttonberg/admin/content/page_localizations/edit.html.haml +7 -0
  141. data/app/views/gluttonberg/admin/content/pages/_form.html.haml +11 -4
  142. data/app/views/gluttonberg/admin/content/pages/_page_settings.html.haml +4 -7
  143. data/app/views/gluttonberg/admin/content/pages/_row.html.haml +38 -30
  144. data/app/views/gluttonberg/admin/content/pages/index.html.haml +23 -15
  145. data/app/views/gluttonberg/admin/content/pages/pages_list_for_tinymce.html.haml +14 -3
  146. data/app/views/gluttonberg/admin/content/pages/show.html.haml +1 -1
  147. data/app/views/gluttonberg/admin/main/index.html.haml +13 -12
  148. data/app/views/gluttonberg/admin/main/waiting_for_approval.html.haml +33 -0
  149. data/app/views/gluttonberg/admin/membership/groups/index.html.haml +5 -5
  150. data/app/views/gluttonberg/admin/membership/members/_form.html.haml +3 -1
  151. data/app/views/gluttonberg/admin/membership/members/edit.html.haml +1 -0
  152. data/app/views/gluttonberg/admin/membership/members/index.html.haml +1 -1
  153. data/app/views/gluttonberg/admin/password_resets/edit.html.haml +36 -16
  154. data/app/views/gluttonberg/admin/password_resets/new.html.haml +19 -11
  155. data/app/views/gluttonberg/admin/settings/configurations/_form.html.haml +28 -0
  156. data/app/views/gluttonberg/admin/settings/configurations/_settings_table.html.haml +42 -0
  157. data/app/views/gluttonberg/admin/settings/{generic_settings → configurations}/_value_tag.html.haml +0 -0
  158. data/app/views/gluttonberg/admin/settings/configurations/edit.html.haml +4 -0
  159. data/app/views/gluttonberg/admin/settings/configurations/index.html.haml +31 -0
  160. data/app/views/gluttonberg/admin/settings/{generic_settings → configurations}/new.html.haml +2 -2
  161. data/app/views/gluttonberg/admin/settings/embeds/_form.html.haml +19 -0
  162. data/app/views/gluttonberg/admin/settings/embeds/edit.html.haml +12 -0
  163. data/app/views/gluttonberg/admin/settings/embeds/index.html.haml +36 -0
  164. data/app/views/gluttonberg/admin/settings/embeds/list_for_redactor.html.haml +29 -0
  165. data/app/views/gluttonberg/admin/settings/embeds/new.html.haml +12 -0
  166. data/app/views/gluttonberg/admin/settings/locales/edit.html.haml +9 -1
  167. data/app/views/gluttonberg/admin/settings/locales/index.html.haml +2 -1
  168. data/app/views/gluttonberg/admin/settings/locales/new.html.haml +10 -1
  169. data/app/views/gluttonberg/admin/settings/main/_sidebar.html.haml +9 -7
  170. data/app/views/gluttonberg/admin/settings/stylesheets/_form.html.haml +11 -9
  171. data/app/views/gluttonberg/admin/settings/stylesheets/edit.html.haml +11 -2
  172. data/app/views/gluttonberg/admin/settings/stylesheets/index.html.haml +45 -36
  173. data/app/views/gluttonberg/admin/settings/stylesheets/new.html.haml +11 -2
  174. data/app/views/gluttonberg/admin/settings/users/_form.html.haml +29 -18
  175. data/app/views/gluttonberg/admin/settings/users/index.html.haml +1 -1
  176. data/app/views/gluttonberg/admin/shared/_asset_panel.html.haml +19 -4
  177. data/app/views/gluttonberg/admin/shared/_auto_save_version.html.haml +12 -0
  178. data/app/views/gluttonberg/admin/shared/_datetime_field.html.haml +19 -0
  179. data/app/views/gluttonberg/admin/shared/_previous_version_warning.html.haml +5 -0
  180. data/app/views/gluttonberg/admin/shared/_version_alerts.html.haml +34 -0
  181. data/app/views/gluttonberg/admin/shared/_version_dashboard_notifications.html.haml +11 -0
  182. data/app/views/gluttonberg/admin/shared/_version_listing.html.haml +23 -0
  183. data/app/views/gluttonberg/admin/shared/delete.html.haml +21 -48
  184. data/app/views/gluttonberg/admin/shared/generic.html.haml +20 -19
  185. data/app/views/gluttonberg/admin/user_sessions/new.html.haml +14 -9
  186. data/app/views/gluttonberg/public/member_password_resets/edit.html.haml +2 -0
  187. data/app/views/gluttonberg/public/member_password_resets/new.html.haml +3 -0
  188. data/app/views/gluttonberg/public/members/_form.html.haml +3 -0
  189. data/app/views/gluttonberg/public/members/edit.html.haml +7 -9
  190. data/app/views/gluttonberg/public/members/show.html.haml +1 -3
  191. data/app/views/gluttonberg/public/pages/restrict_site_access.html.haml +3 -4
  192. data/app/views/gluttonberg/public/shared/_gallery_images_lis.html.haml +9 -0
  193. data/app/views/layouts/_flash_messages.html.haml +5 -3
  194. data/app/views/layouts/bare.html.haml +8 -17
  195. data/app/views/layouts/gluttonberg.html.haml +37 -44
  196. data/app/views/notifier/version_declined.html.haml +21 -0
  197. data/config/locales/en_au.yml +1 -1
  198. data/config/locales/en_gb.yml +2 -1
  199. data/config/routes.rb +70 -85
  200. data/db/migrate/20130801050257_create_repeater.rb +14 -0
  201. data/lib/audio_job.rb +11 -9
  202. data/lib/engine.rb +115 -72
  203. data/lib/generators/gluttonberg/resource/resource_generator.rb +51 -41
  204. data/lib/generators/gluttonberg/resource/templates/admin_controller.rb +16 -11
  205. data/lib/generators/gluttonberg/resource/templates/backend_view_edit.html.haml +7 -2
  206. data/lib/generators/gluttonberg/resource/templates/backend_view_form.html.haml +3 -14
  207. data/lib/generators/gluttonberg/resource/templates/backend_view_import.html.haml +10 -7
  208. data/lib/generators/gluttonberg/resource/templates/backend_view_index.html.haml +6 -5
  209. data/lib/generators/gluttonberg/resource/templates/backend_view_show.html.haml +2 -2
  210. data/lib/generators/gluttonberg/resource/templates/migration.rb +12 -1
  211. data/lib/generators/gluttonberg/resource/templates/model.rb +18 -1
  212. data/lib/generators/gluttonberg/resource/templates/public_view_index.html.haml +27 -10
  213. data/lib/generators/gluttonberg/resource/templates/public_view_show.html.haml +10 -4
  214. data/lib/gluttonberg.rb +68 -37
  215. data/lib/gluttonberg/can_flag.rb +64 -76
  216. data/lib/gluttonberg/components.rb +47 -24
  217. data/lib/gluttonberg/content.rb +15 -0
  218. data/lib/gluttonberg/content/block.rb +99 -85
  219. data/lib/gluttonberg/content/block_localization.rb +11 -8
  220. data/lib/gluttonberg/content/clean_html.rb +12 -15
  221. data/lib/gluttonberg/content/default_template_file.rb +44 -0
  222. data/lib/gluttonberg/content/despamilator/filter/naughty_words.rb +4 -2
  223. data/lib/gluttonberg/content/home_page_info.rb +39 -0
  224. data/lib/gluttonberg/content/import_export_csv.rb +243 -130
  225. data/lib/gluttonberg/content/localization.rb +137 -148
  226. data/lib/gluttonberg/content/page_children.rb +36 -0
  227. data/lib/gluttonberg/content/page_components.rb +23 -0
  228. data/lib/gluttonberg/content/page_description_info.rb +55 -0
  229. data/lib/gluttonberg/content/page_duplicate.rb +68 -0
  230. data/lib/gluttonberg/content/page_finder.rb +63 -0
  231. data/lib/gluttonberg/content/page_localization_slug.rb +89 -0
  232. data/lib/gluttonberg/content/page_repairer.rb +117 -0
  233. data/lib/gluttonberg/content/publishable.rb +77 -71
  234. data/lib/gluttonberg/content/slug_management.rb +74 -26
  235. data/lib/gluttonberg/content/validations.rb +58 -0
  236. data/lib/gluttonberg/content/versioning.rb +40 -22
  237. data/lib/gluttonberg/drag_tree.rb +0 -1
  238. data/lib/gluttonberg/drag_tree/action_controller.rb +49 -37
  239. data/lib/gluttonberg/drag_tree/action_view.rb +0 -6
  240. data/lib/gluttonberg/drag_tree/active_record.rb +49 -49
  241. data/lib/gluttonberg/extensions.rb +1 -0
  242. data/lib/gluttonberg/extensions/string.rb +20 -0
  243. data/lib/gluttonberg/gb_file.rb +30 -0
  244. data/lib/gluttonberg/helpers/form_builder.rb +91 -38
  245. data/lib/gluttonberg/library.rb +9 -90
  246. data/lib/gluttonberg/library/attachment_mixin.rb +88 -98
  247. data/lib/gluttonberg/library/config/image_sizes.rb +22 -19
  248. data/lib/gluttonberg/library/default_asset_types.rb +104 -0
  249. data/lib/gluttonberg/library/processor/audio.rb +32 -16
  250. data/lib/gluttonberg/library/processor/image.rb +78 -69
  251. data/lib/gluttonberg/library/quick_magick/image.rb +72 -319
  252. data/lib/gluttonberg/library/quick_magick/image/draw.rb +133 -0
  253. data/lib/gluttonberg/library/quick_magick/image/operators_and_settings.rb +78 -0
  254. data/lib/gluttonberg/library/quick_magick/image/serialization.rb +79 -0
  255. data/lib/gluttonberg/library/quick_magick/image_list.rb +0 -1
  256. data/lib/gluttonberg/library/storage/filesystem.rb +45 -46
  257. data/lib/gluttonberg/library/storage/s3.rb +123 -119
  258. data/lib/gluttonberg/membership.rb +9 -0
  259. data/lib/gluttonberg/membership/export.rb +82 -0
  260. data/lib/gluttonberg/membership/import.rb +179 -0
  261. data/lib/gluttonberg/middleware/honeypot.rb +1 -2
  262. data/lib/gluttonberg/middleware/locales.rb +69 -18
  263. data/lib/gluttonberg/middleware/rewriter.rb +57 -16
  264. data/lib/gluttonberg/mixin_manager.rb +19 -0
  265. data/lib/gluttonberg/page_description.rb +82 -112
  266. data/lib/gluttonberg/random_string_generator.rb +31 -0
  267. data/lib/gluttonberg/record_history.rb +5 -7
  268. data/lib/gluttonberg/tasks/asset.rake +19 -8
  269. data/lib/gluttonberg/tasks/gluttonberg.rake +167 -13
  270. data/lib/gluttonberg/templates.rb +1 -3
  271. data/lib/gluttonberg/version.rb +1 -1
  272. data/lib/photo_job.rb +16 -0
  273. data/spec/controllers/auto_save_controller_spec.rb +57 -0
  274. data/spec/controllers/record_history_spec.rb +75 -0
  275. data/spec/dummy/README.rdoc +261 -0
  276. data/spec/dummy/Rakefile +7 -0
  277. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  278. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  279. data/spec/dummy/app/controllers/admin/staff_profiles_controller.rb +56 -0
  280. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  281. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  282. data/spec/dummy/app/models/staff_profile.rb +20 -0
  283. data/spec/dummy/app/models/vendor_mixin.rb +14 -0
  284. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  285. data/spec/dummy/config.ru +4 -0
  286. data/spec/dummy/config/application.rb +18 -0
  287. data/spec/dummy/config/boot.rb +10 -0
  288. data/spec/dummy/config/database.yml +8 -0
  289. data/spec/dummy/config/environment.rb +5 -0
  290. data/spec/dummy/config/environments/development.rb +37 -0
  291. data/spec/dummy/config/environments/production.rb +67 -0
  292. data/spec/dummy/config/environments/test.rb +37 -0
  293. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  294. data/spec/dummy/config/initializers/gluttonberg_advance_settings.rb +73 -0
  295. data/spec/dummy/config/initializers/gluttonberg_basic_settings.rb +65 -0
  296. data/spec/dummy/config/initializers/gluttonberg_menu_settings.rb +1 -0
  297. data/spec/dummy/config/initializers/inflections.rb +15 -0
  298. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  299. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  300. data/spec/dummy/config/initializers/session_store.rb +8 -0
  301. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  302. data/spec/dummy/config/locales/en.yml +5 -0
  303. data/{lib/generators/gluttonberg/installer/templates → spec/dummy/config}/page_descriptions.rb +103 -65
  304. data/spec/dummy/config/routes.rb +10 -0
  305. data/spec/dummy/db/20130625060411_create_staff_profile.rb +35 -0
  306. data/spec/dummy/db/schema.rb +474 -0
  307. data/spec/dummy/public/404.html +26 -0
  308. data/spec/dummy/public/422.html +26 -0
  309. data/spec/dummy/public/500.html +25 -0
  310. data/spec/dummy/public/favicon.ico +0 -0
  311. data/spec/dummy/script/rails +6 -0
  312. data/spec/dummy/tmp/cache/041/891/setting_library_number_of_recent_assets +0 -0
  313. data/spec/dummy/tmp/cache/08E/741/setting_comment_number_of_emails_allowed +0 -0
  314. data/spec/dummy/tmp/cache/580/D10/setting_title +0 -0
  315. data/spec/dummy/tmp/cache/62E/160/setting_fb_icon +0 -0
  316. data/spec/dummy/tmp/cache/6D6/FB0/setting_keywords +0 -0
  317. data/spec/dummy/tmp/cache/6D8/B60/setting_s3_key_id +0 -0
  318. data/spec/dummy/tmp/cache/6E1/A40/setting_s3_bucket +0 -0
  319. data/spec/dummy/tmp/cache/779/DF0/setting_from_email +0 -0
  320. data/spec/dummy/tmp/cache/7C5/450/setting_title_site1 +0 -0
  321. data/spec/dummy/tmp/cache/7C6/460/setting_title_site2 +0 -0
  322. data/spec/dummy/tmp/cache/802/000/setting_description +0 -0
  323. data/spec/dummy/tmp/cache/836/DD0/setting_backend_logo +0 -0
  324. data/spec/dummy/tmp/cache/862/FA0/setting_audio_assets +1 -0
  325. data/spec/dummy/tmp/cache/867/4E0/setting_video_assets +0 -0
  326. data/spec/dummy/tmp/cache/867/710/setting_enable_WYSIWYG +0 -0
  327. data/spec/dummy/tmp/cache/873/9E0/setting_fb_icon_site1 +0 -0
  328. data/spec/dummy/tmp/cache/874/9F0/setting_fb_icon_site2 +0 -0
  329. data/spec/dummy/tmp/cache/87D/A10/setting_s3_access_key +0 -0
  330. data/spec/dummy/tmp/cache/8AC/280/setting_s3_server_url +0 -0
  331. data/spec/dummy/tmp/cache/91B/730/setting_keywords_site1 +0 -0
  332. data/spec/dummy/tmp/cache/91C/740/setting_keywords_site2 +0 -0
  333. data/spec/dummy/tmp/cache/933/980/setting_auto_save_time +0 -0
  334. data/spec/dummy/tmp/cache/9BE/290/setting_from_email_site1 +0 -0
  335. data/spec/dummy/tmp/cache/9BF/2A0/setting_from_email_site2 +0 -0
  336. data/spec/dummy/tmp/cache/A02/5E0/setting_google_analytics +0 -0
  337. data/spec/dummy/tmp/cache/A47/800/setting_description_site1 +0 -0
  338. data/spec/dummy/tmp/cache/A48/810/setting_description_site2 +0 -0
  339. data/spec/dummy/tmp/cache/A69/B60/setting_comment_blacklist +0 -0
  340. data/spec/dummy/tmp/cache/B5C/D40/setting_number_of_revisions +0 -0
  341. data/spec/dummy/tmp/cache/BB3/350/setting_restrict_site_access +0 -0
  342. data/spec/dummy/tmp/cache/BB7/620/setting_comment_notification +0 -0
  343. data/spec/dummy/tmp/cache/BFB/140/setting_comment_email_as_spam +0 -0
  344. data/spec/dummy/tmp/cache/C47/DE0/setting_google_analytics_site1 +0 -0
  345. data/spec/dummy/tmp/cache/C48/DF0/setting_google_analytics_site2 +0 -0
  346. data/spec/dummy/tmp/cache/D3E/E20/setting_number_of_per_page_items +0 -0
  347. data/spec/dummy/tmp/cache/DF8/DB0/setting_restrict_site_access_site1 +0 -0
  348. data/spec/dummy/tmp/cache/DF9/DC0/setting_restrict_site_access_site2 +0 -0
  349. data/spec/dummy/tmp/cache/DFC/200/setting_comment_notification_site1 +0 -0
  350. data/spec/dummy/tmp/cache/DFD/210/setting_comment_notification_site2 +0 -0
  351. data/spec/dummy/tmp/cache/FD9/200/setting_comment_number_of_urls_allowed +0 -0
  352. data/spec/fixtures/assets/assets_import.zip +0 -0
  353. data/spec/fixtures/assets/audio.mp3 +0 -0
  354. data/spec/fixtures/assets/c3-add-interactive.mov +0 -0
  355. data/spec/fixtures/assets/gb_banner.jpg +0 -0
  356. data/spec/fixtures/assets/gb_logo.png +0 -0
  357. data/spec/fixtures/assets/high_res_photo.jpg +0 -0
  358. data/spec/fixtures/assets/untitled +0 -0
  359. data/spec/fixtures/members.csv +5 -0
  360. data/spec/fixtures/staff_profiles.csv +4 -0
  361. data/spec/helpers/public/assets_spec.rb +73 -0
  362. data/spec/helpers/public/content_helpers_spec.rb +71 -0
  363. data/spec/helpers/public/html_truncate_spec.rb +37 -0
  364. data/spec/helpers/public/meta_tags_spec.rb +29 -0
  365. data/spec/helpers/public/page_info_spec.rb +233 -0
  366. data/spec/helpers/public_spec.rb +114 -0
  367. data/spec/lib/content/import_export_csv_spec.rb +177 -0
  368. data/spec/lib/content/localization_spec.rb +107 -0
  369. data/spec/lib/content/page_finder_spec.rb +71 -0
  370. data/spec/lib/content/page_repairer_spec.rb +151 -0
  371. data/spec/lib/content/publishable_spec.rb +54 -0
  372. data/spec/lib/content/validations_spec.rb +88 -0
  373. data/spec/lib/drag_tree/action_controller_spec.rb +137 -0
  374. data/spec/lib/drag_tree/active_record_spec.rb +86 -0
  375. data/spec/lib/library/s3_rspec.rb +78 -0
  376. data/spec/lib/membership/export_spec.rb +89 -0
  377. data/spec/lib/membership/import_spec.rb +68 -0
  378. data/spec/lib/middleware/locales_spec.rb +192 -0
  379. data/spec/lib/middleware/rewriter_spec.rb +186 -0
  380. data/spec/lib/page_description_spec.rb +68 -0
  381. data/spec/mailers/member_notifier_spec.rb +140 -0
  382. data/spec/mailers/notifier_spec.rb +86 -0
  383. data/spec/models/asset_bulk_import_spec.rb +43 -0
  384. data/spec/models/asset_category_spec.rb +77 -0
  385. data/spec/models/asset_collection_spec.rb +72 -0
  386. data/spec/models/asset_spec.rb +278 -0
  387. data/spec/models/asset_type_spec.rb +109 -0
  388. data/spec/models/member_spec.rb +128 -0
  389. data/spec/models/page_localization_spec.rb +81 -0
  390. data/spec/models/page_spec.rb +221 -0
  391. data/spec/models/setting_spec.rb +49 -0
  392. data/spec/models/user_spec.rb +385 -0
  393. data/spec/observers/locale_observer_spec.rb +79 -0
  394. data/spec/observers/page_localization_observer_spec.rb +87 -0
  395. data/spec/observers/page_observer_spec.rb +130 -0
  396. data/spec/spec_helper.rb +90 -0
  397. metadata +508 -331
  398. data/app/assets/images/gb_360-button-pause-light.gif +0 -0
  399. data/app/assets/images/gb_360-button-pause-light.png +0 -0
  400. data/app/assets/images/gb_360-button-pause.gif +0 -0
  401. data/app/assets/images/gb_360-button-pause.png +0 -0
  402. data/app/assets/images/gb_360-button-play-light.gif +0 -0
  403. data/app/assets/images/gb_360-button-play-light.png +0 -0
  404. data/app/assets/images/gb_360-button-play.gif +0 -0
  405. data/app/assets/images/gb_360-button-play.png +0 -0
  406. data/app/assets/images/gb_360-button-vis-pause-light.gif +0 -0
  407. data/app/assets/images/gb_360-button-vis-pause-light.png +0 -0
  408. data/app/assets/images/gb_360-button-vis-pause.gif +0 -0
  409. data/app/assets/images/gb_360-button-vis-pause.png +0 -0
  410. data/app/assets/images/gb_360-button-vis-play-light.gif +0 -0
  411. data/app/assets/images/gb_360-button-vis-play-light.png +0 -0
  412. data/app/assets/images/gb_360-button-vis-play.gif +0 -0
  413. data/app/assets/images/gb_360-button-vis-play.png +0 -0
  414. data/app/assets/images/gb_button_bkg_grey.gif +0 -0
  415. data/app/assets/images/gb_icon_content_2.png +0 -0
  416. data/app/assets/images/gb_icon_dash.png +0 -0
  417. data/app/assets/images/gb_icon_library_2.png +0 -0
  418. data/app/assets/images/gb_page_content_fillin.gif +0 -0
  419. data/app/assets/images/gb_spinner_for_dialouge.gif +0 -0
  420. data/app/assets/images/gb_sub_nav_back_bkg.gif +0 -0
  421. data/app/assets/images/gb_subnav_bkg.gif +0 -0
  422. data/app/assets/images/gb_table_head_bkg.gif +0 -0
  423. data/app/assets/images/gb_wrapper_bkg.png +0 -0
  424. data/app/assets/images/gb_wysiwyg.png +0 -0
  425. data/app/assets/images/help/gb_help.jpg +0 -0
  426. data/app/assets/images/icons/gb_collapsed.png +0 -0
  427. data/app/assets/images/icons/gb_expanded.png +0 -0
  428. data/app/assets/images/library/gb_back.gif +0 -0
  429. data/app/assets/images/library/gb_dialog_overlay.png +0 -0
  430. data/app/assets/images/library/gb_inactive_tab.jpg +0 -0
  431. data/app/assets/images/library/gb_search_icon.gif +0 -0
  432. data/app/assets/images/library/gb_wysiwyg_pic.png +0 -0
  433. data/app/assets/javascripts/gb_ajaxfileupload.js +0 -205
  434. data/app/assets/javascripts/gb_berniecode-animator.js +0 -674
  435. data/app/assets/javascripts/gb_bootstrap-datepicker.js +0 -501
  436. data/app/assets/javascripts/gb_expander.js +0 -81
  437. data/app/assets/javascripts/gb_jquery-dragTree.js +0 -525
  438. data/app/assets/javascripts/gb_jquery-tagarea.js +0 -404
  439. data/app/assets/javascripts/gb_login.js +0 -33
  440. data/app/assets/javascripts/gb_tags.js +0 -177
  441. data/app/assets/javascripts/jquery-1-7-1.js +0 -9267
  442. data/app/assets/javascripts/jquery-dimensions-min.js +0 -12
  443. data/app/assets/javascripts/jquery-ui-1-8-23-custom-min.js +0 -85
  444. data/app/assets/javascripts/tiny_mce/jquery.tinymce.js +0 -1
  445. data/app/assets/javascripts/tiny_mce/langs/en.js +0 -223
  446. data/app/assets/javascripts/tiny_mce/plugins/advhr/css/advhr.css +0 -5
  447. data/app/assets/javascripts/tiny_mce/plugins/advhr/editor_plugin.js +0 -1
  448. data/app/assets/javascripts/tiny_mce/plugins/advhr/js/rule.js +0 -43
  449. data/app/assets/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js +0 -7
  450. data/app/assets/javascripts/tiny_mce/plugins/advhr/rule.htm +0 -58
  451. data/app/assets/javascripts/tiny_mce/plugins/advlink/css/advlink.css +0 -8
  452. data/app/assets/javascripts/tiny_mce/plugins/advlink/editor_plugin.js +0 -61
  453. data/app/assets/javascripts/tiny_mce/plugins/advlink/js/advlink.js +0 -564
  454. data/app/assets/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js +0 -54
  455. data/app/assets/javascripts/tiny_mce/plugins/advlink/link.htm +0 -355
  456. data/app/assets/javascripts/tiny_mce/plugins/advlist/editor_plugin.js +0 -1
  457. data/app/assets/javascripts/tiny_mce/plugins/autolink/editor_plugin.js +0 -1
  458. data/app/assets/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +0 -1
  459. data/app/assets/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +0 -109
  460. data/app/assets/javascripts/tiny_mce/plugins/gb_assets/editor_plugin.js +0 -47
  461. data/app/assets/javascripts/tiny_mce/plugins/gb_assets/editor_plugin_src.js +0 -43
  462. data/app/assets/javascripts/tiny_mce/plugins/gb_assets/emotions.htm +0 -41
  463. data/app/assets/javascripts/tiny_mce/plugins/gb_assets/js/emotions.js +0 -22
  464. data/app/assets/javascripts/tiny_mce/plugins/gb_assets/langs/en_dlg.js +0 -20
  465. data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +0 -1
  466. data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
  467. data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
  468. data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
  469. data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
  470. data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
  471. data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
  472. data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
  473. data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +0 -90
  474. data/app/assets/javascripts/tiny_mce/plugins/inlinepopups/template.htm +0 -387
  475. data/app/assets/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js +0 -1
  476. data/app/assets/javascripts/tiny_mce/plugins/lists/editor_plugin.js +0 -1
  477. data/app/assets/javascripts/tiny_mce/plugins/paste/editor_plugin.js +0 -1
  478. data/app/assets/javascripts/tiny_mce/plugins/paste/js/pastetext.js +0 -36
  479. data/app/assets/javascripts/tiny_mce/plugins/paste/js/pasteword.js +0 -51
  480. data/app/assets/javascripts/tiny_mce/plugins/paste/langs/en_dlg.js +0 -5
  481. data/app/assets/javascripts/tiny_mce/plugins/paste/pastetext.htm +0 -27
  482. data/app/assets/javascripts/tiny_mce/plugins/paste/pasteword.htm +0 -21
  483. data/app/assets/javascripts/tiny_mce/plugins/preview/editor_plugin.js +0 -1
  484. data/app/assets/javascripts/tiny_mce/plugins/preview/jscripts/embed.js +0 -73
  485. data/app/assets/javascripts/tiny_mce/plugins/preview/preview.html +0 -18
  486. data/app/assets/javascripts/tiny_mce/plugins/style/css/props.css +0 -13
  487. data/app/assets/javascripts/tiny_mce/plugins/style/editor_plugin.js +0 -1
  488. data/app/assets/javascripts/tiny_mce/plugins/style/js/props.js +0 -635
  489. data/app/assets/javascripts/tiny_mce/plugins/style/langs/en_dlg.js +0 -70
  490. data/app/assets/javascripts/tiny_mce/plugins/style/props.htm +0 -838
  491. data/app/assets/javascripts/tiny_mce/plugins/table/cell.htm +0 -180
  492. data/app/assets/javascripts/tiny_mce/plugins/table/css/cell.css +0 -17
  493. data/app/assets/javascripts/tiny_mce/plugins/table/css/row.css +0 -25
  494. data/app/assets/javascripts/tiny_mce/plugins/table/css/table.css +0 -13
  495. data/app/assets/javascripts/tiny_mce/plugins/table/editor_plugin.js +0 -1
  496. data/app/assets/javascripts/tiny_mce/plugins/table/js/cell.js +0 -319
  497. data/app/assets/javascripts/tiny_mce/plugins/table/js/merge_cells.js +0 -27
  498. data/app/assets/javascripts/tiny_mce/plugins/table/js/row.js +0 -237
  499. data/app/assets/javascripts/tiny_mce/plugins/table/js/table.js +0 -450
  500. data/app/assets/javascripts/tiny_mce/plugins/table/langs/en_dlg.js +0 -75
  501. data/app/assets/javascripts/tiny_mce/plugins/table/merge_cells.htm +0 -32
  502. data/app/assets/javascripts/tiny_mce/plugins/table/row.htm +0 -158
  503. data/app/assets/javascripts/tiny_mce/plugins/table/table.htm +0 -188
  504. data/app/assets/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js +0 -1
  505. data/app/assets/javascripts/tiny_mce/themes/advanced/anchor.htm +0 -26
  506. data/app/assets/javascripts/tiny_mce/themes/advanced/editor_template.js +0 -1
  507. data/app/assets/javascripts/tiny_mce/themes/advanced/editor_template_src.js +0 -1358
  508. data/app/assets/javascripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
  509. data/app/assets/javascripts/tiny_mce/themes/advanced/img/trans.gif +0 -0
  510. data/app/assets/javascripts/tiny_mce/themes/advanced/js/anchor.js +0 -42
  511. data/app/assets/javascripts/tiny_mce/themes/advanced/js/link.js +0 -153
  512. data/app/assets/javascripts/tiny_mce/themes/advanced/js/source_editor.js +0 -56
  513. data/app/assets/javascripts/tiny_mce/themes/advanced/langs/en.js +0 -68
  514. data/app/assets/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +0 -54
  515. data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/content.css +0 -47
  516. data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +0 -117
  517. data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
  518. data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
  519. data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
  520. data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
  521. data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
  522. data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
  523. data/app/assets/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +0 -227
  524. data/app/assets/javascripts/tiny_mce/themes/advanced/source_editor.htm +0 -25
  525. data/app/assets/javascripts/tiny_mce/tiny_mce.js +0 -1
  526. data/app/assets/javascripts/tiny_mce/tiny_mce_popup.js +0 -5
  527. data/app/assets/javascripts/tiny_mce/utils/editable_selects.js +0 -70
  528. data/app/assets/javascripts/tiny_mce/utils/form_utils.js +0 -210
  529. data/app/assets/javascripts/tiny_mce/utils/mctabs.js +0 -162
  530. data/app/assets/javascripts/tiny_mce/utils/validate.js +0 -252
  531. data/app/controllers/gluttonberg/admin/content/articles_controller.rb +0 -139
  532. data/app/controllers/gluttonberg/admin/content/blogs_controller.rb +0 -101
  533. data/app/controllers/gluttonberg/admin/content/comments_controller.rb +0 -130
  534. data/app/controllers/gluttonberg/admin/content/main_controller.rb +0 -13
  535. data/app/controllers/gluttonberg/admin/help_controller.rb +0 -15
  536. data/app/controllers/gluttonberg/admin/settings/generic_settings_controller.rb +0 -90
  537. data/app/controllers/gluttonberg/admin/settings/main_controller.rb +0 -11
  538. data/app/controllers/gluttonberg/public/articles_controller.rb +0 -79
  539. data/app/controllers/gluttonberg/public/blogs_controller.rb +0 -44
  540. data/app/controllers/gluttonberg/public/comments_controller.rb +0 -46
  541. data/app/models/gluttonberg/article.rb +0 -73
  542. data/app/models/gluttonberg/article_localization.rb +0 -21
  543. data/app/models/gluttonberg/blog.rb +0 -19
  544. data/app/models/gluttonberg/comment.rb +0 -142
  545. data/app/models/gluttonberg/comment_subscription.rb +0 -28
  546. data/app/models/gluttonberg/help.rb +0 -48
  547. data/app/views/gluttonberg/admin/content/articles/_form.html.haml +0 -115
  548. data/app/views/gluttonberg/admin/content/articles/edit.html.haml +0 -11
  549. data/app/views/gluttonberg/admin/content/articles/index.html.haml +0 -71
  550. data/app/views/gluttonberg/admin/content/articles/new.html.haml +0 -11
  551. data/app/views/gluttonberg/admin/content/blogs/_form.html.haml +0 -56
  552. data/app/views/gluttonberg/admin/content/blogs/edit.html.haml +0 -3
  553. data/app/views/gluttonberg/admin/content/blogs/index.html.haml +0 -35
  554. data/app/views/gluttonberg/admin/content/blogs/new.html.haml +0 -10
  555. data/app/views/gluttonberg/admin/content/comments/index.html.haml +0 -66
  556. data/app/views/gluttonberg/admin/content/galleries/_images_list.html.haml +0 -21
  557. data/app/views/gluttonberg/admin/content/galleries/add_image.html.haml +0 -1
  558. data/app/views/gluttonberg/admin/content/main/index.html.haml +0 -20
  559. data/app/views/gluttonberg/admin/content/pages/edit_home.html.haml +0 -11
  560. data/app/views/gluttonberg/admin/exceptions/internal_server_error.html.haml +0 -11
  561. data/app/views/gluttonberg/admin/exceptions/not_acceptable.html.haml +0 -9
  562. data/app/views/gluttonberg/admin/membership/main/index.html.haml +0 -11
  563. data/app/views/gluttonberg/admin/settings/generic_settings/_form.html.haml +0 -26
  564. data/app/views/gluttonberg/admin/settings/generic_settings/edit.html.haml +0 -4
  565. data/app/views/gluttonberg/admin/settings/generic_settings/index.html.haml +0 -58
  566. data/app/views/gluttonberg/admin/settings/main/index.html.haml +0 -18
  567. data/app/views/gluttonberg/public/articles/index.rss.builder +0 -21
  568. data/app/views/gluttonberg/public/blogs/show.rss.builder +0 -21
  569. data/app/views/gluttonberg/public/exceptions/internal_server_error.html.haml +0 -11
  570. data/app/views/gluttonberg/public/exceptions/not_acceptable.html.haml +0 -9
  571. data/app/views/help/gluttonberg/admin/AssetLibrary/assets/add_assets_in_bulk.html.haml +0 -41
  572. data/app/views/help/gluttonberg/admin/AssetLibrary/assets/edit.html.haml +0 -61
  573. data/app/views/help/gluttonberg/admin/AssetLibrary/assets/index.html.haml +0 -16
  574. data/app/views/help/gluttonberg/admin/AssetLibrary/assets/new.html.haml +0 -57
  575. data/app/views/help/gluttonberg/admin/AssetLibrary/collections/edit.html.haml +0 -15
  576. data/app/views/help/gluttonberg/admin/AssetLibrary/collections/index.html.haml +0 -41
  577. data/app/views/help/gluttonberg/admin/AssetLibrary/collections/new.html.haml +0 -15
  578. data/app/views/help/gluttonberg/admin/AssetLibrary/main/index.html.haml +0 -34
  579. data/app/views/help/gluttonberg/admin/content/page_localizations/edit.html.haml +0 -89
  580. data/app/views/help/gluttonberg/admin/content/pages/_page_description_help.html.haml +0 -14
  581. data/app/views/help/gluttonberg/admin/content/pages/edit.html.haml +0 -62
  582. data/app/views/help/gluttonberg/admin/content/pages/index.html.haml +0 -111
  583. data/app/views/help/gluttonberg/admin/content/pages/new.html.haml +0 -61
  584. data/app/views/help/gluttonberg/admin/settings/dialects/edit.html.haml +0 -47
  585. data/app/views/help/gluttonberg/admin/settings/dialects/index.html.haml +0 -50
  586. data/app/views/help/gluttonberg/admin/settings/dialects/new.html.haml +0 -47
  587. data/app/views/help/gluttonberg/admin/settings/generic_settings/index.html.haml +0 -74
  588. data/app/views/help/gluttonberg/admin/settings/locales/edit.html.haml +0 -71
  589. data/app/views/help/gluttonberg/admin/settings/locales/index.html.haml +0 -57
  590. data/app/views/help/gluttonberg/admin/settings/locales/new.html.haml +0 -71
  591. data/app/views/help/gluttonberg/admin/settings/users/edit.html.haml +0 -63
  592. data/app/views/help/gluttonberg/admin/settings/users/index.html.haml +0 -60
  593. data/app/views/help/gluttonberg/admin/settings/users/new.html.haml +0 -69
  594. data/app/views/notifier/comment_notification.html.haml +0 -17
  595. data/app/views/notifier/comment_notification_for_admin.html.haml +0 -19
  596. data/db/migrate/20121106025800_add_artist_and_link_to_assets.rb +0 -6
  597. data/lib/acts_as_versioned.rb +0 -496
  598. data/lib/generators/gluttonberg/blog/blog_generator.rb +0 -46
  599. data/lib/generators/gluttonberg/blog/templates/articles_index.html.haml +0 -18
  600. data/lib/generators/gluttonberg/blog/templates/articles_show.html.haml +0 -63
  601. data/lib/generators/gluttonberg/blog/templates/articles_tag.html.haml +0 -24
  602. data/lib/generators/gluttonberg/blog/templates/blog_migration.rb +0 -90
  603. data/lib/generators/gluttonberg/blog/templates/blogs_index.html.haml +0 -15
  604. data/lib/generators/gluttonberg/blog/templates/blogs_show.html.haml +0 -25
  605. data/lib/generators/gluttonberg/installer/USAGE +0 -1
  606. data/lib/generators/gluttonberg/installer/installer_generator.rb +0 -106
  607. data/lib/generators/gluttonberg/installer/templates/delayed_job_script +0 -5
  608. data/lib/generators/gluttonberg/installer/templates/gluttonberg_migration.rb +0 -368
  609. data/lib/generators/gluttonberg/installer/templates/public.html.haml +0 -24
  610. data/lib/generators/gluttonberg/installer/templates/sitemap.rb +0 -70
  611. data/lib/gluttonberg/authorizable.rb +0 -51
  612. data/lib/gluttonberg/helpers.rb +0 -20
  613. data/lib/rails/railties/tasks.rake +0 -3
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1bda6d87fe9aa8d18574525f7d523a96281c689d
4
+ data.tar.gz: 837726ee9995b0831521825e39a81c1d6422fd57
5
+ SHA512:
6
+ metadata.gz: 0bda85c2335077b139473d0a7d50f08c3dddea6db55779a4dc3fc4c783aaff65bcc68b2bec293ecbcb9478f73adf494bf4c4a51f30a965e5232d16306756315b
7
+ data.tar.gz: 028d2ab0c30bbbe025c85e99f273b61d501ba62ba5aecd74bb455b8b2fb31909402207385116f3d96f5306e65617cacc19e94c5780aff29ffd01ebedc6e62fa5
data/README.md CHANGED
@@ -1,4 +1,30 @@
1
- Gluttonberg Core
2
- ================
1
+ # Gluttonberg Core
3
2
 
4
- The Gluttonberg goal has always been to create a Content Management System that's great for users, content manager and developers. The focus of Gluttonberg 2.5 has been two-fold: a refined management user interface to make maintaining your website even easier and a change in the architecture of the system to support our new functionality modules: Events, TV, Mobile and soon eCommerce.
3
+ [![Gem Version](https://badge.fury.io/rb/gluttonberg-core.png)](http://badge.fury.io/rb/gluttonberg-core)
4
+ [![Build Status](https://travis-ci.org/Gluttonberg/core.png?branch=master)](https://travis-ci.org/Gluttonberg/core)
5
+ [![Dependency Status](https://gemnasium.com/Gluttonberg/core.png)](https://gemnasium.com/Gluttonberg/core)
6
+ [![Code Climate](https://codeclimate.com/github/Gluttonberg/core.png)](https://codeclimate.com/github/Gluttonberg/core)
7
+
8
+ ## About
9
+
10
+ **Gluttonberg** is an Open Source CMS developed by the team at ***Freerange Future***. As designers and developers, we love the flexibility of Ruby, but got tired of taking care of authentication, asset mangement, page management (and so on...) with every install. We created **Gluttonberg** to take care of that boring stuff so we could start having fun sooner.
11
+
12
+ ## Setup
13
+
14
+ Setting up **Gluttonberg** is easy.
15
+ The following setups will get you up and running.
16
+
17
+ 1. Create a new **Rails** app.
18
+ `rails new gluttonberg_app --skip-bundle --database=postgresql`
19
+ 2. Add **Gluttonberg** to the *Gemfile* and then bundle install.
20
+ `gem 'gluttonberg-core', :git => 'git://github.com/Gluttonberg/core.git', :require => 'gluttonberg'`
21
+ `bundle install`
22
+ 3. Double check the username and password in the *database.yml* and then create the database.
23
+ `bundle exec rake db:create`
24
+ 4. Run the **Gluttonberg** installer rake task, the task will move all required files into place, migrate the database and then ask you for admin user details. `bundle exec rake gluttonberg:install`
25
+ 5. Start the server. `foreman start`
26
+ 6. Login to the [admin page](http://localhost:5000/admin) and start building. `http://localhost:5000/admin`
27
+
28
+ ## Help
29
+
30
+ If you need help using **Gluttonberg** or are looking for tips, please read the [HELP.md](HELP.md) file.
data/Rakefile CHANGED
@@ -1,21 +1,38 @@
1
- require 'rake/testtask'
1
+ #encoding: utf-8
2
2
 
3
- Rake::TestTask.new do |test|
4
- test.pattern = 'test/**/*_test.rb'
5
- test.libs << 'test'
3
+ # setup bundler
4
+ begin
5
+ require 'bundler/setup'
6
+ rescue LoadError
7
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
8
  end
7
9
 
10
+ Bundler::GemHelper.install_tasks
11
+
12
+ #setup rdoc
8
13
 
9
14
  begin
10
- require "jeweler"
11
- Jeweler::Tasks.new do |gem|
12
- gem.name = "gluttonberg"
13
- gem.summary = "Gluttonberg – An Open Source Content Management System being developed by Freerange Future"
14
- gem.email = "office@freerangefuture.com"
15
- gem.authors = ["Nick Crowther","Abdul Rauf", "Luke Sutton", "Yuri Tomanek"]
16
- gem.files = Dir["{lib}/**/*", "{app}/**/*", "{public}/**/*", "{config}/**/*"]
17
- end
18
- Jeweler::GemcutterTasks.new
19
- rescue
20
- puts "Jeweler or dependency not available."
15
+ require 'rdoc/task'
16
+ rescue LoadError
17
+ require 'rdoc/rdoc'
18
+ require 'rake/rdoctask'
19
+ RDoc::Task = Rake::RDocTask
20
+ end
21
+
22
+ RDoc::Task.new(:rdoc) do |rdoc|
23
+ rdoc.rdoc_dir = 'rdoc'
24
+ rdoc.title = 'Gluttonberg-core'
25
+ rdoc.options << '--line-numbers'
26
+ rdoc.rdoc_files.include('README.rdoc')
27
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
28
  end
29
+
30
+ # setup dummy app and rspec
31
+
32
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
33
+ load 'rails/tasks/engine.rake'
34
+ require 'rspec/core/rake_task'
35
+ RSpec::Core::RakeTask.new(:spec)
36
+
37
+ # RSpec as default
38
+ task :default => :spec
Binary file
@@ -0,0 +1,2 @@
1
+ /* Chosen v1.0.0 | (c) 2011-2013 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
+ !function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),children:0,disabled:a.disabled}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&amp;"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(c.text));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=""!==a.style.cssText?' style="'+a.style+'"':"",'<li class="'+b.join(" ")+'"'+c+' data-option-array-index="'+a.array_index+'">'+a.search_text+"</li>"):"":""},AbstractChosen.prototype.result_add_group=function(a){return a.search_match||a.group_match?a.active_options>0?'<li class="group-result">'+a.search_text+"</li>":"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.result_single_selected=null,this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m;for(this.no_results_clear(),e=0,g=this.get_search_text(),a=g.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),d=this.search_contains?"":"^",c=new RegExp(d+a,"i"),j=new RegExp(a,"i"),m=this.results_data,k=0,l=m.length;l>k;k++)b=m[k],b.search_match=!1,f=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(f=this.results_data[b.group_array_index],0===f.active_options&&f.search_match&&(e+=1),f.active_options+=1),(!b.group||this.group_search)&&(b.search_text=b.group?b.label:b.html,b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(e+=1),b.search_match?(g.length&&(h=b.search_text.search(j),i=b.search_text.substr(0,h+g.length)+"</em>"+b.search_text.substr(h+g.length),b.search_text=i.substr(0,h)+"<em>"+i.substr(h)),null!=f&&(f.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>e&&g.length?(this.update_results_content(""),this.no_results(g)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),a=jQuery,a.fn.extend({chosen:function(b){return AbstractChosen.browser_is_supported()?this.each(function(){var c,d;c=a(this),d=c.data("chosen"),"destroy"===b&&d?d.destroy():d||c.data("chosen",new Chosen(this,b))}):this}}),Chosen=function(c){function Chosen(){return b=Chosen.__super__.constructor.apply(this,arguments)}return d(Chosen,c),Chosen.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},Chosen.prototype.set_up_html=function(){var b,c;return b=["chosen-container"],b.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chosen-rtl"),c={"class":b.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=a("<div />",c),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior(),this.form_field_jq.trigger("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.form_field_jq.bind("chosen:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("chosen:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("chosen:open.chosen",function(b){a.container_mousedown(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},Chosen.prototype.destroy=function(){return a(document).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},Chosen.prototype.container_mousedown=function(b){return this.is_disabled||(b&&"mousedown"===b.type&&!this.results_showing&&b.preventDefault(),null!=b&&a(b.target).hasClass("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chosen-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(document).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b,c,d;return b=-(null!=(c=a.originalEvent)?c.wheelDelta:void 0)||(null!=(d=a.originialEvent)?d.detail:void 0),null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClass("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return a(document).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},Chosen.prototype.test_active_click=function(b){return this.container.is(a(b.target).closest(".chosen-container"))?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(f>c)return this.search_results.scrollTop(c)}},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results())},Chosen.prototype.update_results_content=function(a){return this.search_results.html(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var b=this;return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=a("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",function(a){return b.is_multiple?b.container_mousedown(a):b.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},Chosen.prototype.search_results_mouseup=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length?(this.result_highlight=c,this.result_select(b),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c?this.result_do_highlight(c):void 0},Chosen.prototype.search_results_mouseout=function(b){return a(b.target).hasClass("active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(b){var c,d,e=this;return c=a("<li />",{"class":"search-choice"}).html("<span>"+b.html+"</span>"),b.disabled?c.addClass("search-choice-disabled"):(d=a("<a />",{"class":"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},Chosen.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),b.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a(b.target))},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a[0].getAttribute("data-option-array-index"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.form_field.options[0].selected=!0,this.selected_option_count=null,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},Chosen.prototype.result_select=function(a){var b,c,d;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClass("active-result"):(this.result_single_selected&&(this.result_single_selected.removeClass("result-selected"),d=this.result_single_selected[0].getAttribute("data-option-array-index"),this.results_data[d].selected=!1),this.result_single_selected=b),b.addClass("result-selected"),c=this.results_data[b[0].getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(c.text),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[c.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").text(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return this.search_field.val()===this.default_text?"":a("<div/>").text(a.trim(this.search_field.val())).html()},Chosen.prototype.winnow_results_set_highlight=function(){var a,b;return b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c)},Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){for(d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],i=0,j=g.length;j>i;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return b=a("<div />",{style:f}),b.text(this.search_field.val()),a("body").append(b),h=b.width()+25,b.remove(),c=this.container.outerWidth(),h>c-10&&(h=c-10),this.search_field.css({width:h+"px"})}},Chosen}(AbstractChosen)}.call(this);
@@ -1,3 +1,679 @@
1
+ /** @license
2
+ Animator.js 1.1.9
3
+
4
+ This library is released under the BSD license:
5
+
6
+ Copyright (c) 2006, Bernard Sumption. All rights reserved.
7
+
8
+ Redistribution and use in source and binary forms, with or without
9
+ modification, are permitted provided that the following conditions are met:
10
+
11
+ Redistributions of source code must retain the above copyright notice, this
12
+ list of conditions and the following disclaimer. Redistributions in binary
13
+ form must reproduce the above copyright notice, this list of conditions and
14
+ the following disclaimer in the documentation and/or other materials
15
+ provided with the distribution. Neither the name BernieCode nor
16
+ the names of its contributors may be used to endorse or promote products
17
+ derived from this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
23
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
29
+ DAMAGE.
30
+
31
+ */
32
+
33
+ // http://www.berniecode.com/writing/animator.html
34
+
35
+ // Applies a sequence of numbers between 0 and 1 to a number of subjects
36
+ // construct - see setOptions for parameters
37
+ function Animator(options) {
38
+ this.setOptions(options);
39
+ var _this = this;
40
+ this.timerDelegate = function(){_this.onTimerEvent()};
41
+ this.subjects = [];
42
+ this.subjectScopes = [];
43
+ this.target = 0;
44
+ this.state = 0;
45
+ this.lastTime = null;
46
+ };
47
+ Animator.prototype = {
48
+ // apply defaults
49
+ setOptions: function(options) {
50
+ this.options = Animator.applyDefaults({
51
+ interval: 20, // time between animation frames
52
+ duration: 400, // length of animation
53
+ onComplete: function(){},
54
+ onStep: function(){},
55
+ transition: Animator.tx.easeInOut
56
+ }, options);
57
+ },
58
+ // animate from the current state to provided value
59
+ seekTo: function(to) {
60
+ this.seekFromTo(this.state, to);
61
+ },
62
+ // animate from the current state to provided value
63
+ seekFromTo: function(from, to) {
64
+ this.target = Math.max(0, Math.min(1, to));
65
+ this.state = Math.max(0, Math.min(1, from));
66
+ this.lastTime = new Date().getTime();
67
+ if (!this.intervalId) {
68
+ this.intervalId = window.setInterval(this.timerDelegate, this.options.interval);
69
+ }
70
+ },
71
+ // animate from the current state to provided value
72
+ jumpTo: function(to) {
73
+ this.target = this.state = Math.max(0, Math.min(1, to));
74
+ this.propagate();
75
+ },
76
+ // seek to the opposite of the current target
77
+ toggle: function() {
78
+ this.seekTo(1 - this.target);
79
+ },
80
+ // add a function or an object with a method setState(state) that will be called with a number
81
+ // between 0 and 1 on each frame of the animation
82
+ addSubject: function(subject,scope) {
83
+ this.subjects[this.subjects.length] = subject;
84
+ this.subjectScopes[this.subjectScopes.length] = scope;
85
+ return this;
86
+ },
87
+ // remove all subjects
88
+ clearSubjects: function() {
89
+ this.subjects = [];
90
+ this.subjectScopes = [];
91
+ },
92
+ // forward the current state to the animation subjects
93
+ propagate: function() {
94
+ var value = this.options.transition(this.state);
95
+ for (var i=0; i<this.subjects.length; i++) {
96
+ if (this.subjects[i].setState) {
97
+ this.subjects[i].setState(value);
98
+ } else {
99
+ this.subjects[i].apply(this.subjectScopes[i],[value]);
100
+ }
101
+ }
102
+ },
103
+ // called once per frame to update the current state
104
+ onTimerEvent: function() {
105
+ var now = new Date().getTime();
106
+ var timePassed = now - this.lastTime;
107
+ this.lastTime = now;
108
+ var movement = (timePassed / this.options.duration) * (this.state < this.target ? 1 : -1);
109
+ if (Math.abs(movement) >= Math.abs(this.state - this.target)) {
110
+ this.state = this.target;
111
+ } else {
112
+ this.state += movement;
113
+ }
114
+
115
+ try {
116
+ this.propagate();
117
+ } finally {
118
+ this.options.onStep.call(this);
119
+ if (this.target == this.state) {
120
+ window.clearInterval(this.intervalId);
121
+ this.intervalId = null;
122
+ this.options.onComplete.call(this);
123
+ }
124
+ }
125
+ },
126
+ // shortcuts
127
+ play: function() {this.seekFromTo(0, 1)},
128
+ reverse: function() {this.seekFromTo(1, 0)},
129
+ // return a string describing this Animator, for debugging
130
+ inspect: function() {
131
+ var str = "#<Animator:\n";
132
+ for (var i=0; i<this.subjects.length; i++) {
133
+ str += this.subjects[i].inspect();
134
+ }
135
+ str += ">";
136
+ return str;
137
+ }
138
+ }
139
+ // merge the properties of two objects
140
+ Animator.applyDefaults = function(defaults, prefs) {
141
+ prefs = prefs || {};
142
+ var prop, result = {};
143
+ for (prop in defaults) result[prop] = prefs[prop] !== undefined ? prefs[prop] : defaults[prop];
144
+ return result;
145
+ }
146
+ // make an array from any object
147
+ Animator.makeArray = function(o) {
148
+ if (o == null) return [];
149
+ if (!o.length) return [o];
150
+ var result = [];
151
+ for (var i=0; i<o.length; i++) result[i] = o[i];
152
+ return result;
153
+ }
154
+ // convert a dash-delimited-property to a camelCaseProperty (c/o Prototype, thanks Sam!)
155
+ Animator.camelize = function(string) {
156
+ var oStringList = string.split('-');
157
+ if (oStringList.length == 1) return oStringList[0];
158
+
159
+ var camelizedString = string.indexOf('-') == 0
160
+ ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
161
+ : oStringList[0];
162
+
163
+ for (var i = 1, len = oStringList.length; i < len; i++) {
164
+ var s = oStringList[i];
165
+ camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
166
+ }
167
+ return camelizedString;
168
+ }
169
+ // syntactic sugar for creating CSSStyleSubjects
170
+ Animator.apply = function(el, style, options) {
171
+ if (style instanceof Array) {
172
+ return new Animator(options).addSubject(new CSSStyleSubject(el, style[0], style[1]));
173
+ }
174
+ return new Animator(options).addSubject(new CSSStyleSubject(el, style));
175
+ }
176
+ // make a transition function that gradually accelerates. pass a=1 for smooth
177
+ // gravitational acceleration, higher values for an exaggerated effect
178
+ Animator.makeEaseIn = function(a) {
179
+ return function(state) {
180
+ return Math.pow(state, a*2);
181
+ }
182
+ }
183
+ // as makeEaseIn but for deceleration
184
+ Animator.makeEaseOut = function(a) {
185
+ return function(state) {
186
+ return 1 - Math.pow(1 - state, a*2);
187
+ }
188
+ }
189
+ // make a transition function that, like an object with momentum being attracted to a point,
190
+ // goes past the target then returns
191
+ Animator.makeElastic = function(bounces) {
192
+ return function(state) {
193
+ state = Animator.tx.easeInOut(state);
194
+ return ((1-Math.cos(state * Math.PI * bounces)) * (1 - state)) + state;
195
+ }
196
+ }
197
+ // make an Attack Decay Sustain Release envelope that starts and finishes on the same level
198
+ //
199
+ Animator.makeADSR = function(attackEnd, decayEnd, sustainEnd, sustainLevel) {
200
+ if (sustainLevel == null) sustainLevel = 0.5;
201
+ return function(state) {
202
+ if (state < attackEnd) {
203
+ return state / attackEnd;
204
+ }
205
+ if (state < decayEnd) {
206
+ return 1 - ((state - attackEnd) / (decayEnd - attackEnd) * (1 - sustainLevel));
207
+ }
208
+ if (state < sustainEnd) {
209
+ return sustainLevel;
210
+ }
211
+ return sustainLevel * (1 - ((state - sustainEnd) / (1 - sustainEnd)));
212
+ }
213
+ }
214
+ // make a transition function that, like a ball falling to floor, reaches the target and/
215
+ // bounces back again
216
+ Animator.makeBounce = function(bounces) {
217
+ var fn = Animator.makeElastic(bounces);
218
+ return function(state) {
219
+ state = fn(state);
220
+ return state <= 1 ? state : 2-state;
221
+ }
222
+ }
223
+
224
+ // pre-made transition functions to use with the 'transition' option
225
+ Animator.tx = {
226
+ easeInOut: function(pos){
227
+ return ((-Math.cos(pos*Math.PI)/2) + 0.5);
228
+ },
229
+ linear: function(x) {
230
+ return x;
231
+ },
232
+ easeIn: Animator.makeEaseIn(1.5),
233
+ easeOut: Animator.makeEaseOut(1.5),
234
+ strongEaseIn: Animator.makeEaseIn(2.5),
235
+ strongEaseOut: Animator.makeEaseOut(2.5),
236
+ elastic: Animator.makeElastic(1),
237
+ veryElastic: Animator.makeElastic(3),
238
+ bouncy: Animator.makeBounce(1),
239
+ veryBouncy: Animator.makeBounce(3)
240
+ }
241
+
242
+ // animates a pixel-based style property between two integer values
243
+ function NumericalStyleSubject(els, property, from, to, units) {
244
+ this.els = Animator.makeArray(els);
245
+ if (property == 'opacity' && window.ActiveXObject) {
246
+ this.property = 'filter';
247
+ } else {
248
+ this.property = Animator.camelize(property);
249
+ }
250
+ this.from = parseFloat(from);
251
+ this.to = parseFloat(to);
252
+ this.units = units != null ? units : 'px';
253
+ }
254
+ NumericalStyleSubject.prototype = {
255
+ setState: function(state) {
256
+ var style = this.getStyle(state);
257
+ var visibility = (this.property == 'opacity' && state == 0) ? 'hidden' : '';
258
+ var j=0;
259
+ for (var i=0; i<this.els.length; i++) {
260
+ try {
261
+ this.els[i].style[this.property] = style;
262
+ } catch (e) {
263
+ // ignore fontWeight - intermediate numerical values cause exeptions in firefox
264
+ if (this.property != 'fontWeight') throw e;
265
+ }
266
+ if (j++ > 20) return;
267
+ }
268
+ },
269
+ getStyle: function(state) {
270
+ state = this.from + ((this.to - this.from) * state);
271
+ if (this.property == 'filter') return "alpha(opacity=" + Math.round(state*100) + ")";
272
+ if (this.property == 'opacity') return state;
273
+ return Math.round(state) + this.units;
274
+ },
275
+ inspect: function() {
276
+ return "\t" + this.property + "(" + this.from + this.units + " to " + this.to + this.units + ")\n";
277
+ }
278
+ }
279
+
280
+ // animates a colour based style property between two hex values
281
+ function ColorStyleSubject(els, property, from, to) {
282
+ this.els = Animator.makeArray(els);
283
+ this.property = Animator.camelize(property);
284
+ this.to = this.expandColor(to);
285
+ this.from = this.expandColor(from);
286
+ this.origFrom = from;
287
+ this.origTo = to;
288
+ }
289
+
290
+ ColorStyleSubject.prototype = {
291
+ // parse "#FFFF00" to [256, 256, 0]
292
+ expandColor: function(color) {
293
+ var hexColor, red, green, blue;
294
+ hexColor = ColorStyleSubject.parseColor(color);
295
+ if (hexColor) {
296
+ red = parseInt(hexColor.slice(1, 3), 16);
297
+ green = parseInt(hexColor.slice(3, 5), 16);
298
+ blue = parseInt(hexColor.slice(5, 7), 16);
299
+ return [red,green,blue]
300
+ }
301
+ if (window.DEBUG) {
302
+ alert("Invalid colour: '" + color + "'");
303
+ }
304
+ },
305
+ getValueForState: function(color, state) {
306
+ return Math.round(this.from[color] + ((this.to[color] - this.from[color]) * state));
307
+ },
308
+ setState: function(state) {
309
+ var color = '#'
310
+ + ColorStyleSubject.toColorPart(this.getValueForState(0, state))
311
+ + ColorStyleSubject.toColorPart(this.getValueForState(1, state))
312
+ + ColorStyleSubject.toColorPart(this.getValueForState(2, state));
313
+ for (var i=0; i<this.els.length; i++) {
314
+ this.els[i].style[this.property] = color;
315
+ }
316
+ },
317
+ inspect: function() {
318
+ return "\t" + this.property + "(" + this.origFrom + " to " + this.origTo + ")\n";
319
+ }
320
+ }
321
+
322
+ // return a properly formatted 6-digit hex colour spec, or false
323
+ ColorStyleSubject.parseColor = function(string) {
324
+ var color = '#', match;
325
+ if(match = ColorStyleSubject.parseColor.rgbRe.exec(string)) {
326
+ var part;
327
+ for (var i=1; i<=3; i++) {
328
+ part = Math.max(0, Math.min(255, parseInt(match[i])));
329
+ color += ColorStyleSubject.toColorPart(part);
330
+ }
331
+ return color;
332
+ }
333
+ if (match = ColorStyleSubject.parseColor.hexRe.exec(string)) {
334
+ if(match[1].length == 3) {
335
+ for (var i=0; i<3; i++) {
336
+ color += match[1].charAt(i) + match[1].charAt(i);
337
+ }
338
+ return color;
339
+ }
340
+ return '#' + match[1];
341
+ }
342
+ return false;
343
+ }
344
+ // convert a number to a 2 digit hex string
345
+ ColorStyleSubject.toColorPart = function(number) {
346
+ if (number > 255) number = 255;
347
+ var digits = number.toString(16);
348
+ if (number < 16) return '0' + digits;
349
+ return digits;
350
+ }
351
+ ColorStyleSubject.parseColor.rgbRe = /^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i;
352
+ ColorStyleSubject.parseColor.hexRe = /^\#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
353
+
354
+ // Animates discrete styles, i.e. ones that do not scale but have discrete values
355
+ // that can't be interpolated
356
+ function DiscreteStyleSubject(els, property, from, to, threshold) {
357
+ this.els = Animator.makeArray(els);
358
+ this.property = Animator.camelize(property);
359
+ this.from = from;
360
+ this.to = to;
361
+ this.threshold = threshold || 0.5;
362
+ }
363
+
364
+ DiscreteStyleSubject.prototype = {
365
+ setState: function(state) {
366
+ var j=0;
367
+ for (var i=0; i<this.els.length; i++) {
368
+ this.els[i].style[this.property] = state <= this.threshold ? this.from : this.to;
369
+ }
370
+ },
371
+ inspect: function() {
372
+ return "\t" + this.property + "(" + this.from + " to " + this.to + " @ " + this.threshold + ")\n";
373
+ }
374
+ }
375
+
376
+ // animates between two styles defined using CSS.
377
+ // if style1 and style2 are present, animate between them, if only style1
378
+ // is present, animate between the element's current style and style1
379
+ function CSSStyleSubject(els, style1, style2) {
380
+ els = Animator.makeArray(els);
381
+ this.subjects = [];
382
+ if (els.length == 0) return;
383
+ var prop, toStyle, fromStyle;
384
+ if (style2) {
385
+ fromStyle = this.parseStyle(style1, els[0]);
386
+ toStyle = this.parseStyle(style2, els[0]);
387
+ } else {
388
+ toStyle = this.parseStyle(style1, els[0]);
389
+ fromStyle = {};
390
+ for (prop in toStyle) {
391
+ fromStyle[prop] = CSSStyleSubject.getStyle(els[0], prop);
392
+ }
393
+ }
394
+ // remove unchanging properties
395
+ var prop;
396
+ for (prop in fromStyle) {
397
+ if (fromStyle[prop] == toStyle[prop]) {
398
+ delete fromStyle[prop];
399
+ delete toStyle[prop];
400
+ }
401
+ }
402
+ // discover the type (numerical or colour) of each style
403
+ var prop, units, match, type, from, to;
404
+ for (prop in fromStyle) {
405
+ var fromProp = String(fromStyle[prop]);
406
+ var toProp = String(toStyle[prop]);
407
+ if (toStyle[prop] == null) {
408
+ if (window.DEBUG) alert("No to style provided for '" + prop + '"');
409
+ continue;
410
+ }
411
+
412
+ if (from = ColorStyleSubject.parseColor(fromProp)) {
413
+ to = ColorStyleSubject.parseColor(toProp);
414
+ type = ColorStyleSubject;
415
+ } else if (fromProp.match(CSSStyleSubject.numericalRe)
416
+ && toProp.match(CSSStyleSubject.numericalRe)) {
417
+ from = parseFloat(fromProp);
418
+ to = parseFloat(toProp);
419
+ type = NumericalStyleSubject;
420
+ match = CSSStyleSubject.numericalRe.exec(fromProp);
421
+ var reResult = CSSStyleSubject.numericalRe.exec(toProp);
422
+ if (match[1] != null) {
423
+ units = match[1];
424
+ } else if (reResult[1] != null) {
425
+ units = reResult[1];
426
+ } else {
427
+ units = reResult;
428
+ }
429
+ } else if (fromProp.match(CSSStyleSubject.discreteRe)
430
+ && toProp.match(CSSStyleSubject.discreteRe)) {
431
+ from = fromProp;
432
+ to = toProp;
433
+ type = DiscreteStyleSubject;
434
+ units = 0; // hack - how to get an animator option down to here
435
+ } else {
436
+ if (window.DEBUG) {
437
+ alert("Unrecognised format for value of "
438
+ + prop + ": '" + fromStyle[prop] + "'");
439
+ }
440
+ continue;
441
+ }
442
+ this.subjects[this.subjects.length] = new type(els, prop, from, to, units);
443
+ }
444
+ }
445
+
446
+ CSSStyleSubject.prototype = {
447
+ // parses "width: 400px; color: #FFBB2E" to {width: "400px", color: "#FFBB2E"}
448
+ parseStyle: function(style, el) {
449
+ var rtn = {};
450
+ // if style is a rule set
451
+ if (style.indexOf(":") != -1) {
452
+ var styles = style.split(";");
453
+ for (var i=0; i<styles.length; i++) {
454
+ var parts = CSSStyleSubject.ruleRe.exec(styles[i]);
455
+ if (parts) {
456
+ rtn[parts[1]] = parts[2];
457
+ }
458
+ }
459
+ }
460
+ // else assume style is a class name
461
+ else {
462
+ var prop, value, oldClass;
463
+ oldClass = el.className;
464
+ el.className = style;
465
+ for (var i=0; i<CSSStyleSubject.cssProperties.length; i++) {
466
+ prop = CSSStyleSubject.cssProperties[i];
467
+ value = CSSStyleSubject.getStyle(el, prop);
468
+ if (value != null) {
469
+ rtn[prop] = value;
470
+ }
471
+ }
472
+ el.className = oldClass;
473
+ }
474
+ return rtn;
475
+
476
+ },
477
+ setState: function(state) {
478
+ for (var i=0; i<this.subjects.length; i++) {
479
+ this.subjects[i].setState(state);
480
+ }
481
+ },
482
+ inspect: function() {
483
+ var str = "";
484
+ for (var i=0; i<this.subjects.length; i++) {
485
+ str += this.subjects[i].inspect();
486
+ }
487
+ return str;
488
+ }
489
+ }
490
+ // get the current value of a css property,
491
+ CSSStyleSubject.getStyle = function(el, property){
492
+ var style;
493
+ if(document.defaultView && document.defaultView.getComputedStyle){
494
+ style = document.defaultView.getComputedStyle(el, "").getPropertyValue(property);
495
+ if (style) {
496
+ return style;
497
+ }
498
+ }
499
+ property = Animator.camelize(property);
500
+ if(el.currentStyle){
501
+ style = el.currentStyle[property];
502
+ }
503
+ return style || el.style[property]
504
+ }
505
+
506
+
507
+ CSSStyleSubject.ruleRe = /^\s*([a-zA-Z\-]+)\s*:\s*(\S(.+\S)?)\s*$/;
508
+ CSSStyleSubject.numericalRe = /^-?\d+(?:\.\d+)?(%|[a-zA-Z]{2})?$/;
509
+ CSSStyleSubject.discreteRe = /^\w+$/;
510
+
511
+ // required because the style object of elements isn't enumerable in Safari
512
+ /*
513
+ CSSStyleSubject.cssProperties = ['background-color','border','border-color','border-spacing',
514
+ 'border-style','border-top','border-right','border-bottom','border-left','border-top-color',
515
+ 'border-right-color','border-bottom-color','border-left-color','border-top-width','border-right-width',
516
+ 'border-bottom-width','border-left-width','border-width','bottom','color','font-size','font-size-adjust',
517
+ 'font-stretch','font-style','height','left','letter-spacing','line-height','margin','margin-top',
518
+ 'margin-right','margin-bottom','margin-left','marker-offset','max-height','max-width','min-height',
519
+ 'min-width','orphans','outline','outline-color','outline-style','outline-width','overflow','padding',
520
+ 'padding-top','padding-right','padding-bottom','padding-left','quotes','right','size','text-indent',
521
+ 'top','width','word-spacing','z-index','opacity','outline-offset'];*/
522
+
523
+
524
+ CSSStyleSubject.cssProperties = ['azimuth','background','background-attachment','background-color','background-image','background-position','background-repeat','border-collapse','border-color','border-spacing','border-style','border-top','border-top-color','border-right-color','border-bottom-color','border-left-color','border-top-style','border-right-style','border-bottom-style','border-left-style','border-top-width','border-right-width','border-bottom-width','border-left-width','border-width','bottom','clear','clip','color','content','cursor','direction','display','elevation','empty-cells','css-float','font','font-family','font-size','font-size-adjust','font-stretch','font-style','font-variant','font-weight','height','left','letter-spacing','line-height','list-style','list-style-image','list-style-position','list-style-type','margin','margin-top','margin-right','margin-bottom','margin-left','max-height','max-width','min-height','min-width','orphans','outline','outline-color','outline-style','outline-width','overflow','padding','padding-top','padding-right','padding-bottom','padding-left','pause','position','right','size','table-layout','text-align','text-decoration','text-indent','text-shadow','text-transform','top','vertical-align','visibility','white-space','width','word-spacing','z-index','opacity','outline-offset','overflow-x','overflow-y'];
525
+
526
+
527
+ // chains several Animator objects together
528
+ function AnimatorChain(animators, options) {
529
+ this.animators = animators;
530
+ this.setOptions(options);
531
+ for (var i=0; i<this.animators.length; i++) {
532
+ this.listenTo(this.animators[i]);
533
+ }
534
+ this.forwards = false;
535
+ this.current = 0;
536
+ }
537
+
538
+ AnimatorChain.prototype = {
539
+ // apply defaults
540
+ setOptions: function(options) {
541
+ this.options = Animator.applyDefaults({
542
+ // by default, each call to AnimatorChain.play() calls jumpTo(0) of each animator
543
+ // before playing, which can cause flickering if you have multiple animators all
544
+ // targeting the same element. Set this to false to avoid this.
545
+ resetOnPlay: true
546
+ }, options);
547
+ },
548
+ // play each animator in turn
549
+ play: function() {
550
+ this.forwards = true;
551
+ this.current = -1;
552
+ if (this.options.resetOnPlay) {
553
+ for (var i=0; i<this.animators.length; i++) {
554
+ this.animators[i].jumpTo(0);
555
+ }
556
+ }
557
+ this.advance();
558
+ },
559
+ // play all animators backwards
560
+ reverse: function() {
561
+ this.forwards = false;
562
+ this.current = this.animators.length;
563
+ if (this.options.resetOnPlay) {
564
+ for (var i=0; i<this.animators.length; i++) {
565
+ this.animators[i].jumpTo(1);
566
+ }
567
+ }
568
+ this.advance();
569
+ },
570
+ // if we have just play()'d, then call reverse(), and vice versa
571
+ toggle: function() {
572
+ if (this.forwards) {
573
+ this.seekTo(0);
574
+ } else {
575
+ this.seekTo(1);
576
+ }
577
+ },
578
+ // internal: install an event listener on an animator's onComplete option
579
+ // to trigger the next animator
580
+ listenTo: function(animator) {
581
+ var oldOnComplete = animator.options.onComplete;
582
+ var _this = this;
583
+ animator.options.onComplete = function() {
584
+ if (oldOnComplete) oldOnComplete.call(animator);
585
+ _this.advance();
586
+ }
587
+ },
588
+ // play the next animator
589
+ advance: function() {
590
+ if (this.forwards) {
591
+ if (this.animators[this.current + 1] == null) return;
592
+ this.current++;
593
+ this.animators[this.current].play();
594
+ } else {
595
+ if (this.animators[this.current - 1] == null) return;
596
+ this.current--;
597
+ this.animators[this.current].reverse();
598
+ }
599
+ },
600
+ // this function is provided for drop-in compatibility with Animator objects,
601
+ // but only accepts 0 and 1 as target values
602
+ seekTo: function(target) {
603
+ if (target <= 0) {
604
+ this.forwards = false;
605
+ this.animators[this.current].seekTo(0);
606
+ } else {
607
+ this.forwards = true;
608
+ this.animators[this.current].seekTo(1);
609
+ }
610
+ }
611
+ }
612
+
613
+ // an Accordion is a class that creates and controls a number of Animators. An array of elements is passed in,
614
+ // and for each element an Animator and a activator button is created. When an Animator's activator button is
615
+ // clicked, the Animator and all before it seek to 0, and all Animators after it seek to 1. This can be used to
616
+ // create the classic Accordion effect, hence the name.
617
+ // see setOptions for arguments
618
+ function Accordion(options) {
619
+ this.setOptions(options);
620
+ var selected = this.options.initialSection, current;
621
+ if (this.options.rememberance) {
622
+ current = document.location.hash.substring(1);
623
+ }
624
+ this.rememberanceTexts = [];
625
+ this.ans = [];
626
+ var _this = this;
627
+ for (var i=0; i<this.options.sections.length; i++) {
628
+ var el = this.options.sections[i];
629
+ var an = new Animator(this.options.animatorOptions);
630
+ var from = this.options.from + (this.options.shift * i);
631
+ var to = this.options.to + (this.options.shift * i);
632
+ an.addSubject(new NumericalStyleSubject(el, this.options.property, from, to, this.options.units));
633
+ an.jumpTo(0);
634
+ var activator = this.options.getActivator(el);
635
+ activator.index = i;
636
+ activator.onclick = function(){_this.show(this.index)};
637
+ this.ans[this.ans.length] = an;
638
+ this.rememberanceTexts[i] = activator.innerHTML.replace(/\s/g, "");
639
+ if (this.rememberanceTexts[i] === current) {
640
+ selected = i;
641
+ }
642
+ }
643
+ this.show(selected);
644
+ }
645
+
646
+ Accordion.prototype = {
647
+ // apply defaults
648
+ setOptions: function(options) {
649
+ this.options = Object.extend({
650
+ // REQUIRED: an array of elements to use as the accordion sections
651
+ sections: null,
652
+ // a function that locates an activator button element given a section element.
653
+ // by default it takes a button id from the section's "activator" attibute
654
+ getActivator: function(el) {return document.getElementById(el.getAttribute("activator"))},
655
+ // shifts each animator's range, for example with options {from:0,to:100,shift:20}
656
+ // the animators' ranges will be 0-100, 20-120, 40-140 etc.
657
+ shift: 0,
658
+ // the first page to show
659
+ initialSection: 0,
660
+ // if set to true, document.location.hash will be used to preserve the open section across page reloads
661
+ rememberance: true,
662
+ // constructor arguments to the Animator objects
663
+ animatorOptions: {}
664
+ }, options || {});
665
+ },
666
+ show: function(section) {
667
+ for (var i=0; i<this.ans.length; i++) {
668
+ this.ans[i].seekTo(i > section ? 1 : 0);
669
+ }
670
+ if (this.options.rememberance) {
671
+ document.location.hash = this.rememberanceTexts[section];
672
+ }
673
+ }
674
+ }
675
+
676
+
1
677
  /**
2
678
  *
3
679
  * SoundManager 2 Demo: 360-degree / "donut player"