releaf 0.1.2 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (322) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +19 -21
  3. data/lib/releaf.rb +1 -34
  4. data/lib/releaf/all.rb +3 -0
  5. data/lib/releaf/rspec.rb +4 -0
  6. data/lib/releaf/rspec/features_matchers.rb +76 -0
  7. data/lib/releaf/rspec/helpers.rb +227 -0
  8. data/lib/releaf/rspec/matchers.rb +16 -0
  9. data/lib/releaf/test.rb +5 -0
  10. data/spec/factories/author.rb +6 -0
  11. data/spec/factories/book.rb +5 -0
  12. data/spec/factories/chapter.rb +7 -0
  13. data/spec/factories/common.rb +5 -0
  14. data/spec/factories/home_page.rb +5 -0
  15. data/spec/factories/node.rb +43 -0
  16. data/spec/factories/node_route.rb +7 -0
  17. data/spec/factories/publisher.rb +5 -0
  18. data/spec/factories/role.rb +21 -0
  19. data/spec/factories/text_page.rb +5 -0
  20. data/spec/factories/user.rb +22 -0
  21. data/spec/rails_helper.rb +122 -0
  22. data/spec/spec_helper.rb +81 -24
  23. data/spec/support/controller_macros.rb +8 -0
  24. data/spec/support/excel_helpers.rb +63 -0
  25. data/spec/support/shared/service_includer.rb +9 -0
  26. data/spec/support/wait_steps.rb +23 -0
  27. metadata +141 -499
  28. data/README.md +0 -77
  29. data/Rakefile +0 -70
  30. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  31. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_flat_75_ffffff_40x100.png +0 -0
  32. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  33. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_glass_65_ffffff_1x400.png +0 -0
  34. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_glass_75_dadada_1x400.png +0 -0
  35. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  36. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  37. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  38. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-icons_222222_256x240.png +0 -0
  39. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-icons_2e83ff_256x240.png +0 -0
  40. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-icons_454545_256x240.png +0 -0
  41. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-icons_888888_256x240.png +0 -0
  42. data/app/assets/images/releaf/3rd_party/jquery-ui-1.9.2.custom/ui-icons_cd0a0a_256x240.png +0 -0
  43. data/app/assets/images/releaf/3rd_party/lightbox/close.png +0 -0
  44. data/app/assets/images/releaf/3rd_party/lightbox/loading.gif +0 -0
  45. data/app/assets/images/releaf/3rd_party/lightbox/next.png +0 -0
  46. data/app/assets/images/releaf/3rd_party/lightbox/prev.png +0 -0
  47. data/app/assets/images/releaf/add.png +0 -0
  48. data/app/assets/images/releaf/background.jpg +0 -0
  49. data/app/assets/images/releaf/button/button_bgr.gif +0 -0
  50. data/app/assets/images/releaf/button/button_hover_bgr.png +0 -0
  51. data/app/assets/images/releaf/controllers/content/close.gif +0 -0
  52. data/app/assets/images/releaf/controllers/content/close_active.gif +0 -0
  53. data/app/assets/images/releaf/controllers/content/close_hover.gif +0 -0
  54. data/app/assets/images/releaf/controllers/content/global_fields_bgr.png +0 -0
  55. data/app/assets/images/releaf/controllers/content/open.gif +0 -0
  56. data/app/assets/images/releaf/controllers/content/open_2.gif +0 -0
  57. data/app/assets/images/releaf/controllers/content/open_active.gif +0 -0
  58. data/app/assets/images/releaf/controllers/content/open_hover.gif +0 -0
  59. data/app/assets/images/releaf/controllers/sessions/background.jpg +0 -0
  60. data/app/assets/images/releaf/controllers/sessions/logo.jpg +0 -0
  61. data/app/assets/images/releaf/expand_tool/close.png +0 -0
  62. data/app/assets/images/releaf/expand_tool/close_hover.png +0 -0
  63. data/app/assets/images/releaf/expand_tool/close_hover_shim.png +0 -0
  64. data/app/assets/images/releaf/expand_tool/close_shim.png +0 -0
  65. data/app/assets/images/releaf/expand_tool/loader.gif +0 -0
  66. data/app/assets/images/releaf/expand_tool/open.png +0 -0
  67. data/app/assets/images/releaf/expand_tool/open_hover.png +0 -0
  68. data/app/assets/images/releaf/expand_tool/open_hover_shim.png +0 -0
  69. data/app/assets/images/releaf/expand_tool/open_shim.png +0 -0
  70. data/app/assets/images/releaf/favicon.ico +0 -0
  71. data/app/assets/images/releaf/globalFieldContainerBgr.png +0 -0
  72. data/app/assets/images/releaf/icons/129.png +0 -0
  73. data/app/assets/images/releaf/icons/130.png +0 -0
  74. data/app/assets/images/releaf/icons/accept.png +0 -0
  75. data/app/assets/images/releaf/icons/add.png +0 -0
  76. data/app/assets/images/releaf/icons/arrow_down.png +0 -0
  77. data/app/assets/images/releaf/icons/arrow_left.png +0 -0
  78. data/app/assets/images/releaf/icons/arrow_refresh.png +0 -0
  79. data/app/assets/images/releaf/icons/arrow_up.png +0 -0
  80. data/app/assets/images/releaf/icons/bin_empty.png +0 -0
  81. data/app/assets/images/releaf/icons/bullet_black.png +0 -0
  82. data/app/assets/images/releaf/icons/bullet_connect.png +0 -0
  83. data/app/assets/images/releaf/icons/bullet_start.png +0 -0
  84. data/app/assets/images/releaf/icons/bullet_tick.png +0 -0
  85. data/app/assets/images/releaf/icons/chrome.png +0 -0
  86. data/app/assets/images/releaf/icons/control_play.png +0 -0
  87. data/app/assets/images/releaf/icons/date.png +0 -0
  88. data/app/assets/images/releaf/icons/delete.png +0 -0
  89. data/app/assets/images/releaf/icons/disk.png +0 -0
  90. data/app/assets/images/releaf/icons/drag-handle.png +0 -0
  91. data/app/assets/images/releaf/icons/error.png +0 -0
  92. data/app/assets/images/releaf/icons/eye.png +0 -0
  93. data/app/assets/images/releaf/icons/firefox.png +0 -0
  94. data/app/assets/images/releaf/icons/google-not-available.gif +0 -0
  95. data/app/assets/images/releaf/icons/google.gif +0 -0
  96. data/app/assets/images/releaf/icons/keyboard.png +0 -0
  97. data/app/assets/images/releaf/icons/left_16.png +0 -0
  98. data/app/assets/images/releaf/icons/link.png +0 -0
  99. data/app/assets/images/releaf/icons/magnifier.png +0 -0
  100. data/app/assets/images/releaf/icons/notAllowed.png +0 -0
  101. data/app/assets/images/releaf/icons/page_white_add.png +0 -0
  102. data/app/assets/images/releaf/icons/page_white_edit.png +0 -0
  103. data/app/assets/images/releaf/icons/page_white_put.png +0 -0
  104. data/app/assets/images/releaf/icons/page_white_text.png +0 -0
  105. data/app/assets/images/releaf/icons/pencil.png +0 -0
  106. data/app/assets/images/releaf/icons/picture.png +0 -0
  107. data/app/assets/images/releaf/icons/right_16.png +0 -0
  108. data/app/assets/images/releaf/icons/tick.png +0 -0
  109. data/app/assets/images/releaf/icons/warning.png +0 -0
  110. data/app/assets/images/releaf/icons/world_go.png +0 -0
  111. data/app/assets/images/releaf/icons/world_link.png +0 -0
  112. data/app/assets/images/releaf/input/autocompleteExpandIcon.png +0 -0
  113. data/app/assets/images/releaf/input/input_bgr.gif +0 -0
  114. data/app/assets/images/releaf/language_root.png +0 -0
  115. data/app/assets/images/releaf/loader.gif +0 -0
  116. data/app/assets/images/releaf/logout.png +0 -0
  117. data/app/assets/images/releaf/main_menu/active_bgr.png +0 -0
  118. data/app/assets/images/releaf/main_menu/bgr.png +0 -0
  119. data/app/assets/images/releaf/main_menu/hover_bgr.png +0 -0
  120. data/app/assets/images/releaf/module.png +0 -0
  121. data/app/assets/images/releaf/panel_layout/active_bgr.png +0 -0
  122. data/app/assets/images/releaf/panel_layout/secondary_panel_horizontal_bgr.png +0 -0
  123. data/app/assets/images/releaf/panel_layout/secondary_panel_vertical_bgr.png +0 -0
  124. data/app/assets/images/releaf/releaf_table/selected_bgr.png +0 -0
  125. data/app/assets/images/releaf/releaf_table/th_bgr.gif +0 -0
  126. data/app/assets/javascripts/releaf/3rd_party/jquery-cookie/README.md +0 -73
  127. data/app/assets/javascripts/releaf/3rd_party/jquery-cookie/jquery.cookie.js +0 -47
  128. data/app/assets/javascripts/releaf/3rd_party/jquery-cookie/server.js +0 -24
  129. data/app/assets/javascripts/releaf/3rd_party/jquery-cookie/test.html +0 -19
  130. data/app/assets/javascripts/releaf/3rd_party/jquery-cookie/test.js +0 -80
  131. data/app/assets/javascripts/releaf/3rd_party/jquery-ui-timepicker-addon.js +0 -1882
  132. data/app/assets/javascripts/releaf/3rd_party/lightbox.js.erb +0 -379
  133. data/app/assets/javascripts/releaf/application.js +0 -14
  134. data/app/assets/javascripts/releaf/controllers/base.js +0 -130
  135. data/app/assets/javascripts/releaf/controllers/releaf/content.js +0 -90
  136. data/app/assets/javascripts/releaf/controllers/releaf/translations.js +0 -31
  137. data/app/assets/javascripts/releaf/include/continuous_scroll.js +0 -321
  138. data/app/assets/javascripts/releaf/include/field.type_autocomplete.js +0 -58
  139. data/app/assets/javascripts/releaf/include/field.type_date_or_datetime_or_time.js +0 -43
  140. data/app/assets/javascripts/releaf/include/field.type_richtext.js +0 -90
  141. data/app/assets/javascripts/releaf/include/localization.js +0 -12
  142. data/app/assets/javascripts/releaf/include/nested_fields.js +0 -64
  143. data/app/assets/javascripts/releaf/include/sortable.js +0 -29
  144. data/app/assets/javascripts/releaf/lib/request_url.js +0 -183
  145. data/app/assets/stylesheets/releaf/3rd_party/jquery-ui-1.9.2.custom.css.erb +0 -464
  146. data/app/assets/stylesheets/releaf/3rd_party/jquery-ui-timepicker-addon.css +0 -10
  147. data/app/assets/stylesheets/releaf/3rd_party/lightbox.css.erb +0 -157
  148. data/app/assets/stylesheets/releaf/application.css.erb +0 -122
  149. data/app/assets/stylesheets/releaf/controllers/base.css.erb +0 -205
  150. data/app/assets/stylesheets/releaf/controllers/releaf/content.css.erb +0 -422
  151. data/app/assets/stylesheets/releaf/controllers/releaf/sessions.css.scss.erb +0 -116
  152. data/app/assets/stylesheets/releaf/controllers/releaf/translations.css.erb +0 -205
  153. data/app/assets/stylesheets/releaf/include/button.css.erb +0 -176
  154. data/app/assets/stylesheets/releaf/include/field.css.erb +0 -281
  155. data/app/assets/stylesheets/releaf/include/input.css.erb +0 -40
  156. data/app/assets/stylesheets/releaf/include/main_menu.css.erb +0 -66
  157. data/app/assets/stylesheets/releaf/include/pagination.css.erb +0 -29
  158. data/app/assets/stylesheets/releaf/include/panel_layout.css.erb +0 -251
  159. data/app/assets/stylesheets/releaf/include/releaf_table.css.erb +0 -112
  160. data/app/assets/stylesheets/releaf/include/sortable.css.erb +0 -12
  161. data/app/controllers/releaf/admins_controller.rb +0 -55
  162. data/app/controllers/releaf/application_controller.rb +0 -11
  163. data/app/controllers/releaf/base_application_controller.rb +0 -18
  164. data/app/controllers/releaf/base_controller.rb +0 -571
  165. data/app/controllers/releaf/content_controller.rb +0 -183
  166. data/app/controllers/releaf/roles_controller.rb +0 -38
  167. data/app/controllers/releaf/sessions_controller.rb +0 -27
  168. data/app/controllers/releaf/tinymce_assets_controller.rb +0 -26
  169. data/app/controllers/releaf/translations_controller.rb +0 -117
  170. data/app/helpers/releaf/admin_helper.rb +0 -59
  171. data/app/helpers/releaf/application_helper.rb +0 -4
  172. data/app/helpers/releaf/pagination_renderer.rb +0 -44
  173. data/app/helpers/releaf/releaf_devise_helper.rb +0 -8
  174. data/app/models/releaf/admin.rb +0 -60
  175. data/app/models/releaf/blank_node_base.rb +0 -29
  176. data/app/models/releaf/node.rb +0 -222
  177. data/app/models/releaf/node_base.rb +0 -31
  178. data/app/models/releaf/role.rb +0 -126
  179. data/app/models/releaf/tinymce_asset.rb +0 -6
  180. data/app/views/layouts/releaf/admin.html.haml +0 -57
  181. data/app/views/layouts/releaf/devise.html.haml +0 -32
  182. data/app/views/releaf/aliases/_edit.body.html.haml +0 -50
  183. data/app/views/releaf/aliases/_edit.header.html.haml +0 -19
  184. data/app/views/releaf/aliases/_index.row.html.haml +0 -5
  185. data/app/views/releaf/aliases/_secondary_panel.html.haml +0 -13
  186. data/app/views/releaf/base/_edit.body.html.haml +0 -11
  187. data/app/views/releaf/base/_edit.field.html.haml +0 -23
  188. data/app/views/releaf/base/_edit.field_type_autocomplete.html.haml +0 -15
  189. data/app/views/releaf/base/_edit.field_type_boolean.html.haml +0 -5
  190. data/app/views/releaf/base/_edit.field_type_date.html.haml +0 -8
  191. data/app/views/releaf/base/_edit.field_type_datetime.html.haml +0 -8
  192. data/app/views/releaf/base/_edit.field_type_delete_nested.html.haml +0 -3
  193. data/app/views/releaf/base/_edit.field_type_file.html.haml +0 -10
  194. data/app/views/releaf/base/_edit.field_type_image.html.haml +0 -12
  195. data/app/views/releaf/base/_edit.field_type_item.html.haml +0 -31
  196. data/app/views/releaf/base/_edit.field_type_link.html.haml +0 -4
  197. data/app/views/releaf/base/_edit.field_type_link_i18n.html.haml +0 -26
  198. data/app/views/releaf/base/_edit.field_type_password.html.haml +0 -4
  199. data/app/views/releaf/base/_edit.field_type_richtext.html.haml +0 -4
  200. data/app/views/releaf/base/_edit.field_type_richtext_i18n.html.haml +0 -27
  201. data/app/views/releaf/base/_edit.field_type_text.html.haml +0 -4
  202. data/app/views/releaf/base/_edit.field_type_text_i18n.html.haml +0 -27
  203. data/app/views/releaf/base/_edit.field_type_textarea.html.haml +0 -4
  204. data/app/views/releaf/base/_edit.field_type_textarea_i18n.html.haml +0 -27
  205. data/app/views/releaf/base/_edit.field_type_time.html.haml +0 -8
  206. data/app/views/releaf/base/_edit.fields.association.html.haml +0 -48
  207. data/app/views/releaf/base/_edit.fields.has_many_template.html.haml +0 -15
  208. data/app/views/releaf/base/_edit.fields.html.haml +0 -20
  209. data/app/views/releaf/base/_edit.footer.html.haml +0 -14
  210. data/app/views/releaf/base/_edit.form.html.haml +0 -4
  211. data/app/views/releaf/base/_edit.header.html.haml +0 -3
  212. data/app/views/releaf/base/_index.body.html.haml +0 -6
  213. data/app/views/releaf/base/_index.cell.html.haml +0 -20
  214. data/app/views/releaf/base/_index.footer.html.haml +0 -28
  215. data/app/views/releaf/base/_index.header.html.haml +0 -4
  216. data/app/views/releaf/base/_index.row.html.haml +0 -6
  217. data/app/views/releaf/base/_index.search.html.haml +0 -5
  218. data/app/views/releaf/base/_index.table.html.haml +0 -24
  219. data/app/views/releaf/base/_secondary_panel.html.haml +0 -10
  220. data/app/views/releaf/base/_show.body.html.haml +0 -3
  221. data/app/views/releaf/base/_show.field.html.haml +0 -20
  222. data/app/views/releaf/base/_show.field_type_date.html.haml +0 -9
  223. data/app/views/releaf/base/_show.field_type_date_time.html.haml +0 -9
  224. data/app/views/releaf/base/_show.field_type_email.html.haml +0 -6
  225. data/app/views/releaf/base/_show.field_type_file.html.haml +0 -7
  226. data/app/views/releaf/base/_show.field_type_image.html.haml +0 -10
  227. data/app/views/releaf/base/_show.field_type_item.html.haml +0 -11
  228. data/app/views/releaf/base/_show.field_type_link.html.haml +0 -14
  229. data/app/views/releaf/base/_show.field_type_password.html.haml +0 -6
  230. data/app/views/releaf/base/_show.field_type_richtext.html.haml +0 -6
  231. data/app/views/releaf/base/_show.field_type_text.html.haml +0 -6
  232. data/app/views/releaf/base/_show.field_type_textarea.html.haml +0 -6
  233. data/app/views/releaf/base/_show.field_type_time.html.haml +0 -9
  234. data/app/views/releaf/base/_show.field_type_url.html.haml +0 -7
  235. data/app/views/releaf/base/_show.fields.association.html.haml +0 -36
  236. data/app/views/releaf/base/_show.fields.has_many_template.html.haml +0 -12
  237. data/app/views/releaf/base/_show.fields.html.haml +0 -17
  238. data/app/views/releaf/base/_show.footer.html.haml +0 -18
  239. data/app/views/releaf/base/_show.header.html.haml +0 -3
  240. data/app/views/releaf/base/confirm_destroy.html.haml +0 -17
  241. data/app/views/releaf/base/edit.html.haml +0 -1
  242. data/app/views/releaf/base/index.html.haml +0 -3
  243. data/app/views/releaf/base/new.html.haml +0 -1
  244. data/app/views/releaf/base/show.html.haml +0 -3
  245. data/app/views/releaf/content/_edit.body.html.haml +0 -46
  246. data/app/views/releaf/content/_edit.content_fields.html.haml +0 -11
  247. data/app/views/releaf/content/_edit.fields.html.haml +0 -17
  248. data/app/views/releaf/content/_edit.slug.html.haml +0 -12
  249. data/app/views/releaf/content/_get_content_form.html.haml +0 -7
  250. data/app/views/releaf/content/_secondary_panel.html.haml +0 -3
  251. data/app/views/releaf/content/_tree_level.html.haml +0 -16
  252. data/app/views/releaf/content/ajax.new.html.haml +0 -3
  253. data/app/views/releaf/content/index.html.haml +0 -0
  254. data/app/views/releaf/roles/_edit.field.permissions.html.haml +0 -5
  255. data/app/views/releaf/roles/_show.field.default.html.haml +0 -6
  256. data/app/views/releaf/roles/_show.field.permissions.html.haml +0 -11
  257. data/app/views/releaf/sessions/new.html.haml +0 -17
  258. data/app/views/releaf/translations/_edit.body.html.haml +0 -50
  259. data/app/views/releaf/translations/_edit.header.html.haml +0 -19
  260. data/app/views/releaf/translations/_index.row.html.haml +0 -5
  261. data/app/views/releaf/translations/_secondary_panel.html.haml +0 -13
  262. data/bin/releaf +0 -25
  263. data/lib/generators/releaf/install_generator.rb +0 -87
  264. data/lib/generators/releaf/templates/config/common_fields.yml.example +0 -17
  265. data/lib/generators/releaf/templates/controllers/home_controller.rb +0 -4
  266. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  267. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_flat_75_ffffff_40x100.png +0 -0
  268. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  269. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_glass_65_ffffff_1x400.png +0 -0
  270. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_glass_75_dadada_1x400.png +0 -0
  271. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  272. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  273. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  274. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-icons_222222_256x240.png +0 -0
  275. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-icons_2e83ff_256x240.png +0 -0
  276. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-icons_454545_256x240.png +0 -0
  277. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-icons_888888_256x240.png +0 -0
  278. data/lib/generators/releaf/templates/images/3rd_party/jquery_ui/smoothness/ui-icons_cd0a0a_256x240.png +0 -0
  279. data/lib/generators/releaf/templates/images/3rd_party/lightbox/close.png +0 -0
  280. data/lib/generators/releaf/templates/images/3rd_party/lightbox/loading.gif +0 -0
  281. data/lib/generators/releaf/templates/images/3rd_party/lightbox/next.png +0 -0
  282. data/lib/generators/releaf/templates/images/3rd_party/lightbox/prev.png +0 -0
  283. data/lib/generators/releaf/templates/initializers/releaf.rb +0 -20
  284. data/lib/generators/releaf/templates/initializers/releaf_i18n.rb +0 -25
  285. data/lib/generators/releaf/templates/initializers/releaf_store_current_template.rb +0 -25
  286. data/lib/generators/releaf/templates/javascripts/3rd_party/jquery.jcarousel.js +0 -1058
  287. data/lib/generators/releaf/templates/javascripts/3rd_party/jquery_ui.js +0 -14850
  288. data/lib/generators/releaf/templates/javascripts/3rd_party/lightbox.js.erb +0 -379
  289. data/lib/generators/releaf/templates/javascripts/application.js +0 -15
  290. data/lib/generators/releaf/templates/javascripts/lib/init_jcarousel.js +0 -40
  291. data/lib/generators/releaf/templates/javascripts/lib/js_check.js +0 -8
  292. data/lib/generators/releaf/templates/javascripts/lib/request_url.js +0 -169
  293. data/lib/generators/releaf/templates/javascripts/lib/sortable.js +0 -29
  294. data/lib/generators/releaf/templates/migrations/create_releaf_admins.rb +0 -53
  295. data/lib/generators/releaf/templates/migrations/create_releaf_nodes.rb +0 -25
  296. data/lib/generators/releaf/templates/migrations/create_releaf_roles.rb +0 -12
  297. data/lib/generators/releaf/templates/migrations/create_releaf_tinymce_assets.rb +0 -11
  298. data/lib/generators/releaf/templates/migrations/create_releaf_translations.rb +0 -31
  299. data/lib/generators/releaf/templates/models/admin_ability.rb +0 -51
  300. data/lib/generators/releaf/templates/seeds.rb +0 -64
  301. data/lib/generators/releaf/templates/stylesheets/3rd_party/jquery_ui/smoothness.css.erb +0 -1174
  302. data/lib/generators/releaf/templates/stylesheets/3rd_party/lightbox.css.erb +0 -157
  303. data/lib/generators/releaf/templates/stylesheets/3rd_party/reset.css +0 -48
  304. data/lib/generators/releaf/templates/stylesheets/application.scss +0 -15
  305. data/lib/generators/releaf/templates/stylesheets/style.scss +0 -45
  306. data/lib/generators/releaf/templates/views/home/index.html.haml +0 -1
  307. data/lib/generators/releaf/templates/views/layouts/application.html.haml +0 -26
  308. data/lib/i18n/backend/releaf.rb +0 -97
  309. data/lib/i18n/backend/releaf/translation.rb +0 -61
  310. data/lib/i18n/backend/releaf/translation_data.rb +0 -39
  311. data/lib/i18n/backend/releaf/translation_group.rb +0 -34
  312. data/lib/i18n/releaf.rb +0 -1
  313. data/lib/releaf/boolean_at.rb +0 -77
  314. data/lib/releaf/engine.rb +0 -4
  315. data/lib/releaf/globalize3/fallbacks.rb +0 -19
  316. data/lib/releaf/resources.rb +0 -101
  317. data/lib/releaf/slug.rb +0 -118
  318. data/lib/releaf/version.rb +0 -3
  319. data/lib/tasks/releaf_tasks.rake +0 -4
  320. data/spec/factories/factories.rb +0 -24
  321. data/spec/features/admin_spec.rb +0 -41
  322. data/templates/releaf/installer.rb +0 -207
@@ -1,17 +0,0 @@
1
- -
2
- field_name: seo_title
3
- field_type: string
4
- default: test
5
- apply_to: ['Text', 'HomeController']
6
- apply_to:
7
- - Text
8
- - HomeController
9
- deny_to:
10
- - Text
11
- levels: [1,2,3]
12
-
13
- -
14
- field_name: seo_description
15
- field_type: text
16
- default: example_default_value
17
- apply_to:
@@ -1,4 +0,0 @@
1
- class HomeController < ApplicationController
2
- def index
3
- end
4
- end
@@ -1,20 +0,0 @@
1
- Releaf.setup do |conf|
2
- # Default settings are commented out
3
-
4
- ### setup main menu
5
- # conf.main_menu = [
6
- # 'releaf/content',
7
- # 'releaf/translations',
8
- # '*permissions',
9
- # ]
10
-
11
- # conf.base_menu = {
12
- # '*permissions' => [
13
- # ['permissions', %w[releaf/admins releaf/roles]],
14
- # ]
15
- # }
16
-
17
- # conf.layout = 'releaf/admin'
18
- # conf.devise_for 'releaf/admin'
19
-
20
- end
@@ -1,25 +0,0 @@
1
- module UseKeyForMissing
2
- def call(exception, locale, key, options)
3
- if exception.is_a?(I18n::MissingTranslation)
4
- key.to_s.split('.').last.humanize
5
- else
6
- super
7
- end
8
- end
9
- end
10
- I18n.exception_handler.extend UseKeyForMissing
11
-
12
-
13
-
14
-
15
-
16
- I18N_CACHE = ActiveSupport::Cache::MemoryStore.new
17
- require 'i18n/backend/releaf'
18
- I18n.backend = I18n::Backend::Releaf.new
19
-
20
- # skip cache loading for rake tasks and cucumber (ex. migrations)
21
- if !($0.end_with?('rake') || $0.end_with?('cucumber'))
22
- I18n.backend.reload_cache
23
- end
24
-
25
-
@@ -1,25 +0,0 @@
1
- class ActionController::Base
2
- attr_accessor :active_template
3
-
4
- def active_template_virtual_path
5
- self.active_template.virtual_path if self.active_template
6
- end
7
- end
8
-
9
- class ActionMailer::Base
10
- attr_accessor :active_template
11
-
12
- def active_template_virtual_path
13
- self.active_template.virtual_path if self.active_template
14
- end
15
- end
16
-
17
- class ActionView::TemplateRenderer
18
-
19
- alias_method :_render_template_original, :render_template
20
-
21
- def render_template(template, layout_name = nil, locals = {})
22
- @view.controller.active_template = template if @view.controller && !@view.controller.active_template
23
- return _render_template_original( template, layout_name, locals)
24
- end
25
- end
@@ -1,1058 +0,0 @@
1
- /*!
2
- * jCarousel - Riding carousels with jQuery
3
- * http://sorgalla.com/jcarousel/
4
- *
5
- * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
6
- * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
7
- * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
8
- *
9
- * Built on top of the jQuery library
10
- * http://jquery.com
11
- *
12
- * Inspired by the "Carousel Component" by Bill Scott
13
- * http://billwscott.com/carousel/
14
- */
15
-
16
- /*global window, jQuery */
17
-
18
- (function($) {
19
- // Default configuration properties.
20
- var defaults = {
21
- vertical: false,
22
- rtl: false,
23
- start: 1,
24
- offset: 1,
25
- size: null,
26
- scroll: 3,
27
- visible: null,
28
- animation: 'normal',
29
- easing: 'swing',
30
- auto: 0,
31
- wrap: null,
32
- initCallback: null,
33
- setupCallback: null,
34
- reloadCallback: null,
35
- itemLoadCallback: null,
36
- itemFirstInCallback: null,
37
- itemFirstOutCallback: null,
38
- itemLastInCallback: null,
39
- itemLastOutCallback: null,
40
- itemVisibleInCallback: null,
41
- itemVisibleOutCallback: null,
42
- animationStepCallback: null,
43
- buttonNextHTML: '<div></div>',
44
- buttonPrevHTML: '<div></div>',
45
- buttonNextEvent: 'click',
46
- buttonPrevEvent: 'click',
47
- buttonNextCallback: null,
48
- buttonPrevCallback: null,
49
- itemFallbackDimension: null
50
- }, windowLoaded = false;
51
-
52
- $(window).bind('load.jcarousel', function() { windowLoaded = true; });
53
-
54
- /**
55
- * The jCarousel object.
56
- *
57
- * @constructor
58
- * @class jcarousel
59
- * @param e {HTMLElement} The element to create the carousel for.
60
- * @param o {Object} A set of key/value pairs to set as configuration properties.
61
- * @cat Plugins/jCarousel
62
- */
63
- $.jcarousel = function(e, o) {
64
- this.options = $.extend({}, defaults, o || {});
65
-
66
- this.locked = false;
67
- this.autoStopped = false;
68
-
69
- this.container = null;
70
- this.clip = null;
71
- this.list = null;
72
- this.buttonNext = null;
73
- this.buttonPrev = null;
74
- this.buttonNextState = null;
75
- this.buttonPrevState = null;
76
-
77
- // Only set if not explicitly passed as option
78
- if (!o || o.rtl === undefined) {
79
- this.options.rtl = ($(e).attr('dir') || $('html').attr('dir') || '').toLowerCase() == 'rtl';
80
- }
81
-
82
- this.wh = !this.options.vertical ? 'width' : 'height';
83
- this.lt = !this.options.vertical ? (this.options.rtl ? 'right' : 'left') : 'top';
84
-
85
- // Extract skin class
86
- var skin = '', split = e.className.split(' ');
87
-
88
- for (var i = 0; i < split.length; i++) {
89
- if (split[i].indexOf('jcarousel-skin') != -1) {
90
- $(e).removeClass(split[i]);
91
- skin = split[i];
92
- break;
93
- }
94
- }
95
-
96
- if (e.nodeName.toUpperCase() == 'UL' || e.nodeName.toUpperCase() == 'OL') {
97
- this.list = $(e);
98
- this.clip = this.list.parents('.jcarousel-clip');
99
- this.container = this.list.parents('.jcarousel-container');
100
- } else {
101
- this.container = $(e);
102
- this.list = this.container.find('ul,ol').eq(0);
103
- this.clip = this.container.find('.jcarousel-clip');
104
- }
105
-
106
- if (this.clip.size() === 0) {
107
- this.clip = this.list.wrap('<div></div>').parent();
108
- }
109
-
110
- if (this.container.size() === 0) {
111
- this.container = this.clip.wrap('<div></div>').parent();
112
- }
113
-
114
- if (skin !== '' && this.container.parent()[0].className.indexOf('jcarousel-skin') == -1) {
115
- this.container.wrap('<div class=" '+ skin + '"></div>');
116
- }
117
-
118
- this.buttonPrev = $('.jcarousel-prev', this.container);
119
-
120
- if (this.buttonPrev.size() === 0 && this.options.buttonPrevHTML !== null) {
121
- this.buttonPrev = $(this.options.buttonPrevHTML).appendTo(this.container);
122
- }
123
-
124
- this.buttonPrev.addClass(this.className('jcarousel-prev'));
125
-
126
- this.buttonNext = $('.jcarousel-next', this.container);
127
-
128
- if (this.buttonNext.size() === 0 && this.options.buttonNextHTML !== null) {
129
- this.buttonNext = $(this.options.buttonNextHTML).appendTo(this.container);
130
- }
131
-
132
- this.buttonNext.addClass(this.className('jcarousel-next'));
133
-
134
- this.clip.addClass(this.className('jcarousel-clip')).css({
135
- position: 'relative'
136
- });
137
-
138
- this.list.addClass(this.className('jcarousel-list')).css({
139
- overflow: 'hidden',
140
- position: 'relative',
141
- top: 0,
142
- margin: 0,
143
- padding: 0
144
- }).css((this.options.rtl ? 'right' : 'left'), 0);
145
-
146
- this.container.addClass(this.className('jcarousel-container')).css({
147
- position: 'relative'
148
- });
149
-
150
- if (!this.options.vertical && this.options.rtl) {
151
- this.container.addClass('jcarousel-direction-rtl').attr('dir', 'rtl');
152
- }
153
-
154
- var di = this.options.visible !== null ? Math.ceil(this.clipping() / this.options.visible) : null;
155
- var li = this.list.children('li');
156
-
157
- var self = this;
158
-
159
- if (li.size() > 0) {
160
- var wh = 0, j = this.options.offset;
161
- li.each(function() {
162
- self.format(this, j++);
163
- wh += self.dimension(this, di);
164
- });
165
-
166
- this.list.css(this.wh, (wh + 100) + 'px');
167
-
168
- // Only set if not explicitly passed as option
169
- if (!o || o.size === undefined) {
170
- this.options.size = li.size();
171
- }
172
- }
173
-
174
- // For whatever reason, .show() does not work in Safari...
175
- this.container.css('display', 'block');
176
- this.buttonNext.css('display', 'block');
177
- this.buttonPrev.css('display', 'block');
178
-
179
- this.funcNext = function() { self.next(); };
180
- this.funcPrev = function() { self.prev(); };
181
- this.funcResize = function() {
182
- if (self.resizeTimer) {
183
- clearTimeout(self.resizeTimer);
184
- }
185
-
186
- self.resizeTimer = setTimeout(function() {
187
- self.reload();
188
- }, 100);
189
- };
190
-
191
- if (this.options.initCallback !== null) {
192
- this.options.initCallback(this, 'init');
193
- }
194
-
195
- if (!windowLoaded && $.browser.safari) {
196
- this.buttons(false, false);
197
- $(window).bind('load.jcarousel', function() { self.setup(); });
198
- } else {
199
- this.setup();
200
- }
201
- };
202
-
203
- // Create shortcut for internal use
204
- var $jc = $.jcarousel;
205
-
206
- $jc.fn = $jc.prototype = {
207
- jcarousel: '0.2.8'
208
- };
209
-
210
- $jc.fn.extend = $jc.extend = $.extend;
211
-
212
- $jc.fn.extend({
213
- /**
214
- * Setups the carousel.
215
- *
216
- * @method setup
217
- * @return undefined
218
- */
219
- setup: function() {
220
- this.first = null;
221
- this.last = null;
222
- this.prevFirst = null;
223
- this.prevLast = null;
224
- this.animating = false;
225
- this.timer = null;
226
- this.resizeTimer = null;
227
- this.tail = null;
228
- this.inTail = false;
229
-
230
- if (this.locked) {
231
- return;
232
- }
233
-
234
- this.list.css(this.lt, this.pos(this.options.offset) + 'px');
235
- var p = this.pos(this.options.start, true);
236
- this.prevFirst = this.prevLast = null;
237
- this.animate(p, false);
238
-
239
- $(window).unbind('resize.jcarousel', this.funcResize).bind('resize.jcarousel', this.funcResize);
240
-
241
- if (this.options.setupCallback !== null) {
242
- this.options.setupCallback(this);
243
- }
244
- },
245
-
246
- /**
247
- * Clears the list and resets the carousel.
248
- *
249
- * @method reset
250
- * @return undefined
251
- */
252
- reset: function() {
253
- this.list.empty();
254
-
255
- this.list.css(this.lt, '0px');
256
- this.list.css(this.wh, '10px');
257
-
258
- if (this.options.initCallback !== null) {
259
- this.options.initCallback(this, 'reset');
260
- }
261
-
262
- this.setup();
263
- },
264
-
265
- /**
266
- * Reloads the carousel and adjusts positions.
267
- *
268
- * @method reload
269
- * @return undefined
270
- */
271
- reload: function() {
272
- if (this.tail !== null && this.inTail) {
273
- this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + this.tail);
274
- }
275
-
276
- this.tail = null;
277
- this.inTail = false;
278
-
279
- if (this.options.reloadCallback !== null) {
280
- this.options.reloadCallback(this);
281
- }
282
-
283
- if (this.options.visible !== null) {
284
- var self = this;
285
- var di = Math.ceil(this.clipping() / this.options.visible), wh = 0, lt = 0;
286
- this.list.children('li').each(function(i) {
287
- wh += self.dimension(this, di);
288
- if (i + 1 < self.first) {
289
- lt = wh;
290
- }
291
- });
292
-
293
- this.list.css(this.wh, wh + 'px');
294
- this.list.css(this.lt, -lt + 'px');
295
- }
296
-
297
- this.scroll(this.first, false);
298
- },
299
-
300
- /**
301
- * Locks the carousel.
302
- *
303
- * @method lock
304
- * @return undefined
305
- */
306
- lock: function() {
307
- this.locked = true;
308
- this.buttons();
309
- },
310
-
311
- /**
312
- * Unlocks the carousel.
313
- *
314
- * @method unlock
315
- * @return undefined
316
- */
317
- unlock: function() {
318
- this.locked = false;
319
- this.buttons();
320
- },
321
-
322
- /**
323
- * Sets the size of the carousel.
324
- *
325
- * @method size
326
- * @return undefined
327
- * @param s {Number} The size of the carousel.
328
- */
329
- size: function(s) {
330
- if (s !== undefined) {
331
- this.options.size = s;
332
- if (!this.locked) {
333
- this.buttons();
334
- }
335
- }
336
-
337
- return this.options.size;
338
- },
339
-
340
- /**
341
- * Checks whether a list element exists for the given index (or index range).
342
- *
343
- * @method get
344
- * @return bool
345
- * @param i {Number} The index of the (first) element.
346
- * @param i2 {Number} The index of the last element.
347
- */
348
- has: function(i, i2) {
349
- if (i2 === undefined || !i2) {
350
- i2 = i;
351
- }
352
-
353
- if (this.options.size !== null && i2 > this.options.size) {
354
- i2 = this.options.size;
355
- }
356
-
357
- for (var j = i; j <= i2; j++) {
358
- var e = this.get(j);
359
- if (!e.length || e.hasClass('jcarousel-item-placeholder')) {
360
- return false;
361
- }
362
- }
363
-
364
- return true;
365
- },
366
-
367
- /**
368
- * Returns a jQuery object with list element for the given index.
369
- *
370
- * @method get
371
- * @return jQuery
372
- * @param i {Number} The index of the element.
373
- */
374
- get: function(i) {
375
- return $('>.jcarousel-item-' + i, this.list);
376
- },
377
-
378
- /**
379
- * Adds an element for the given index to the list.
380
- * If the element already exists, it updates the inner html.
381
- * Returns the created element as jQuery object.
382
- *
383
- * @method add
384
- * @return jQuery
385
- * @param i {Number} The index of the element.
386
- * @param s {String} The innerHTML of the element.
387
- */
388
- add: function(i, s) {
389
- var e = this.get(i), old = 0, n = $(s);
390
-
391
- if (e.length === 0) {
392
- var c, j = $jc.intval(i);
393
- e = this.create(i);
394
- while (true) {
395
- c = this.get(--j);
396
- if (j <= 0 || c.length) {
397
- if (j <= 0) {
398
- this.list.prepend(e);
399
- } else {
400
- c.after(e);
401
- }
402
- break;
403
- }
404
- }
405
- } else {
406
- old = this.dimension(e);
407
- }
408
-
409
- if (n.get(0).nodeName.toUpperCase() == 'LI') {
410
- e.replaceWith(n);
411
- e = n;
412
- } else {
413
- e.empty().append(s);
414
- }
415
-
416
- this.format(e.removeClass(this.className('jcarousel-item-placeholder')), i);
417
-
418
- var di = this.options.visible !== null ? Math.ceil(this.clipping() / this.options.visible) : null;
419
- var wh = this.dimension(e, di) - old;
420
-
421
- if (i > 0 && i < this.first) {
422
- this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - wh + 'px');
423
- }
424
-
425
- this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) + wh + 'px');
426
-
427
- return e;
428
- },
429
-
430
- /**
431
- * Removes an element for the given index from the list.
432
- *
433
- * @method remove
434
- * @return undefined
435
- * @param i {Number} The index of the element.
436
- */
437
- remove: function(i) {
438
- var e = this.get(i);
439
-
440
- // Check if item exists and is not currently visible
441
- if (!e.length || (i >= this.first && i <= this.last)) {
442
- return;
443
- }
444
-
445
- var d = this.dimension(e);
446
-
447
- if (i < this.first) {
448
- this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + d + 'px');
449
- }
450
-
451
- e.remove();
452
-
453
- this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) - d + 'px');
454
- },
455
-
456
- /**
457
- * Moves the carousel forwards.
458
- *
459
- * @method next
460
- * @return undefined
461
- */
462
- next: function() {
463
- if (this.tail !== null && !this.inTail) {
464
- this.scrollTail(false);
465
- } else {
466
- this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'last') && this.options.size !== null && this.last == this.options.size) ? 1 : this.first + this.options.scroll);
467
- }
468
- },
469
-
470
- /**
471
- * Moves the carousel backwards.
472
- *
473
- * @method prev
474
- * @return undefined
475
- */
476
- prev: function() {
477
- if (this.tail !== null && this.inTail) {
478
- this.scrollTail(true);
479
- } else {
480
- this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'first') && this.options.size !== null && this.first == 1) ? this.options.size : this.first - this.options.scroll);
481
- }
482
- },
483
-
484
- /**
485
- * Scrolls the tail of the carousel.
486
- *
487
- * @method scrollTail
488
- * @return undefined
489
- * @param b {Boolean} Whether scroll the tail back or forward.
490
- */
491
- scrollTail: function(b) {
492
- if (this.locked || this.animating || !this.tail) {
493
- return;
494
- }
495
-
496
- this.pauseAuto();
497
-
498
- var pos = $jc.intval(this.list.css(this.lt));
499
-
500
- pos = !b ? pos - this.tail : pos + this.tail;
501
- this.inTail = !b;
502
-
503
- // Save for callbacks
504
- this.prevFirst = this.first;
505
- this.prevLast = this.last;
506
-
507
- this.animate(pos);
508
- },
509
-
510
- /**
511
- * Scrolls the carousel to a certain position.
512
- *
513
- * @method scroll
514
- * @return undefined
515
- * @param i {Number} The index of the element to scoll to.
516
- * @param a {Boolean} Flag indicating whether to perform animation.
517
- */
518
- scroll: function(i, a) {
519
- if (this.locked || this.animating) {
520
- return;
521
- }
522
-
523
- this.pauseAuto();
524
- this.animate(this.pos(i), a);
525
- },
526
-
527
- /**
528
- * Prepares the carousel and return the position for a certian index.
529
- *
530
- * @method pos
531
- * @return {Number}
532
- * @param i {Number} The index of the element to scoll to.
533
- * @param fv {Boolean} Whether to force last item to be visible.
534
- */
535
- pos: function(i, fv) {
536
- var pos = $jc.intval(this.list.css(this.lt));
537
-
538
- if (this.locked || this.animating) {
539
- return pos;
540
- }
541
-
542
- if (this.options.wrap != 'circular') {
543
- i = i < 1 ? 1 : (this.options.size && i > this.options.size ? this.options.size : i);
544
- }
545
-
546
- var back = this.first > i;
547
-
548
- // Create placeholders, new list width/height
549
- // and new list position
550
- var f = this.options.wrap != 'circular' && this.first <= 1 ? 1 : this.first;
551
- var c = back ? this.get(f) : this.get(this.last);
552
- var j = back ? f : f - 1;
553
- var e = null, l = 0, p = false, d = 0, g;
554
-
555
- while (back ? --j >= i : ++j < i) {
556
- e = this.get(j);
557
- p = !e.length;
558
- if (e.length === 0) {
559
- e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
560
- c[back ? 'before' : 'after' ](e);
561
-
562
- if (this.first !== null && this.options.wrap == 'circular' && this.options.size !== null && (j <= 0 || j > this.options.size)) {
563
- g = this.get(this.index(j));
564
- if (g.length) {
565
- e = this.add(j, g.clone(true));
566
- }
567
- }
568
- }
569
-
570
- c = e;
571
- d = this.dimension(e);
572
-
573
- if (p) {
574
- l += d;
575
- }
576
-
577
- if (this.first !== null && (this.options.wrap == 'circular' || (j >= 1 && (this.options.size === null || j <= this.options.size)))) {
578
- pos = back ? pos + d : pos - d;
579
- }
580
- }
581
-
582
- // Calculate visible items
583
- var clipping = this.clipping(), cache = [], visible = 0, v = 0;
584
- c = this.get(i - 1);
585
- j = i;
586
-
587
- while (++visible) {
588
- e = this.get(j);
589
- p = !e.length;
590
- if (e.length === 0) {
591
- e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
592
- // This should only happen on a next scroll
593
- if (c.length === 0) {
594
- this.list.prepend(e);
595
- } else {
596
- c[back ? 'before' : 'after' ](e);
597
- }
598
-
599
- if (this.first !== null && this.options.wrap == 'circular' && this.options.size !== null && (j <= 0 || j > this.options.size)) {
600
- g = this.get(this.index(j));
601
- if (g.length) {
602
- e = this.add(j, g.clone(true));
603
- }
604
- }
605
- }
606
-
607
- c = e;
608
- d = this.dimension(e);
609
- if (d === 0) {
610
- throw new Error('jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...');
611
- }
612
-
613
- if (this.options.wrap != 'circular' && this.options.size !== null && j > this.options.size) {
614
- cache.push(e);
615
- } else if (p) {
616
- l += d;
617
- }
618
-
619
- v += d;
620
-
621
- if (v >= clipping) {
622
- break;
623
- }
624
-
625
- j++;
626
- }
627
-
628
- // Remove out-of-range placeholders
629
- for (var x = 0; x < cache.length; x++) {
630
- cache[x].remove();
631
- }
632
-
633
- // Resize list
634
- if (l > 0) {
635
- this.list.css(this.wh, this.dimension(this.list) + l + 'px');
636
-
637
- if (back) {
638
- pos -= l;
639
- this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - l + 'px');
640
- }
641
- }
642
-
643
- // Calculate first and last item
644
- var last = i + visible - 1;
645
- if (this.options.wrap != 'circular' && this.options.size && last > this.options.size) {
646
- last = this.options.size;
647
- }
648
-
649
- if (j > last) {
650
- visible = 0;
651
- j = last;
652
- v = 0;
653
- while (++visible) {
654
- e = this.get(j--);
655
- if (!e.length) {
656
- break;
657
- }
658
- v += this.dimension(e);
659
- if (v >= clipping) {
660
- break;
661
- }
662
- }
663
- }
664
-
665
- var first = last - visible + 1;
666
- if (this.options.wrap != 'circular' && first < 1) {
667
- first = 1;
668
- }
669
-
670
- if (this.inTail && back) {
671
- pos += this.tail;
672
- this.inTail = false;
673
- }
674
-
675
- this.tail = null;
676
- if (this.options.wrap != 'circular' && last == this.options.size && (last - visible + 1) >= 1) {
677
- var m = $jc.intval(this.get(last).css(!this.options.vertical ? 'marginRight' : 'marginBottom'));
678
- if ((v - m) > clipping) {
679
- this.tail = v - clipping - m;
680
- }
681
- }
682
-
683
- if (fv && i === this.options.size && this.tail) {
684
- pos -= this.tail;
685
- this.inTail = true;
686
- }
687
-
688
- // Adjust position
689
- while (i-- > first) {
690
- pos += this.dimension(this.get(i));
691
- }
692
-
693
- // Save visible item range
694
- this.prevFirst = this.first;
695
- this.prevLast = this.last;
696
- this.first = first;
697
- this.last = last;
698
-
699
- return pos;
700
- },
701
-
702
- /**
703
- * Animates the carousel to a certain position.
704
- *
705
- * @method animate
706
- * @return undefined
707
- * @param p {Number} Position to scroll to.
708
- * @param a {Boolean} Flag indicating whether to perform animation.
709
- */
710
- animate: function(p, a) {
711
- if (this.locked || this.animating) {
712
- return;
713
- }
714
-
715
- this.animating = true;
716
-
717
- var self = this;
718
- var scrolled = function() {
719
- self.animating = false;
720
-
721
- if (p === 0) {
722
- self.list.css(self.lt, 0);
723
- }
724
-
725
- if (!self.autoStopped && (self.options.wrap == 'circular' || self.options.wrap == 'both' || self.options.wrap == 'last' || self.options.size === null || self.last < self.options.size || (self.last == self.options.size && self.tail !== null && !self.inTail))) {
726
- self.startAuto();
727
- }
728
-
729
- self.buttons();
730
- self.notify('onAfterAnimation');
731
-
732
- // This function removes items which are appended automatically for circulation.
733
- // This prevents the list from growing infinitely.
734
- if (self.options.wrap == 'circular' && self.options.size !== null) {
735
- for (var i = self.prevFirst; i <= self.prevLast; i++) {
736
- if (i !== null && !(i >= self.first && i <= self.last) && (i < 1 || i > self.options.size)) {
737
- self.remove(i);
738
- }
739
- }
740
- }
741
- };
742
-
743
- this.notify('onBeforeAnimation');
744
-
745
- // Animate
746
- if (!this.options.animation || a === false) {
747
- this.list.css(this.lt, p + 'px');
748
- scrolled();
749
- } else {
750
- var o = !this.options.vertical ? (this.options.rtl ? {'right': p} : {'left': p}) : {'top': p};
751
- // Define animation settings.
752
- var settings = {
753
- duration: this.options.animation,
754
- easing: this.options.easing,
755
- complete: scrolled
756
- };
757
- // If we have a step callback, specify it as well.
758
- if ($.isFunction(this.options.animationStepCallback)) {
759
- settings.step = this.options.animationStepCallback;
760
- }
761
- // Start the animation.
762
- this.list.animate(o, settings);
763
- }
764
- },
765
-
766
- /**
767
- * Starts autoscrolling.
768
- *
769
- * @method auto
770
- * @return undefined
771
- * @param s {Number} Seconds to periodically autoscroll the content.
772
- */
773
- startAuto: function(s) {
774
- if (s !== undefined) {
775
- this.options.auto = s;
776
- }
777
-
778
- if (this.options.auto === 0) {
779
- return this.stopAuto();
780
- }
781
-
782
- if (this.timer !== null) {
783
- return;
784
- }
785
-
786
- this.autoStopped = false;
787
-
788
- var self = this;
789
- this.timer = window.setTimeout(function() { self.next(); }, this.options.auto * 1000);
790
- },
791
-
792
- /**
793
- * Stops autoscrolling.
794
- *
795
- * @method stopAuto
796
- * @return undefined
797
- */
798
- stopAuto: function() {
799
- this.pauseAuto();
800
- this.autoStopped = true;
801
- },
802
-
803
- /**
804
- * Pauses autoscrolling.
805
- *
806
- * @method pauseAuto
807
- * @return undefined
808
- */
809
- pauseAuto: function() {
810
- if (this.timer === null) {
811
- return;
812
- }
813
-
814
- window.clearTimeout(this.timer);
815
- this.timer = null;
816
- },
817
-
818
- /**
819
- * Sets the states of the prev/next buttons.
820
- *
821
- * @method buttons
822
- * @return undefined
823
- */
824
- buttons: function(n, p) {
825
- if (n == null) {
826
- n = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'first') || this.options.size === null || this.last < this.options.size);
827
- if (!this.locked && (!this.options.wrap || this.options.wrap == 'first') && this.options.size !== null && this.last >= this.options.size) {
828
- n = this.tail !== null && !this.inTail;
829
- }
830
- }
831
-
832
- if (p == null) {
833
- p = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'last') || this.first > 1);
834
- if (!this.locked && (!this.options.wrap || this.options.wrap == 'last') && this.options.size !== null && this.first == 1) {
835
- p = this.tail !== null && this.inTail;
836
- }
837
- }
838
-
839
- var self = this;
840
-
841
- if (this.buttonNext.size() > 0) {
842
- this.buttonNext.unbind(this.options.buttonNextEvent + '.jcarousel', this.funcNext);
843
-
844
- if (n) {
845
- this.buttonNext.bind(this.options.buttonNextEvent + '.jcarousel', this.funcNext);
846
- }
847
-
848
- this.buttonNext[n ? 'removeClass' : 'addClass'](this.className('jcarousel-next-disabled')).attr('disabled', n ? false : true);
849
-
850
- if (this.options.buttonNextCallback !== null && this.buttonNext.data('jcarouselstate') != n) {
851
- this.buttonNext.each(function() { self.options.buttonNextCallback(self, this, n); }).data('jcarouselstate', n);
852
- }
853
- } else {
854
- if (this.options.buttonNextCallback !== null && this.buttonNextState != n) {
855
- this.options.buttonNextCallback(self, null, n);
856
- }
857
- }
858
-
859
- if (this.buttonPrev.size() > 0) {
860
- this.buttonPrev.unbind(this.options.buttonPrevEvent + '.jcarousel', this.funcPrev);
861
-
862
- if (p) {
863
- this.buttonPrev.bind(this.options.buttonPrevEvent + '.jcarousel', this.funcPrev);
864
- }
865
-
866
- this.buttonPrev[p ? 'removeClass' : 'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled', p ? false : true);
867
-
868
- if (this.options.buttonPrevCallback !== null && this.buttonPrev.data('jcarouselstate') != p) {
869
- this.buttonPrev.each(function() { self.options.buttonPrevCallback(self, this, p); }).data('jcarouselstate', p);
870
- }
871
- } else {
872
- if (this.options.buttonPrevCallback !== null && this.buttonPrevState != p) {
873
- this.options.buttonPrevCallback(self, null, p);
874
- }
875
- }
876
-
877
- this.buttonNextState = n;
878
- this.buttonPrevState = p;
879
- },
880
-
881
- /**
882
- * Notify callback of a specified event.
883
- *
884
- * @method notify
885
- * @return undefined
886
- * @param evt {String} The event name
887
- */
888
- notify: function(evt) {
889
- var state = this.prevFirst === null ? 'init' : (this.prevFirst < this.first ? 'next' : 'prev');
890
-
891
- // Load items
892
- this.callback('itemLoadCallback', evt, state);
893
-
894
- if (this.prevFirst !== this.first) {
895
- this.callback('itemFirstInCallback', evt, state, this.first);
896
- this.callback('itemFirstOutCallback', evt, state, this.prevFirst);
897
- }
898
-
899
- if (this.prevLast !== this.last) {
900
- this.callback('itemLastInCallback', evt, state, this.last);
901
- this.callback('itemLastOutCallback', evt, state, this.prevLast);
902
- }
903
-
904
- this.callback('itemVisibleInCallback', evt, state, this.first, this.last, this.prevFirst, this.prevLast);
905
- this.callback('itemVisibleOutCallback', evt, state, this.prevFirst, this.prevLast, this.first, this.last);
906
- },
907
-
908
- callback: function(cb, evt, state, i1, i2, i3, i4) {
909
- if (this.options[cb] == null || (typeof this.options[cb] != 'object' && evt != 'onAfterAnimation')) {
910
- return;
911
- }
912
-
913
- var callback = typeof this.options[cb] == 'object' ? this.options[cb][evt] : this.options[cb];
914
-
915
- if (!$.isFunction(callback)) {
916
- return;
917
- }
918
-
919
- var self = this;
920
-
921
- if (i1 === undefined) {
922
- callback(self, state, evt);
923
- } else if (i2 === undefined) {
924
- this.get(i1).each(function() { callback(self, this, i1, state, evt); });
925
- } else {
926
- var call = function(i) {
927
- self.get(i).each(function() { callback(self, this, i, state, evt); });
928
- };
929
- for (var i = i1; i <= i2; i++) {
930
- if (i !== null && !(i >= i3 && i <= i4)) {
931
- call(i);
932
- }
933
- }
934
- }
935
- },
936
-
937
- create: function(i) {
938
- return this.format('<li></li>', i);
939
- },
940
-
941
- format: function(e, i) {
942
- e = $(e);
943
- var split = e.get(0).className.split(' ');
944
- for (var j = 0; j < split.length; j++) {
945
- if (split[j].indexOf('jcarousel-') != -1) {
946
- e.removeClass(split[j]);
947
- }
948
- }
949
- e.addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-' + i)).css({
950
- 'float': (this.options.rtl ? 'right' : 'left'),
951
- 'list-style': 'none'
952
- }).attr('jcarouselindex', i);
953
- return e;
954
- },
955
-
956
- className: function(c) {
957
- return c + ' ' + c + (!this.options.vertical ? '-horizontal' : '-vertical');
958
- },
959
-
960
- dimension: function(e, d) {
961
- var el = $(e);
962
-
963
- if (d == null) {
964
- return !this.options.vertical ?
965
- (el.outerWidth(true) || $jc.intval(this.options.itemFallbackDimension)) :
966
- (el.outerHeight(true) || $jc.intval(this.options.itemFallbackDimension));
967
- } else {
968
- var w = !this.options.vertical ?
969
- d - $jc.intval(el.css('marginLeft')) - $jc.intval(el.css('marginRight')) :
970
- d - $jc.intval(el.css('marginTop')) - $jc.intval(el.css('marginBottom'));
971
-
972
- $(el).css(this.wh, w + 'px');
973
-
974
- return this.dimension(el);
975
- }
976
- },
977
-
978
- clipping: function() {
979
- return !this.options.vertical ?
980
- this.clip[0].offsetWidth - $jc.intval(this.clip.css('borderLeftWidth')) - $jc.intval(this.clip.css('borderRightWidth')) :
981
- this.clip[0].offsetHeight - $jc.intval(this.clip.css('borderTopWidth')) - $jc.intval(this.clip.css('borderBottomWidth'));
982
- },
983
-
984
- index: function(i, s) {
985
- if (s == null) {
986
- s = this.options.size;
987
- }
988
-
989
- return Math.round((((i-1) / s) - Math.floor((i-1) / s)) * s) + 1;
990
- }
991
- });
992
-
993
- $jc.extend({
994
- /**
995
- * Gets/Sets the global default configuration properties.
996
- *
997
- * @method defaults
998
- * @return {Object}
999
- * @param d {Object} A set of key/value pairs to set as configuration properties.
1000
- */
1001
- defaults: function(d) {
1002
- return $.extend(defaults, d || {});
1003
- },
1004
-
1005
- intval: function(v) {
1006
- v = parseInt(v, 10);
1007
- return isNaN(v) ? 0 : v;
1008
- },
1009
-
1010
- windowLoaded: function() {
1011
- windowLoaded = true;
1012
- }
1013
- });
1014
-
1015
- /**
1016
- * Creates a carousel for all matched elements.
1017
- *
1018
- * @example $("#mycarousel").jcarousel();
1019
- * @before <ul id="mycarousel" class="jcarousel-skin-name"><li>First item</li><li>Second item</li></ul>
1020
- * @result
1021
- *
1022
- * <div class="jcarousel-skin-name">
1023
- * <div class="jcarousel-container">
1024
- * <div class="jcarousel-clip">
1025
- * <ul class="jcarousel-list">
1026
- * <li class="jcarousel-item-1">First item</li>
1027
- * <li class="jcarousel-item-2">Second item</li>
1028
- * </ul>
1029
- * </div>
1030
- * <div disabled="disabled" class="jcarousel-prev jcarousel-prev-disabled"></div>
1031
- * <div class="jcarousel-next"></div>
1032
- * </div>
1033
- * </div>
1034
- *
1035
- * @method jcarousel
1036
- * @return jQuery
1037
- * @param o {Hash|String} A set of key/value pairs to set as configuration properties or a method name to call on a formerly created instance.
1038
- */
1039
- $.fn.jcarousel = function(o) {
1040
- if (typeof o == 'string') {
1041
- var instance = $(this).data('jcarousel'), args = Array.prototype.slice.call(arguments, 1);
1042
- return instance[o].apply(instance, args);
1043
- } else {
1044
- return this.each(function() {
1045
- var instance = $(this).data('jcarousel');
1046
- if (instance) {
1047
- if (o) {
1048
- $.extend(instance.options, o);
1049
- }
1050
- instance.reload();
1051
- } else {
1052
- $(this).data('jcarousel', new $jc(this, o));
1053
- }
1054
- });
1055
- }
1056
- };
1057
-
1058
- })(jQuery);