active_scaffold 3.2.17 → 3.2.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. data/CHANGELOG +5 -1
  2. metadata +17 -261
  3. data/app/assets/images/active_scaffold/add.png +0 -0
  4. data/app/assets/images/active_scaffold/arrow_down.png +0 -0
  5. data/app/assets/images/active_scaffold/arrow_up.png +0 -0
  6. data/app/assets/images/active_scaffold/close.png +0 -0
  7. data/app/assets/images/active_scaffold/close_touch.png +0 -0
  8. data/app/assets/images/active_scaffold/config.png +0 -0
  9. data/app/assets/images/active_scaffold/cross.png +0 -0
  10. data/app/assets/images/active_scaffold/gears.png +0 -0
  11. data/app/assets/images/active_scaffold/indicator-small.gif +0 -0
  12. data/app/assets/images/active_scaffold/indicator.gif +0 -0
  13. data/app/assets/images/active_scaffold/magnifier.png +0 -0
  14. data/app/assets/javascripts/active_scaffold.js.erb +0 -19
  15. data/app/assets/javascripts/jquery/active_scaffold.js +0 -1113
  16. data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +0 -24
  17. data/app/assets/javascripts/jquery/draggable_lists.js +0 -27
  18. data/app/assets/javascripts/jquery/jquery.editinplace.js +0 -743
  19. data/app/assets/javascripts/jquery/tiny_mce_bridge.js +0 -7
  20. data/app/assets/javascripts/prototype/active_scaffold.js +0 -1107
  21. data/app/assets/javascripts/prototype/dhtml_history.js +0 -870
  22. data/app/assets/javascripts/prototype/form_enhancements.js +0 -117
  23. data/app/assets/javascripts/prototype/rico_corner.js +0 -370
  24. data/app/assets/javascripts/prototype/tiny_mce_bridge.js +0 -7
  25. data/app/assets/stylesheets/active_scaffold-ie.css.scss +0 -54
  26. data/app/assets/stylesheets/active_scaffold.css.scss +0 -14
  27. data/app/assets/stylesheets/active_scaffold_colors.css.scss +0 -395
  28. data/app/assets/stylesheets/active_scaffold_extensions.css.erb +0 -2
  29. data/app/assets/stylesheets/active_scaffold_images.css.scss +0 -40
  30. data/app/assets/stylesheets/active_scaffold_layout.css +0 -936
  31. data/app/assets/stylesheets/blue-theme.css +0 -74
  32. data/config/locales/de.yml +0 -125
  33. data/config/locales/en.yml +0 -127
  34. data/config/locales/es.yml +0 -128
  35. data/config/locales/fr.yml +0 -131
  36. data/config/locales/hu.yml +0 -126
  37. data/config/locales/ja.yml +0 -126
  38. data/config/locales/ru.yml +0 -135
  39. data/frontends/default/views/_action_group.html.erb +0 -24
  40. data/frontends/default/views/_add_existing_form.html.erb +0 -30
  41. data/frontends/default/views/_base_form.html.erb +0 -53
  42. data/frontends/default/views/_create_form.html.erb +0 -8
  43. data/frontends/default/views/_create_form_on_list.html.erb +0 -6
  44. data/frontends/default/views/_field_search.html.erb +0 -32
  45. data/frontends/default/views/_form.html.erb +0 -28
  46. data/frontends/default/views/_form_association.html.erb +0 -17
  47. data/frontends/default/views/_form_association_footer.html.erb +0 -47
  48. data/frontends/default/views/_form_attribute.html.erb +0 -23
  49. data/frontends/default/views/_form_hidden_attribute.html.erb +0 -7
  50. data/frontends/default/views/_form_messages.html.erb +0 -5
  51. data/frontends/default/views/_horizontal_subform.html.erb +0 -22
  52. data/frontends/default/views/_horizontal_subform_footer.html.erb +0 -0
  53. data/frontends/default/views/_horizontal_subform_header.html.erb +0 -11
  54. data/frontends/default/views/_horizontal_subform_record.html.erb +0 -43
  55. data/frontends/default/views/_human_conditions.html.erb +0 -1
  56. data/frontends/default/views/_list.html.erb +0 -18
  57. data/frontends/default/views/_list_actions.html.erb +0 -15
  58. data/frontends/default/views/_list_calculations.html.erb +0 -16
  59. data/frontends/default/views/_list_column_headings.html.erb +0 -12
  60. data/frontends/default/views/_list_header.html.erb +0 -10
  61. data/frontends/default/views/_list_inline_adapter.html.erb +0 -21
  62. data/frontends/default/views/_list_messages.html.erb +0 -28
  63. data/frontends/default/views/_list_pagination.html.erb +0 -11
  64. data/frontends/default/views/_list_pagination_links.html.erb +0 -9
  65. data/frontends/default/views/_list_record.html.erb +0 -13
  66. data/frontends/default/views/_list_record_columns.html.erb +0 -8
  67. data/frontends/default/views/_list_with_header.html.erb +0 -36
  68. data/frontends/default/views/_messages.html.erb +0 -10
  69. data/frontends/default/views/_refresh_list.js.erb +0 -1
  70. data/frontends/default/views/_render_field.js.erb +0 -20
  71. data/frontends/default/views/_row.html.erb +0 -1
  72. data/frontends/default/views/_search.html.erb +0 -34
  73. data/frontends/default/views/_search_attribute.html.erb +0 -10
  74. data/frontends/default/views/_show.html.erb +0 -8
  75. data/frontends/default/views/_show_columns.html.erb +0 -15
  76. data/frontends/default/views/_update_actions.html.erb +0 -9
  77. data/frontends/default/views/_update_calculations.js.erb +0 -4
  78. data/frontends/default/views/_update_form.html.erb +0 -6
  79. data/frontends/default/views/_update_messages.js.erb +0 -2
  80. data/frontends/default/views/_vertical_subform.html.erb +0 -12
  81. data/frontends/default/views/_vertical_subform_record.html.erb +0 -43
  82. data/frontends/default/views/action_confirmation.html.erb +0 -13
  83. data/frontends/default/views/add_existing.js.erb +0 -14
  84. data/frontends/default/views/add_existing_form.html.erb +0 -5
  85. data/frontends/default/views/create.html.erb +0 -5
  86. data/frontends/default/views/delete.html.erb +0 -13
  87. data/frontends/default/views/destroy.js.erb +0 -26
  88. data/frontends/default/views/edit_associated.js.erb +0 -12
  89. data/frontends/default/views/field_search.html.erb +0 -5
  90. data/frontends/default/views/form_messages.js.erb +0 -1
  91. data/frontends/default/views/list.html.erb +0 -1
  92. data/frontends/default/views/on_action_update.js.erb +0 -22
  93. data/frontends/default/views/on_create.js.erb +0 -38
  94. data/frontends/default/views/on_mark.js.erb +0 -6
  95. data/frontends/default/views/on_update.js.erb +0 -29
  96. data/frontends/default/views/refresh_list.js.erb +0 -2
  97. data/frontends/default/views/render_field.js.erb +0 -1
  98. data/frontends/default/views/row.js.erb +0 -2
  99. data/frontends/default/views/search.html.erb +0 -5
  100. data/frontends/default/views/show.html.erb +0 -5
  101. data/frontends/default/views/update.html.erb +0 -8
  102. data/frontends/default/views/update_column.js.erb +0 -15
  103. data/frontends/default/views/update_row.js.erb +0 -1
  104. data/lib/active_scaffold.rb +0 -373
  105. data/lib/active_scaffold/actions/common_search.rb +0 -22
  106. data/lib/active_scaffold/actions/core.rb +0 -203
  107. data/lib/active_scaffold/actions/create.rb +0 -139
  108. data/lib/active_scaffold/actions/delete.rb +0 -74
  109. data/lib/active_scaffold/actions/field_search.rb +0 -78
  110. data/lib/active_scaffold/actions/list.rb +0 -208
  111. data/lib/active_scaffold/actions/mark.rb +0 -89
  112. data/lib/active_scaffold/actions/nested.rb +0 -244
  113. data/lib/active_scaffold/actions/search.rb +0 -48
  114. data/lib/active_scaffold/actions/show.rb +0 -61
  115. data/lib/active_scaffold/actions/subform.rb +0 -23
  116. data/lib/active_scaffold/actions/update.rb +0 -156
  117. data/lib/active_scaffold/active_record_permissions.rb +0 -135
  118. data/lib/active_scaffold/attribute_params.rb +0 -200
  119. data/lib/active_scaffold/bridges.rb +0 -61
  120. data/lib/active_scaffold/bridges/ancestry.rb +0 -5
  121. data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +0 -39
  122. data/lib/active_scaffold/bridges/bitfields.rb +0 -6
  123. data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +0 -37
  124. data/lib/active_scaffold/bridges/calendar_date_select.rb +0 -24
  125. data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +0 -66
  126. data/lib/active_scaffold/bridges/cancan.rb +0 -15
  127. data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +0 -127
  128. data/lib/active_scaffold/bridges/carrierwave.rb +0 -12
  129. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +0 -31
  130. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge_helpers.rb +0 -10
  131. data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +0 -45
  132. data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +0 -17
  133. data/lib/active_scaffold/bridges/country_helper.rb +0 -9
  134. data/lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb +0 -358
  135. data/lib/active_scaffold/bridges/date_picker.rb +0 -23
  136. data/lib/active_scaffold/bridges/date_picker/ext.rb +0 -63
  137. data/lib/active_scaffold/bridges/date_picker/helper.rb +0 -180
  138. data/lib/active_scaffold/bridges/dragonfly.rb +0 -9
  139. data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +0 -34
  140. data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge_helpers.rb +0 -10
  141. data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +0 -27
  142. data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +0 -16
  143. data/lib/active_scaffold/bridges/file_column.rb +0 -11
  144. data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +0 -46
  145. data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +0 -57
  146. data/lib/active_scaffold/bridges/file_column/form_ui.rb +0 -34
  147. data/lib/active_scaffold/bridges/file_column/list_ui.rb +0 -26
  148. data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +0 -43
  149. data/lib/active_scaffold/bridges/file_column/test/mock_model.rb +0 -9
  150. data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +0 -15
  151. data/lib/active_scaffold/bridges/paperclip.rb +0 -12
  152. data/lib/active_scaffold/bridges/paperclip/form_ui.rb +0 -27
  153. data/lib/active_scaffold/bridges/paperclip/list_ui.rb +0 -16
  154. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +0 -36
  155. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +0 -24
  156. data/lib/active_scaffold/bridges/record_select.rb +0 -11
  157. data/lib/active_scaffold/bridges/record_select/helpers.rb +0 -92
  158. data/lib/active_scaffold/bridges/semantic_attributes.rb +0 -5
  159. data/lib/active_scaffold/bridges/semantic_attributes/column.rb +0 -20
  160. data/lib/active_scaffold/bridges/shared/date_bridge.rb +0 -209
  161. data/lib/active_scaffold/bridges/tiny_mce.rb +0 -17
  162. data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +0 -46
  163. data/lib/active_scaffold/config/base.rb +0 -75
  164. data/lib/active_scaffold/config/core.rb +0 -236
  165. data/lib/active_scaffold/config/create.rb +0 -32
  166. data/lib/active_scaffold/config/delete.rb +0 -32
  167. data/lib/active_scaffold/config/field_search.rb +0 -79
  168. data/lib/active_scaffold/config/form.rb +0 -64
  169. data/lib/active_scaffold/config/list.rb +0 -247
  170. data/lib/active_scaffold/config/mark.rb +0 -30
  171. data/lib/active_scaffold/config/nested.rb +0 -42
  172. data/lib/active_scaffold/config/search.rb +0 -73
  173. data/lib/active_scaffold/config/show.rb +0 -31
  174. data/lib/active_scaffold/config/subform.rb +0 -35
  175. data/lib/active_scaffold/config/update.rb +0 -33
  176. data/lib/active_scaffold/configurable.rb +0 -29
  177. data/lib/active_scaffold/constraints.rb +0 -171
  178. data/lib/active_scaffold/data_structures/action_columns.rb +0 -142
  179. data/lib/active_scaffold/data_structures/action_link.rb +0 -185
  180. data/lib/active_scaffold/data_structures/action_links.rb +0 -191
  181. data/lib/active_scaffold/data_structures/actions.rb +0 -45
  182. data/lib/active_scaffold/data_structures/bridge.rb +0 -22
  183. data/lib/active_scaffold/data_structures/column.rb +0 -401
  184. data/lib/active_scaffold/data_structures/columns.rb +0 -75
  185. data/lib/active_scaffold/data_structures/error_message.rb +0 -24
  186. data/lib/active_scaffold/data_structures/nested_info.rb +0 -171
  187. data/lib/active_scaffold/data_structures/set.rb +0 -61
  188. data/lib/active_scaffold/data_structures/sorting.rb +0 -167
  189. data/lib/active_scaffold/engine.rb +0 -4
  190. data/lib/active_scaffold/extensions/action_controller_rendering.rb +0 -20
  191. data/lib/active_scaffold/extensions/action_controller_rescueing.rb +0 -7
  192. data/lib/active_scaffold/extensions/action_view_rendering.rb +0 -115
  193. data/lib/active_scaffold/extensions/active_record_offset.rb +0 -12
  194. data/lib/active_scaffold/extensions/array.rb +0 -7
  195. data/lib/active_scaffold/extensions/cache_association.rb +0 -16
  196. data/lib/active_scaffold/extensions/localize.rb +0 -10
  197. data/lib/active_scaffold/extensions/name_option_for_datetime.rb +0 -12
  198. data/lib/active_scaffold/extensions/nil_id_in_url_params.rb +0 -7
  199. data/lib/active_scaffold/extensions/paginator_extensions.rb +0 -26
  200. data/lib/active_scaffold/extensions/reverse_associations.rb +0 -64
  201. data/lib/active_scaffold/extensions/routing_mapper.rb +0 -48
  202. data/lib/active_scaffold/extensions/to_label.rb +0 -8
  203. data/lib/active_scaffold/extensions/unsaved_associated.rb +0 -61
  204. data/lib/active_scaffold/extensions/unsaved_record.rb +0 -20
  205. data/lib/active_scaffold/extensions/usa_state.rb +0 -46
  206. data/lib/active_scaffold/finder.rb +0 -399
  207. data/lib/active_scaffold/helpers/association_helpers.rb +0 -42
  208. data/lib/active_scaffold/helpers/controller_helpers.rb +0 -94
  209. data/lib/active_scaffold/helpers/form_column_helpers.rb +0 -322
  210. data/lib/active_scaffold/helpers/human_condition_helpers.rb +0 -64
  211. data/lib/active_scaffold/helpers/id_helpers.rb +0 -131
  212. data/lib/active_scaffold/helpers/list_column_helpers.rb +0 -374
  213. data/lib/active_scaffold/helpers/pagination_helpers.rb +0 -62
  214. data/lib/active_scaffold/helpers/search_column_helpers.rb +0 -257
  215. data/lib/active_scaffold/helpers/show_column_helpers.rb +0 -44
  216. data/lib/active_scaffold/helpers/view_helpers.rb +0 -398
  217. data/lib/active_scaffold/marked_model.rb +0 -38
  218. data/lib/active_scaffold/paginator.rb +0 -136
  219. data/lib/active_scaffold/responds_to_parent.rb +0 -70
  220. data/lib/active_scaffold/tableless.rb +0 -83
  221. data/lib/active_scaffold/version.rb +0 -9
  222. data/lib/active_scaffold_env.rb +0 -13
  223. data/lib/generators/active_scaffold/USAGE +0 -29
  224. data/lib/generators/active_scaffold/active_scaffold_generator.rb +0 -21
  225. data/lib/generators/active_scaffold_controller/USAGE +0 -19
  226. data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +0 -29
  227. data/lib/generators/active_scaffold_controller/templates/controller.rb +0 -4
  228. data/lib/generators/active_scaffold_controller/templates/helper.rb +0 -2
  229. data/public/blank.html +0 -33
  230. data/shoulda_macros/macros.rb +0 -136
  231. data/vendor/assets/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  232. data/vendor/assets/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  233. data/vendor/assets/images/ui-bg_flat_10_000000_40x100.png +0 -0
  234. data/vendor/assets/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  235. data/vendor/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  236. data/vendor/assets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  237. data/vendor/assets/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  238. data/vendor/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  239. data/vendor/assets/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  240. data/vendor/assets/images/ui-icons_222222_256x240.png +0 -0
  241. data/vendor/assets/images/ui-icons_228ef1_256x240.png +0 -0
  242. data/vendor/assets/images/ui-icons_ef8c08_256x240.png +0 -0
  243. data/vendor/assets/images/ui-icons_ffd27a_256x240.png +0 -0
  244. data/vendor/assets/images/ui-icons_ffffff_256x240.png +0 -0
  245. data/vendor/assets/javascripts/jquery-ui-timepicker-addon.js +0 -1276
  246. data/vendor/assets/stylesheets/jquery-ui.css +0 -568
data/CHANGELOG CHANGED
@@ -1,4 +1,8 @@
1
- = 3.2.17 (not released yet)
1
+ = 3.2.18
2
+ - Fix add existing record with record_select
3
+ - Disable link for polymorphic associations in 3.2.x, it doesn't work
4
+
5
+ = 3.2.17
2
6
  - fix constraints for columns with multiple columns in search_sql
3
7
  - remove unauthorized collection links
4
8
  - copy parameters and html_options on cloning action link
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- hash: 45
4
+ hash: 43
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
- - 17
10
- version: 3.2.17
9
+ - 18
10
+ version: 3.2.18
11
11
  platform: ruby
12
12
  authors:
13
13
  - Many, see README
@@ -15,11 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-12 00:00:00 Z
18
+ date: 2013-01-28 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- type: :development
22
- requirement: &id001 !ruby/object:Gem::Requirement
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
22
  none: false
24
23
  requirements:
25
24
  - - ">="
@@ -28,12 +27,12 @@ dependencies:
28
27
  segments:
29
28
  - 0
30
29
  version: "0"
31
- version_requirements: *id001
32
30
  prerelease: false
31
+ type: :development
32
+ requirement: *id001
33
33
  name: shoulda
34
34
  - !ruby/object:Gem::Dependency
35
- type: :development
36
- requirement: &id002 !ruby/object:Gem::Requirement
35
+ version_requirements: &id002 !ruby/object:Gem::Requirement
37
36
  none: false
38
37
  requirements:
39
38
  - - ~>
@@ -44,12 +43,12 @@ dependencies:
44
43
  - 0
45
44
  - 0
46
45
  version: 1.0.0
47
- version_requirements: *id002
48
46
  prerelease: false
47
+ type: :development
48
+ requirement: *id002
49
49
  name: bundler
50
50
  - !ruby/object:Gem::Dependency
51
- type: :development
52
- requirement: &id003 !ruby/object:Gem::Requirement
51
+ version_requirements: &id003 !ruby/object:Gem::Requirement
53
52
  none: false
54
53
  requirements:
55
54
  - - ">="
@@ -58,12 +57,12 @@ dependencies:
58
57
  segments:
59
58
  - 0
60
59
  version: "0"
61
- version_requirements: *id003
62
60
  prerelease: false
61
+ type: :development
62
+ requirement: *id003
63
63
  name: rcov
64
64
  - !ruby/object:Gem::Dependency
65
- type: :runtime
66
- requirement: &id004 !ruby/object:Gem::Requirement
65
+ version_requirements: &id004 !ruby/object:Gem::Requirement
67
66
  none: false
68
67
  requirements:
69
68
  - - ">="
@@ -74,8 +73,9 @@ dependencies:
74
73
  - 1
75
74
  - 3
76
75
  version: 3.1.3
77
- version_requirements: *id004
78
76
  prerelease: false
77
+ type: :runtime
78
+ requirement: *id004
79
79
  name: rails
80
80
  description: Save time and headaches, and create a more easily maintainable set of pages, with ActiveScaffold. ActiveScaffold handles all your CRUD (create, read, update, delete) user interface needs, leaving you more time to focus on more challenging (and interesting!) problems.
81
81
  email: activescaffold@googlegroups.com
@@ -86,250 +86,6 @@ extensions: []
86
86
  extra_rdoc_files:
87
87
  - README
88
88
  files:
89
- - app/assets/images/active_scaffold/add.png
90
- - app/assets/images/active_scaffold/arrow_down.png
91
- - app/assets/images/active_scaffold/arrow_up.png
92
- - app/assets/images/active_scaffold/close.png
93
- - app/assets/images/active_scaffold/close_touch.png
94
- - app/assets/images/active_scaffold/config.png
95
- - app/assets/images/active_scaffold/cross.png
96
- - app/assets/images/active_scaffold/gears.png
97
- - app/assets/images/active_scaffold/indicator-small.gif
98
- - app/assets/images/active_scaffold/indicator.gif
99
- - app/assets/images/active_scaffold/magnifier.png
100
- - app/assets/javascripts/active_scaffold.js.erb
101
- - app/assets/javascripts/jquery/active_scaffold.js
102
- - app/assets/javascripts/jquery/date_picker_bridge.js.erb
103
- - app/assets/javascripts/jquery/draggable_lists.js
104
- - app/assets/javascripts/jquery/jquery.editinplace.js
105
- - app/assets/javascripts/jquery/tiny_mce_bridge.js
106
- - app/assets/javascripts/prototype/active_scaffold.js
107
- - app/assets/javascripts/prototype/dhtml_history.js
108
- - app/assets/javascripts/prototype/form_enhancements.js
109
- - app/assets/javascripts/prototype/rico_corner.js
110
- - app/assets/javascripts/prototype/tiny_mce_bridge.js
111
- - app/assets/stylesheets/active_scaffold-ie.css.scss
112
- - app/assets/stylesheets/active_scaffold.css.scss
113
- - app/assets/stylesheets/active_scaffold_colors.css.scss
114
- - app/assets/stylesheets/active_scaffold_extensions.css.erb
115
- - app/assets/stylesheets/active_scaffold_images.css.scss
116
- - app/assets/stylesheets/active_scaffold_layout.css
117
- - app/assets/stylesheets/blue-theme.css
118
- - config/locales/de.yml
119
- - config/locales/en.yml
120
- - config/locales/es.yml
121
- - config/locales/fr.yml
122
- - config/locales/hu.yml
123
- - config/locales/ja.yml
124
- - config/locales/ru.yml
125
- - frontends/default/views/_action_group.html.erb
126
- - frontends/default/views/_add_existing_form.html.erb
127
- - frontends/default/views/_base_form.html.erb
128
- - frontends/default/views/_create_form.html.erb
129
- - frontends/default/views/_create_form_on_list.html.erb
130
- - frontends/default/views/_field_search.html.erb
131
- - frontends/default/views/_form.html.erb
132
- - frontends/default/views/_form_association.html.erb
133
- - frontends/default/views/_form_association_footer.html.erb
134
- - frontends/default/views/_form_attribute.html.erb
135
- - frontends/default/views/_form_hidden_attribute.html.erb
136
- - frontends/default/views/_form_messages.html.erb
137
- - frontends/default/views/_horizontal_subform.html.erb
138
- - frontends/default/views/_horizontal_subform_footer.html.erb
139
- - frontends/default/views/_horizontal_subform_header.html.erb
140
- - frontends/default/views/_horizontal_subform_record.html.erb
141
- - frontends/default/views/_human_conditions.html.erb
142
- - frontends/default/views/_list.html.erb
143
- - frontends/default/views/_list_actions.html.erb
144
- - frontends/default/views/_list_calculations.html.erb
145
- - frontends/default/views/_list_column_headings.html.erb
146
- - frontends/default/views/_list_header.html.erb
147
- - frontends/default/views/_list_inline_adapter.html.erb
148
- - frontends/default/views/_list_messages.html.erb
149
- - frontends/default/views/_list_pagination.html.erb
150
- - frontends/default/views/_list_pagination_links.html.erb
151
- - frontends/default/views/_list_record.html.erb
152
- - frontends/default/views/_list_record_columns.html.erb
153
- - frontends/default/views/_list_with_header.html.erb
154
- - frontends/default/views/_messages.html.erb
155
- - frontends/default/views/_refresh_list.js.erb
156
- - frontends/default/views/_render_field.js.erb
157
- - frontends/default/views/_row.html.erb
158
- - frontends/default/views/_search.html.erb
159
- - frontends/default/views/_search_attribute.html.erb
160
- - frontends/default/views/_show.html.erb
161
- - frontends/default/views/_show_columns.html.erb
162
- - frontends/default/views/_update_actions.html.erb
163
- - frontends/default/views/_update_calculations.js.erb
164
- - frontends/default/views/_update_form.html.erb
165
- - frontends/default/views/_update_messages.js.erb
166
- - frontends/default/views/_vertical_subform.html.erb
167
- - frontends/default/views/_vertical_subform_record.html.erb
168
- - frontends/default/views/action_confirmation.html.erb
169
- - frontends/default/views/add_existing.js.erb
170
- - frontends/default/views/add_existing_form.html.erb
171
- - frontends/default/views/create.html.erb
172
- - frontends/default/views/delete.html.erb
173
- - frontends/default/views/destroy.js.erb
174
- - frontends/default/views/edit_associated.js.erb
175
- - frontends/default/views/field_search.html.erb
176
- - frontends/default/views/form_messages.js.erb
177
- - frontends/default/views/list.html.erb
178
- - frontends/default/views/on_action_update.js.erb
179
- - frontends/default/views/on_create.js.erb
180
- - frontends/default/views/on_mark.js.erb
181
- - frontends/default/views/on_update.js.erb
182
- - frontends/default/views/refresh_list.js.erb
183
- - frontends/default/views/render_field.js.erb
184
- - frontends/default/views/row.js.erb
185
- - frontends/default/views/search.html.erb
186
- - frontends/default/views/show.html.erb
187
- - frontends/default/views/update.html.erb
188
- - frontends/default/views/update_column.js.erb
189
- - frontends/default/views/update_row.js.erb
190
- - lib/active_scaffold.rb
191
- - lib/active_scaffold/actions/common_search.rb
192
- - lib/active_scaffold/actions/core.rb
193
- - lib/active_scaffold/actions/create.rb
194
- - lib/active_scaffold/actions/delete.rb
195
- - lib/active_scaffold/actions/field_search.rb
196
- - lib/active_scaffold/actions/list.rb
197
- - lib/active_scaffold/actions/mark.rb
198
- - lib/active_scaffold/actions/nested.rb
199
- - lib/active_scaffold/actions/search.rb
200
- - lib/active_scaffold/actions/show.rb
201
- - lib/active_scaffold/actions/subform.rb
202
- - lib/active_scaffold/actions/update.rb
203
- - lib/active_scaffold/active_record_permissions.rb
204
- - lib/active_scaffold/attribute_params.rb
205
- - lib/active_scaffold/bridges.rb
206
- - lib/active_scaffold/bridges/ancestry.rb
207
- - lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb
208
- - lib/active_scaffold/bridges/bitfields.rb
209
- - lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb
210
- - lib/active_scaffold/bridges/calendar_date_select.rb
211
- - lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb
212
- - lib/active_scaffold/bridges/cancan.rb
213
- - lib/active_scaffold/bridges/cancan/cancan_bridge.rb
214
- - lib/active_scaffold/bridges/carrierwave.rb
215
- - lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb
216
- - lib/active_scaffold/bridges/carrierwave/carrierwave_bridge_helpers.rb
217
- - lib/active_scaffold/bridges/carrierwave/form_ui.rb
218
- - lib/active_scaffold/bridges/carrierwave/list_ui.rb
219
- - lib/active_scaffold/bridges/country_helper.rb
220
- - lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb
221
- - lib/active_scaffold/bridges/date_picker.rb
222
- - lib/active_scaffold/bridges/date_picker/ext.rb
223
- - lib/active_scaffold/bridges/date_picker/helper.rb
224
- - lib/active_scaffold/bridges/dragonfly.rb
225
- - lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb
226
- - lib/active_scaffold/bridges/dragonfly/dragonfly_bridge_helpers.rb
227
- - lib/active_scaffold/bridges/dragonfly/form_ui.rb
228
- - lib/active_scaffold/bridges/dragonfly/list_ui.rb
229
- - lib/active_scaffold/bridges/file_column.rb
230
- - lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb
231
- - lib/active_scaffold/bridges/file_column/file_column_helpers.rb
232
- - lib/active_scaffold/bridges/file_column/form_ui.rb
233
- - lib/active_scaffold/bridges/file_column/list_ui.rb
234
- - lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
235
- - lib/active_scaffold/bridges/file_column/test/mock_model.rb
236
- - lib/active_scaffold/bridges/file_column/test/test_helper.rb
237
- - lib/active_scaffold/bridges/paperclip.rb
238
- - lib/active_scaffold/bridges/paperclip/form_ui.rb
239
- - lib/active_scaffold/bridges/paperclip/list_ui.rb
240
- - lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb
241
- - lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb
242
- - lib/active_scaffold/bridges/record_select.rb
243
- - lib/active_scaffold/bridges/record_select/helpers.rb
244
- - lib/active_scaffold/bridges/semantic_attributes.rb
245
- - lib/active_scaffold/bridges/semantic_attributes/column.rb
246
- - lib/active_scaffold/bridges/shared/date_bridge.rb
247
- - lib/active_scaffold/bridges/tiny_mce.rb
248
- - lib/active_scaffold/bridges/tiny_mce/helpers.rb
249
- - lib/active_scaffold/config/base.rb
250
- - lib/active_scaffold/config/core.rb
251
- - lib/active_scaffold/config/create.rb
252
- - lib/active_scaffold/config/delete.rb
253
- - lib/active_scaffold/config/field_search.rb
254
- - lib/active_scaffold/config/form.rb
255
- - lib/active_scaffold/config/list.rb
256
- - lib/active_scaffold/config/mark.rb
257
- - lib/active_scaffold/config/nested.rb
258
- - lib/active_scaffold/config/search.rb
259
- - lib/active_scaffold/config/show.rb
260
- - lib/active_scaffold/config/subform.rb
261
- - lib/active_scaffold/config/update.rb
262
- - lib/active_scaffold/configurable.rb
263
- - lib/active_scaffold/constraints.rb
264
- - lib/active_scaffold/data_structures/action_columns.rb
265
- - lib/active_scaffold/data_structures/action_link.rb
266
- - lib/active_scaffold/data_structures/action_links.rb
267
- - lib/active_scaffold/data_structures/actions.rb
268
- - lib/active_scaffold/data_structures/bridge.rb
269
- - lib/active_scaffold/data_structures/column.rb
270
- - lib/active_scaffold/data_structures/columns.rb
271
- - lib/active_scaffold/data_structures/error_message.rb
272
- - lib/active_scaffold/data_structures/nested_info.rb
273
- - lib/active_scaffold/data_structures/set.rb
274
- - lib/active_scaffold/data_structures/sorting.rb
275
- - lib/active_scaffold/engine.rb
276
- - lib/active_scaffold/extensions/action_controller_rendering.rb
277
- - lib/active_scaffold/extensions/action_controller_rescueing.rb
278
- - lib/active_scaffold/extensions/action_view_rendering.rb
279
- - lib/active_scaffold/extensions/active_record_offset.rb
280
- - lib/active_scaffold/extensions/array.rb
281
- - lib/active_scaffold/extensions/cache_association.rb
282
- - lib/active_scaffold/extensions/localize.rb
283
- - lib/active_scaffold/extensions/name_option_for_datetime.rb
284
- - lib/active_scaffold/extensions/nil_id_in_url_params.rb
285
- - lib/active_scaffold/extensions/paginator_extensions.rb
286
- - lib/active_scaffold/extensions/reverse_associations.rb
287
- - lib/active_scaffold/extensions/routing_mapper.rb
288
- - lib/active_scaffold/extensions/to_label.rb
289
- - lib/active_scaffold/extensions/unsaved_associated.rb
290
- - lib/active_scaffold/extensions/unsaved_record.rb
291
- - lib/active_scaffold/extensions/usa_state.rb
292
- - lib/active_scaffold/finder.rb
293
- - lib/active_scaffold/helpers/association_helpers.rb
294
- - lib/active_scaffold/helpers/controller_helpers.rb
295
- - lib/active_scaffold/helpers/form_column_helpers.rb
296
- - lib/active_scaffold/helpers/human_condition_helpers.rb
297
- - lib/active_scaffold/helpers/id_helpers.rb
298
- - lib/active_scaffold/helpers/list_column_helpers.rb
299
- - lib/active_scaffold/helpers/pagination_helpers.rb
300
- - lib/active_scaffold/helpers/search_column_helpers.rb
301
- - lib/active_scaffold/helpers/show_column_helpers.rb
302
- - lib/active_scaffold/helpers/view_helpers.rb
303
- - lib/active_scaffold/marked_model.rb
304
- - lib/active_scaffold/paginator.rb
305
- - lib/active_scaffold/responds_to_parent.rb
306
- - lib/active_scaffold/tableless.rb
307
- - lib/active_scaffold/version.rb
308
- - lib/active_scaffold_env.rb
309
- - lib/generators/active_scaffold/USAGE
310
- - lib/generators/active_scaffold/active_scaffold_generator.rb
311
- - lib/generators/active_scaffold_controller/USAGE
312
- - lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb
313
- - lib/generators/active_scaffold_controller/templates/controller.rb
314
- - lib/generators/active_scaffold_controller/templates/helper.rb
315
- - public/blank.html
316
- - shoulda_macros/macros.rb
317
- - vendor/assets/images/ui-bg_diagonals-thick_18_b81900_40x40.png
318
- - vendor/assets/images/ui-bg_diagonals-thick_20_666666_40x40.png
319
- - vendor/assets/images/ui-bg_flat_10_000000_40x100.png
320
- - vendor/assets/images/ui-bg_glass_100_f6f6f6_1x400.png
321
- - vendor/assets/images/ui-bg_glass_100_fdf5ce_1x400.png
322
- - vendor/assets/images/ui-bg_glass_65_ffffff_1x400.png
323
- - vendor/assets/images/ui-bg_gloss-wave_35_f6a828_500x100.png
324
- - vendor/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
325
- - vendor/assets/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
326
- - vendor/assets/images/ui-icons_222222_256x240.png
327
- - vendor/assets/images/ui-icons_228ef1_256x240.png
328
- - vendor/assets/images/ui-icons_ef8c08_256x240.png
329
- - vendor/assets/images/ui-icons_ffd27a_256x240.png
330
- - vendor/assets/images/ui-icons_ffffff_256x240.png
331
- - vendor/assets/javascripts/jquery-ui-timepicker-addon.js
332
- - vendor/assets/stylesheets/jquery-ui.css
333
89
  - MIT-LICENSE
334
90
  - CHANGELOG
335
91
  - README
@@ -442,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
442
198
  requirements: []
443
199
 
444
200
  rubyforge_project:
445
- rubygems_version: 1.8.23
201
+ rubygems_version: 1.8.19
446
202
  signing_key:
447
203
  specification_version: 3
448
204
  summary: Rails 3.1 Version of activescaffold supporting prototype and jquery
@@ -1,19 +0,0 @@
1
- <% case ActiveScaffold.js_framework %>
2
- <% when :jquery %>
3
- <% require_asset "jquery-ui" %>
4
- <% require_asset "jquery-ui-timepicker-addon" %>
5
- <% require_asset "jquery/active_scaffold" %>
6
- <% require_asset "jquery/jquery.editinplace" %>
7
- <% require_asset "jquery/date_picker_bridge" %>
8
- <% require_asset "jquery/draggable_lists" %>
9
- <% when :prototype %>
10
- <% require_asset "effects" %>
11
- <% require_asset "controls" %>
12
- <% require_asset "prototype/active_scaffold" %>
13
- <% require_asset "prototype/dhtml_history" %>
14
- <% require_asset "prototype/form_enhancements" %>
15
- <% require_asset "prototype/rico_corner" %>
16
- <% end %>
17
- ActiveScaffold.config = <%= ActiveScaffold.js_config.to_json %>;
18
- <% ActiveScaffold.javascripts.each {|js| require_asset js} %>
19
- <% ActiveScaffold::Bridges.all_javascripts.each {|js| require_asset js} %>
@@ -1,1113 +0,0 @@
1
- jQuery(document).ready(function() {
2
- jQuery('form.as_form').live('ajax:beforeSend', function(event) {
3
- var as_form = jQuery(this).closest("form");
4
- if (as_form.attr('data-loading') == 'true') {
5
- ActiveScaffold.disable_form(as_form);
6
- }
7
- return true;
8
- });
9
-
10
- jQuery('form.as_form').live('ajax:complete', function(event) {
11
- var as_form = jQuery(this).closest("form");
12
- if (as_form.attr('data-loading') == 'true') {
13
- ActiveScaffold.enable_form(as_form);
14
- }
15
- });
16
- jQuery('form.as_form').live('ajax:error', function(event, xhr, status, error) {
17
- var as_div = jQuery(this).closest("div.active-scaffold");
18
- if (as_div.length) {
19
- ActiveScaffold.report_500_response(as_div);
20
- }
21
- });
22
- jQuery('form.as_form.as_remote_upload').live('submit', function(event) {
23
- var as_form = jQuery(this).closest("form");
24
- if (as_form.attr('data-loading') == 'true') {
25
- setTimeout("ActiveScaffold.disable_form('" + as_form.attr('id') + "')", 10);
26
- }
27
- return true;
28
- });
29
- jQuery('a.as_action').live('ajax:before', function(event) {
30
- var action_link = ActiveScaffold.ActionLink.get(jQuery(this));
31
- if (action_link) {
32
- if (action_link.is_disabled()) {
33
- return false;
34
- } else {
35
- if (action_link.loading_indicator) action_link.loading_indicator.css('visibility','visible');
36
- action_link.disable();
37
- }
38
- }
39
- return true;
40
- });
41
- jQuery('a.as_action').live('ajax:success', function(event, response) {
42
- var action_link = ActiveScaffold.ActionLink.get(jQuery(this));
43
- if (action_link) {
44
- if (action_link.position) {
45
- action_link.insert(response);
46
- if (action_link.hide_target) action_link.target.hide();
47
- } else {
48
- action_link.enable();
49
- }
50
- jQuery(this).trigger('as:action_success', action_link);
51
- }
52
- return true;
53
- });
54
- jQuery('a.as_action').live('ajax:complete', function(event) {
55
- var action_link = ActiveScaffold.ActionLink.get(jQuery(this));
56
- if (action_link) {
57
- if (action_link.loading_indicator) action_link.loading_indicator.css('visibility','hidden');
58
- }
59
- return true;
60
- });
61
- jQuery('a.as_action').live('ajax:error', function(event, xhr, status, error) {
62
- var action_link = ActiveScaffold.ActionLink.get(jQuery(this));
63
- if (action_link) {
64
- ActiveScaffold.report_500_response(action_link.scaffold_id());
65
- action_link.enable();
66
- }
67
- return true;
68
- });
69
- jQuery('a.as_cancel').live('ajax:before', function(event) {
70
- var as_cancel = jQuery(this);
71
- var action_link = ActiveScaffold.find_action_link(as_cancel);
72
-
73
- if (action_link) {
74
- var cancel_url = as_cancel.attr('href');
75
- var refresh_data = action_link.tag.data('cancel-refresh') || as_cancel.data('refresh');
76
- if (!refresh_data || !cancel_url) {
77
- action_link.close();
78
- return false;
79
- }
80
- }
81
- return true;
82
- });
83
- jQuery('a.as_cancel').live('ajax:success', function(event, response) {
84
- var action_link = ActiveScaffold.find_action_link(jQuery(this));
85
-
86
- if (action_link) {
87
- if (action_link.position) {
88
- action_link.close();
89
- } else {
90
- response.evalResponse();
91
- }
92
- }
93
- return true;
94
- });
95
- jQuery('a.as_cancel').live('ajax:error', function(event, xhr, status, error) {
96
- var action_link = ActiveScaffold.find_action_link(jQuery(this));
97
- if (action_link) {
98
- ActiveScaffold.report_500_response(action_link.scaffold_id());
99
- }
100
- return true;
101
- });
102
- jQuery('a.as_sort').live('ajax:before', function(event) {
103
- var as_sort = jQuery(this);
104
- var history_controller_id = as_sort.attr('data-page-history');
105
- if (history_controller_id) addActiveScaffoldPageToHistory(as_sort.attr('href'), history_controller_id);
106
- as_sort.closest('th').addClass('loading');
107
- return true;
108
- });
109
- jQuery('a.as_sort').live('ajax:error', function(event, xhr, status, error) {
110
- var as_scaffold = jQuery(this).closest('.active-scaffold');
111
- ActiveScaffold.report_500_response(as_scaffold);
112
- return true;
113
- });
114
- jQuery('td.in_place_editor_field').live('hover', function(event) {
115
- var td = jQuery(this), span = td.find('span.in_place_editor_field');
116
- span.data(); // $ 1.4.2 workaround
117
- if (event.type == 'mouseenter') {
118
- if (td.hasClass('empty') || typeof(span.data('editInPlace')) === 'undefined') td.find('span').addClass("hover");
119
- }
120
- if (event.type == 'mouseleave') {
121
- if (td.hasClass('empty') || typeof(span.data('editInPlace')) === 'undefined') td.find('span').removeClass("hover");
122
- }
123
- return true;
124
- });
125
- jQuery('td.in_place_editor_field, th.as_marked-column_heading').live('click', function(event) {
126
- var span = jQuery(this).find('span.in_place_editor_field');
127
- span.data('addEmptyOnCancel', jQuery(this).hasClass('empty'));
128
- jQuery(this).removeClass('empty');
129
- if (span.data('editInPlace')) span.trigger('click.editInPlace');
130
- else ActiveScaffold.in_place_editor_field_clicked(span);
131
- });
132
- jQuery('a.as_paginate').live('ajax:before',function(event) {
133
- var as_paginate = jQuery(this);
134
- var history_controller_id = as_paginate.attr('data-page-history');
135
- if (history_controller_id) addActiveScaffoldPageToHistory(as_paginate.attr('href'), history_controller_id);
136
- as_paginate.prevAll('img.loading-indicator').css('visibility','visible');
137
- return true;
138
- });
139
- jQuery('a.as_paginate').live('ajax:error', function(event, xhr, status, error) {
140
- var as_scaffold = jQuery(this).closest('.active-scaffold');
141
- ActiveScaffold.report_500_response(as_scaffold);
142
- return true;
143
- });
144
- jQuery('a.as_paginate').live('ajax:complete', function(event) {
145
- jQuery(this).prevAll('img.loading-indicator').css('visibility','hidden');
146
- return true;
147
- });
148
- jQuery('a.as_add_existing, a.as_replace_existing').live('ajax:before', function(event) {
149
- var id = jQuery(this).prev().val();
150
- if (id) {
151
- if (!jQuery(this).data('href')) jQuery(this).data('href', jQuery(this).attr('href'));
152
- jQuery(this).attr('href', jQuery(this).data('href').replace('--ID--', id));
153
- return true;
154
- } else return false;
155
- });
156
- jQuery('input.update_form:not(.recordselect), textarea.update_form, select.update_form').live('change', function(event) {
157
- var element = jQuery(this);
158
- var value = element.is("input:checkbox:not(:checked)") ? null : element.val();
159
- ActiveScaffold.update_column(element, element.attr('data-update_url'), element.attr('data-update_send_form'), element.attr('id'), value);
160
- return true;
161
- });
162
- jQuery('input.recordselect.update_form').live('recordselect:change', function(event, id, label) {
163
- var element = jQuery(this);
164
- ActiveScaffold.update_column(element, element.attr('data-update_url'), element.attr('data-update_send_form'), element.attr('id'), id);
165
- return true;
166
- });
167
-
168
- jQuery('select.as_search_range_option').live('change', function(event) {
169
- var element = jQuery(this);
170
- ActiveScaffold[element.val() == 'BETWEEN' ? 'show' : 'hide'](element.closest('dd').find('.as_search_range_between'));
171
- ActiveScaffold[(element.val() == 'null' || element.val() == 'not_null') ? 'hide' : 'show'](element.attr('id').replace(/_opt/, '_numeric'));
172
- return true;
173
- });
174
-
175
- jQuery('select.as_search_date_time_option').live('change', function(event) {
176
- var element = jQuery(this);
177
- ActiveScaffold[!(element.val() == 'PAST' || element.val() == 'FUTURE' || element.val() == 'RANGE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_numeric'));
178
- ActiveScaffold[(element.val() == 'PAST' || element.val() == 'FUTURE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_trend'));
179
- ActiveScaffold[(element.val() == 'RANGE') ? 'show' : 'hide'](element.attr('id').replace(/_opt/, '_range'));
180
- return true;
181
- });
182
-
183
- jQuery('select.as_update_date_operator').live('change', function(event) {
184
- ActiveScaffold[jQuery(this).val() == 'REPLACE' ? 'show' : 'hide'](jQuery(this).next());
185
- ActiveScaffold[jQuery(this).val() == 'REPLACE' ? 'hide' : 'show'](jQuery(this).next().next());
186
- return true;
187
- });
188
-
189
- jQuery('a[data-popup]').live('click', function(e) {
190
- window.open(jQuery(this).attr('href'));
191
- e.preventDefault();
192
- });
193
-
194
- jQuery('.hover_click').live("click", function(event) {
195
- var element = jQuery(this);
196
- var ul_element = element.children('ul').first();
197
- if (ul_element.is(':visible')) {
198
- element.find('ul').hide();
199
- } else {
200
- ul_element.show();
201
- }
202
- return false;
203
- });
204
- jQuery('.hover_click a.as_action').live('click', function(event) {
205
- var element = jQuery(this).closest('.hover_click');
206
- if (element) {
207
- element.find('ul').hide();
208
- }
209
- return true;
210
- });
211
-
212
- jQuery('.message a.close').live('click', function(e) {
213
- ActiveScaffold.hide(jQuery(this).closest('.message'));
214
- e.preventDefault();
215
- });
216
- });
217
-
218
- /* Simple Inheritance
219
- http://ejohn.org/blog/simple-javascript-inheritance/
220
- */
221
- (function(){
222
- var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
223
-
224
- // The base Class implementation (does nothing)
225
- this.Class = function(){};
226
-
227
- // Create a new Class that inherits from this class
228
- Class.extend = function(prop) {
229
- var _super = this.prototype;
230
-
231
- // Instantiate a base class (but only create the instance,
232
- // don't run the init constructor)
233
- initializing = true;
234
- var prototype = new this();
235
- initializing = false;
236
-
237
- // Copy the properties over onto the new prototype
238
- for (var name in prop) {
239
- // Check if we're overwriting an existing function
240
- prototype[name] = typeof prop[name] == "function" &&
241
- typeof _super[name] == "function" && fnTest.test(prop[name]) ?
242
- (function(name, fn){
243
- return function() {
244
- var tmp = this._super;
245
-
246
- // Add a new ._super() method that is the same method
247
- // but on the super-class
248
- this._super = _super[name];
249
-
250
- // The method only need to be bound temporarily, so we
251
- // remove it when we're done executing
252
- var ret = fn.apply(this, arguments);
253
- this._super = tmp;
254
-
255
- return ret;
256
- };
257
- })(name, prop[name]) :
258
- prop[name];
259
- }
260
-
261
- // The dummy class constructor
262
- function Class() {
263
- // All construction is actually done in the init method
264
- if ( !initializing && this.init )
265
- this.init.apply(this, arguments);
266
- }
267
-
268
- // Populate our constructed prototype object
269
- Class.prototype = prototype;
270
-
271
- // Enforce the constructor to be what we expect
272
- Class.constructor = Class;
273
-
274
- // And make this class extendable
275
- Class.extend = arguments.callee;
276
-
277
- return Class;
278
- };
279
- })();
280
-
281
- /*
282
- $ delayed observer
283
- (c) 2007 - Maxime Haineault (max@centdessin.com)
284
-
285
- Special thanks to Stephen Goguen & Tane Piper.
286
-
287
- Slight modifications by Elliot Winkler
288
- */
289
-
290
- if (typeof(jQuery.fn.delayedObserver) === 'undefined') {
291
- (function() {
292
- var delayedObserverStack = [];
293
- var observed;
294
-
295
- function delayedObserverCallback(stackPos) {
296
- observed = delayedObserverStack[stackPos];
297
- if (observed.timer) return;
298
-
299
- observed.timer = setTimeout(function(){
300
- observed.timer = null;
301
- observed.callback(observed.obj.val(), observed.obj);
302
- }, observed.delay * 1000);
303
-
304
- observed.oldVal = observed.obj.val();
305
- }
306
-
307
- // going by
308
- // <http://www.cambiaresearch.com/c4/702b8cd1-e5b0-42e6-83ac-25f0306e3e25/Javascript-Char-Codes-Key-Codes.aspx>
309
- // I think these codes only work when using keyup or keydown
310
- function isNonPrintableKey(event) {
311
- var code = event.keyCode;
312
- return (
313
- event.metaKey ||
314
- (code >= 9 && code <= 16) || (code >= 27 && code <= 40) || (code >= 91 && code <= 93) || (code >= 112 && code <= 145)
315
- );
316
- }
317
-
318
- jQuery.fn.extend({
319
- delayedObserver:function(delay, callback){
320
- $this = jQuery(this);
321
-
322
- delayedObserverStack.push({
323
- obj: $this, timer: null, delay: delay,
324
- oldVal: $this.val(), callback: callback
325
- });
326
-
327
- stackPos = delayedObserverStack.length-1;
328
-
329
- $this.keyup(function(event) {
330
- if (isNonPrintableKey(event)) return;
331
- observed = delayedObserverStack[stackPos];
332
- if (observed.obj.val() == observed.obj.oldVal) return;
333
- else delayedObserverCallback(stackPos);
334
- });
335
- }
336
- });
337
- })();
338
- };
339
-
340
-
341
- /*
342
- * Simple utility methods
343
- */
344
-
345
- var ActiveScaffold = {
346
- records_for: function(tbody_id) {
347
- if (typeof(tbody_id) == 'string') tbody_id = '#' + tbody_id;
348
- return jQuery(tbody_id).children('.record');
349
- },
350
- stripe: function(tbody_id) {
351
- var even = false;
352
- var rows = this.records_for(tbody_id);
353
-
354
- rows.each(function (index, row_node) {
355
- row = jQuery(row_node);
356
- if (row_node.tagName != 'SCRIPT'
357
- && !row.hasClass("create")
358
- && !row.hasClass("update")
359
- && !row.hasClass("inline-adapter")
360
- && !row.hasClass("active-scaffold-calculations")) {
361
-
362
- if (even) row.addClass("even-record");
363
- else row.removeClass("even-record");
364
-
365
- even = !even;
366
- }
367
- });
368
- },
369
- hide_empty_message: function(tbody) {
370
- if (this.records_for(tbody).length != 0) {
371
- jQuery(tbody).parent().find('tbody.messages p.empty-message').hide();
372
- }
373
- },
374
- reload_if_empty: function(tbody, url) {
375
- if (this.records_for(tbody).length == 0) {
376
- this.reload(url);
377
- }
378
- },
379
- reload: function(url) {
380
- jQuery.getScript(url);
381
- },
382
- removeSortClasses: function(scaffold) {
383
- if (typeof(scaffold) == 'string') scaffold = '#' + scaffold;
384
- scaffold = jQuery(scaffold)
385
- scaffold.find('td.sorted').each(function(element) {
386
- element.removeClass("sorted");
387
- });
388
- scaffold.find('th.sorted').each(function(element) {
389
- element.removeClass("sorted");
390
- element.removeClass("asc");
391
- element.removeClass("desc");
392
- });
393
- },
394
- decrement_record_count: function(scaffold) {
395
- // decrement the last record count, firsts record count are in nested lists
396
- if (typeof(scaffold) == 'string') scaffold = '#' + scaffold;
397
- scaffold = jQuery(scaffold);
398
- count = scaffold.find('span.active-scaffold-records').last();
399
- if (count) count.html(parseInt(count.html(), 10) - 1);
400
- },
401
- increment_record_count: function(scaffold) {
402
- // increment the last record count, firsts record count are in nested lists
403
- if (typeof(scaffold) == 'string') scaffold = '#' + scaffold;
404
- scaffold = jQuery(scaffold);
405
- count = scaffold.find('span.active-scaffold-records').last();
406
- if (count) count.html(parseInt(count.html(), 10) + 1);
407
- },
408
- update_row: function(row, html) {
409
- var even_row = false;
410
- var replaced = null;
411
- if (typeof(row) == 'string') row = '#' + row;
412
- row = jQuery(row);
413
- if (row.hasClass('even-record')) even_row = true;
414
-
415
- replaced = this.replace(row, html);
416
- if (even_row === true) replaced.addClass('even-record');
417
- ActiveScaffold.highlight(replaced);
418
- },
419
-
420
- replace: function(element, html) {
421
- if (typeof(element) == 'string') element = '#' + element;
422
- element = jQuery(element);
423
- var new_element = jQuery(html);
424
- element.replaceWith(new_element);
425
- new_element.trigger('as:element_updated');
426
- return new_element;
427
- },
428
-
429
- replace_html: function(element, html) {
430
- if (typeof(element) == 'string') element = '#' + element;
431
- element = jQuery(element);
432
- element.html(html);
433
- element.trigger('as:element_updated');
434
- return element;
435
- },
436
-
437
- remove: function(element) {
438
- if (typeof(element) == 'string') element = '#' + element;
439
- jQuery(element).remove();
440
- },
441
-
442
- update_inplace_edit: function(element, value, empty) {
443
- if (typeof(element) == 'string') element = '#' + element;
444
- this.replace_html(jQuery(element), value);
445
- jQuery(element).closest('td')[empty ? 'addClass' : 'removeClass']('empty');
446
- },
447
-
448
- hide: function(element) {
449
- if (typeof(element) == 'string') element = '#' + element;
450
- jQuery(element).hide();
451
- },
452
-
453
- show: function(element) {
454
- if (typeof(element) == 'string') element = '#' + element;
455
- jQuery(element).show();
456
- },
457
-
458
- reset_form: function(element) {
459
- if (typeof(element) == 'string') element = '#' + element;
460
- jQuery(element).get(0).reset();
461
- },
462
-
463
- disable_form: function(as_form) {
464
- if (typeof(as_form) == 'string') as_form = '#' + as_form;
465
- as_form = jQuery(as_form)
466
- var loading_indicator = jQuery('#' + as_form.attr('id').replace(/-form$/, '-loading-indicator'));
467
- if (loading_indicator) loading_indicator.css('visibility','visible');
468
- jQuery('input[type=submit]', as_form).attr('disabled', 'disabled');
469
- as_form[0].disabled_fields = jQuery("input:enabled,select:enabled,textarea:enabled", as_form).attr('disabled', 'disabled');
470
- },
471
-
472
- enable_form: function(as_form) {
473
- if (typeof(as_form) == 'string') as_form = '#' + as_form;
474
- as_form = jQuery(as_form)
475
- var loading_indicator = jQuery('#' + as_form.attr('id').replace(/-form$/, '-loading-indicator'));
476
- if (loading_indicator) loading_indicator.css('visibility','hidden');
477
- jQuery('input[type=submit]', as_form).removeAttr('disabled');
478
- as_form[0].disabled_fields.removeAttr('disabled');
479
- },
480
-
481
- focus_first_element_of_form: function(form_element) {
482
- if (typeof(form_element) == 'string') form_element = '#' + form_element;
483
- jQuery(form_element + ":first *:input[type!=hidden]:first").focus();
484
- },
485
-
486
- create_record_row: function(active_scaffold_id, html, options) {
487
- if (typeof(active_scaffold_id) == 'string') active_scaffold_id = '#' + active_scaffold_id;
488
- tbody = jQuery(active_scaffold_id).find('tbody.records').first();
489
-
490
- if (options.insert_at == 'top') {
491
- tbody.prepend(html);
492
- var new_row = tbody.children('tr.record:first-child');
493
- } else if (options.insert_at == 'bottom') {
494
- var rows = tbody.children('tr.record, tr.inline-adapter');
495
- var new_row = null;
496
- if (rows.length > 0) {
497
- new_row = rows.last().after(html).next();
498
- } else {
499
- new_row = tbody.append(html).children().last();
500
- }
501
- }
502
- this.stripe(tbody);
503
- this.hide_empty_message(tbody);
504
- this.increment_record_count(tbody.closest('div.active-scaffold'));
505
- ActiveScaffold.highlight(new_row);
506
- },
507
-
508
- create_record_row_from_url: function(active_scaffold_id, url, options) {
509
- jQuery.get(url, function(row) {
510
- ActiveScaffold.create_record_row(action_link.scaffold(), row, options);
511
- action_link.close();
512
- });
513
- },
514
-
515
- delete_record_row: function(row, page_reload_url) {
516
- if (typeof(row) == 'string') row = '#' + row;
517
- row = jQuery(row);
518
- var tbody = row.closest('tbody.records');
519
-
520
- var current_action_node = row.find('td.actions a.disabled').first();
521
- if (current_action_node) {
522
- var action_link = ActiveScaffold.ActionLink.get(current_action_node);
523
- if (action_link) {
524
- action_link.close_previous_adapter();
525
- }
526
- }
527
-
528
- row.remove();
529
- this.stripe(tbody);
530
- this.decrement_record_count(tbody.closest('div.active-scaffold'));
531
- this.reload_if_empty(tbody, page_reload_url);
532
- },
533
-
534
- delete_subform_record: function(record) {
535
- if (typeof(record) == 'string') record = '#' + record;
536
- record = jQuery(record);
537
- var errors = record.prev();
538
- if (errors.hasClass('association-record-errors')) {
539
- this.remove(errors);
540
- }
541
- var associated = jQuery(record).next();
542
- this.remove(record);
543
- while (associated.hasClass('associated-record')) {
544
- record = associated;
545
- associated = jQuery(record).next();
546
- this.remove(record);
547
- }
548
- },
549
-
550
- report_500_response: function(active_scaffold_id) {
551
- var server_error = jQuery(active_scaffold_id).find('td.messages-container p.server-error').first();
552
- if (server_error.is(':visible')) {
553
- ActiveScaffold.highlight(server_error);
554
- } else {
555
- server_error.show();
556
- }
557
- ActiveScaffold.scroll_to(server_error, ActiveScaffold.config.scroll_on_close == 'checkInViewport');
558
- },
559
-
560
- find_action_link: function(element) {
561
- if (typeof(element) == 'string') element = '#' + element;
562
- element = jQuery(element);
563
- return ActiveScaffold.ActionLink.get(element.is('.actions a') ? element : element.closest('.as_adapter'));
564
- },
565
-
566
- scroll_to: function(element, checkInViewport) {
567
- if (typeof checkInViewport == 'undefined') checkInViewport = true;
568
- if (typeof(element) == 'string') element = '#' + element;
569
- var form_offset = jQuery(element).offset().top;
570
- if (checkInViewport) {
571
- var docViewTop = jQuery(window).scrollTop(),
572
- docViewBottom = docViewTop + jQuery(window).height();
573
- // If it's in viewport , don't scroll;
574
- if (form_offset + jQuery(element).height() <= docViewBottom && form_offset >= docViewTop) return;
575
- }
576
-
577
- jQuery(document).scrollTop(form_offset);
578
- },
579
-
580
- process_checkbox_inplace_edit: function(checkbox, options) {
581
- var checked = checkbox.is(':checked');
582
- if (checked === true) options['params'] += '&value=1';
583
- jQuery.ajax({
584
- url: options.url,
585
- type: "POST",
586
- data: options['params'],
587
- dataType: options.ajax_data_type,
588
- after: function(request){
589
- checkbox.attr('disabled', 'disabled');
590
- },
591
- complete: function(request){
592
- checkbox.removeAttr('disabled');
593
- }
594
- });
595
- },
596
-
597
- read_inplace_edit_heading_attributes: function(column_heading, options) {
598
- if (column_heading.data('ie-cancel-text')) options.cancel_button = '<button class="inplace_cancel">' + column_heading.data('ie-cancel-text') + "</button>";
599
- if (column_heading.data('ie-loading-text')) options.loading_text = column_heading.data('ie-loading-text');
600
- if (column_heading.data('ie-saving-text')) options.saving_text = column_heading.data('ie-saving-text');
601
- if (column_heading.data('ie-save-text')) options.save_button = '<button class="inplace_save">' + column_heading.data('ie-save-text') + "</button>";
602
- if (column_heading.data('ie-rows')) options.textarea_rows = column_heading.data('ie-rows');
603
- if (column_heading.data('ie-cols')) options.textarea_cols = column_heading.data('ie-cols');
604
- if (column_heading.data('ie-size')) options.text_size = column_heading.data('ie-size');
605
- },
606
-
607
- create_inplace_editor: function(span, options) {
608
- span.removeClass('hover');
609
- span.editInPlace(options);
610
- span.trigger('click.editInPlace');
611
- },
612
-
613
- highlight: function(element) {
614
- if (typeof(element) == 'string') element = jQuery('#' + element);
615
- if (typeof(element.effect) == 'function') {
616
- element.effect("highlight", jQuery.extend({}, ActiveScaffold.config.highlight), 3000);
617
- }
618
- },
619
-
620
- create_visibility_toggle: function(element, options) {
621
- if (typeof(element) == 'string') element = '#' + element;
622
- var toggable = jQuery(element);
623
- var toggler = toggable.prev();
624
- var initial_label = (options.default_visible === true) ? options.hide_label : options.show_label;
625
-
626
- toggler.append(' (<a class="visibility-toggle" href="#">' + initial_label + '</a>)');
627
- toggler.children('a').click(function() {
628
- toggable.toggle();
629
- jQuery(this).html((toggable.is(':hidden')) ? options.show_label : options.hide_label);
630
- return false;
631
- });
632
- },
633
-
634
- create_associated_record_form: function(element, content, options) {
635
- if (typeof(element) == 'string') element = '#' + element;
636
- var element = jQuery(element);
637
- content = jQuery(content);
638
- if (options.singular == false) {
639
- if (!(options.id && jQuery('#' + options.id).size() > 0)) {
640
- var new_element = element.append(content);
641
- content.trigger('as:element_updated');
642
- }
643
- } else {
644
- var current = jQuery('#' + element.attr('id') + ' .association-record')
645
- if (current[0]) {
646
- this.replace(current[0], content);
647
- } else {
648
- element.prepend(content);
649
- content.trigger('as:element_updated');
650
- }
651
- }
652
- },
653
-
654
- render_form_field: function(source, content, options) {
655
- if (typeof(source) == 'string') source = '#' + source;
656
- var source = jQuery(source);
657
- var element = source.closest('.association-record');
658
- if (element.length == 0) {
659
- element = source.closest('form > ol.form');
660
- }
661
- element = element.find('.' + options.field_class).first();
662
-
663
- if (element) {
664
- if (options.is_subform == false) {
665
- this.replace(element.closest('dl'), content);
666
- } else {
667
- this.replace_html(element, content);
668
- }
669
- }
670
- },
671
-
672
- sortable: function(element, controller, options, url_params) {
673
- if (typeof(element) == 'string') element = '#' + element;
674
- var element = jQuery(element);
675
- var sortable_options = jQuery.extend({}, options);
676
- if (options.update === true) {
677
- url_params.authenticity_token = jQuery('meta[name=csrf-param]').attr('content');
678
- sortable_options.update = function(event, ui) {
679
- var url = controller + '/' + options.action + '?'
680
- url += jQuery(this).sortable('serialize',{key: encodeURIComponent(jQuery(this).attr('id') + '[]'), expression:/^[^_-](?:[A-Za-z0-9_-]*)-(.*)-row$/});
681
- jQuery.post(url.append_params(url_params));
682
- }
683
- }
684
- element.sortable(sortable_options);
685
- },
686
-
687
- record_select_onselect: function(edit_associated_url, active_scaffold_id, id){
688
- jQuery.ajax({
689
- url: edit_associated_url.split('--ID--').join(id),
690
- error: function(xhr, textStatus, errorThrown){
691
- ActiveScaffold.report_500_response(active_scaffold_id)
692
- }
693
- });
694
- },
695
-
696
- // element is tbody id
697
- mark_records: function(element, options) {
698
- if (typeof(element) == 'string') element = '#' + element;
699
- var element = jQuery(element);
700
- if (options.include_checkboxes) {
701
- var mark_checkboxes = jQuery('#' + element.attr('id') + ' > tr.record td.as_marked-column input[type="checkbox"]');
702
- mark_checkboxes.each(function (index) {
703
- var item = jQuery(this);
704
- if(options.checked) {
705
- item.attr('checked', 'checked');
706
- } else {
707
- item.removeAttr('checked');
708
- }
709
- item.attr('value', ('' + !options.checked));
710
- });
711
- }
712
- if(options.include_mark_all) {
713
- var mark_all_checkbox = element.prevAll('thead').find('th.as_marked-column_heading span input[type="checkbox"]');
714
- if(options.checked) {
715
- mark_all_checkbox.attr('checked', 'checked');
716
- } else {
717
- mark_all_checkbox.removeAttr('checked');
718
- }
719
- mark_all_checkbox.attr('value', ('' + !options.checked));
720
- }
721
- },
722
-
723
- in_place_editor_field_clicked: function(span) {
724
- span.data(); // $ 1.4.2 workaround
725
- // test editor is open
726
- if (typeof(span.data('editInPlace')) === 'undefined') {
727
- var options = {show_buttons: true,
728
- hover_class: 'hover',
729
- element_id: 'editor_id',
730
- ajax_data_type: "script",
731
- delegate: {
732
- willCloseEditInPlace: function(span, options, enteredText) {
733
- if (span.data('addEmptyOnCancel')) span.closest('td').addClass('empty');
734
- }
735
- },
736
- update_value: 'value'},
737
- csrf_param = jQuery('meta[name=csrf-param]').first(),
738
- csrf_token = jQuery('meta[name=csrf-token]').first(),
739
- my_parent = span.parent(),
740
- column_heading = null;
741
-
742
- if(!(my_parent.is('td') || my_parent.is('th'))){
743
- my_parent = span.parents('td').eq(0);
744
- }
745
-
746
- if (my_parent.is('td')) {
747
- var column_no = my_parent.prevAll('td').length;
748
- column_heading = my_parent.closest('.active-scaffold').find('th:eq(' + column_no + ')');
749
- } else if (my_parent.is('th')) {
750
- column_heading = my_parent;
751
- }
752
-
753
- var render_url = column_heading.data('ie-render-url'),
754
- mode = column_heading.data('ie-mode'),
755
- record_id = span.data('ie-id') || '';
756
-
757
- ActiveScaffold.read_inplace_edit_heading_attributes(column_heading, options);
758
-
759
- if (span.data('ie-url')) {
760
- options.url = span.data('ie-url').replace(/__id__/, record_id);
761
- } else {
762
- options.url = column_heading.data('ie-url').replace(/__id__/, record_id);
763
- }
764
-
765
- if (csrf_param) options['params'] = csrf_param.attr('content') + '=' + csrf_token.attr('content');
766
-
767
- if (span.closest('div.active-scaffold').attr('data-eid')) {
768
- if (options['params'].length > 0) {
769
- options['params'] += "&";
770
- }
771
- options['params'] += ("eid=" + span.closest('div.active-scaffold').attr('data-eid'));
772
- }
773
-
774
- if (mode === 'clone') {
775
- options.clone_id_suffix = record_id;
776
- options.clone_selector = '#' + column_heading.attr('id') + ' .as_inplace_pattern';
777
- options.field_type = 'clone';
778
- }
779
-
780
- if (render_url) {
781
- var plural = false;
782
- if (column_heading.data('ie-plural')) plural = true;
783
- options.field_type = 'remote';
784
- options.editor_url = render_url.replace(/__id__/, record_id)
785
- }
786
- if (mode === 'inline_checkbox') {
787
- ActiveScaffold.process_checkbox_inplace_edit(span.find('input:checkbox'), options);
788
- } else {
789
- ActiveScaffold.create_inplace_editor(span, options);
790
- }
791
- }
792
- },
793
-
794
- update_column: function(element, url, send_form, source_id, val) {
795
- if (!element) element = jQuery('#' + source_id);
796
- var as_form = element.closest('form.as_form');
797
- var params = null;
798
-
799
- if (send_form) {
800
- var selector;
801
- if (selector = element.data('update_send_form_selector'))
802
- params = as_form.find(selector).serialize();
803
- else params = as_form.serialize();
804
- params += '&' + jQuery.param({"source_id": source_id});
805
- } else {
806
- params = {value: val};
807
- params.source_id = source_id;
808
- }
809
-
810
- jQuery.ajax({
811
- url: url,
812
- data: params,
813
- beforeSend: function(event) {
814
- element.nextAll('img.loading-indicator').css('visibility','visible');
815
- ActiveScaffold.disable_form(as_form);
816
- },
817
- complete: function(event) {
818
- element.nextAll('img.loading-indicator').css('visibility','hidden');
819
- ActiveScaffold.enable_form(as_form);
820
- },
821
- error: function (xhr, status, error) {
822
- var as_div = element.closest("div.active-scaffold");
823
- if (as_div) {
824
- ActiveScaffold.report_500_response(as_div);
825
- }
826
- }
827
- });
828
- },
829
-
830
- draggable_lists: function(element) {
831
- jQuery('#' + element).draggable_lists();
832
- }
833
- }
834
-
835
- /*
836
- * DHTML history tie-in
837
- */
838
- function addActiveScaffoldPageToHistory(url, active_scaffold_id) {
839
- if (typeof dhtmlHistory == 'undefined') return; // it may not be loaded
840
-
841
- var array = url.split('?');
842
- var qs = new Querystring(array[1]);
843
- var sort = qs.get('sort')
844
- var dir = qs.get('sort_direction')
845
- var page = qs.get('page')
846
- if (sort || dir || page) dhtmlHistory.add(active_scaffold_id+":"+page+":"+sort+":"+dir, url);
847
- }
848
-
849
- /*
850
- * URL modification support. Incomplete functionality.
851
- */
852
- String.prototype.append_params = function(params) {
853
- var url = this;
854
- if (url.indexOf('?') == -1) url += '?';
855
- else if (url.lastIndexOf('&') != url.length) url += '&';
856
-
857
- for(var key in params) {
858
- if (key) url += (key + '=' + params[key] + '&');
859
- }
860
-
861
- // the loop leaves a comma dangling at the end of string, chop it off
862
- url = url.substring(0, url.length-1);
863
- return url;
864
- };
865
-
866
-
867
- /**
868
- * A set of links. As a set, they can be controlled such that only one is "open" at a time, etc.
869
- */
870
- ActiveScaffold.Actions = new Object();
871
- ActiveScaffold.Actions.Abstract = Class.extend({
872
- init: function(links, target, loading_indicator, options) {
873
- this.target = jQuery(target);
874
- this.loading_indicator = jQuery(loading_indicator);
875
- this.options = options;
876
- var _this = this;
877
- this.links = jQuery.map(links, function(link) {
878
- var my_link = _this.instantiate_link(link);
879
- return my_link;
880
- });
881
- },
882
-
883
- instantiate_link: function(link) {
884
- throw 'unimplemented'
885
- }
886
- });
887
-
888
- /**
889
- * A DataStructures::ActionLink, represented in JavaScript.
890
- * Concerned with AJAX-enabling a link and adapting the result for insertion into the table.
891
- */
892
- ActiveScaffold.ActionLink = {
893
- get: function(element) {
894
- if (typeof(element) == 'string') element = '#' + element;
895
- var element = jQuery(element);
896
- if (element.length > 0) {
897
- element.data(); // $ 1.4.2 workaround
898
- if (typeof(element.data('action_link')) === 'undefined' && !element.hasClass('as_adapter')) {
899
- var parent = element.closest('.actions');
900
- if (parent.length === 0) {
901
- // maybe an column action_link
902
- parent = element.parent();
903
- }
904
- if (parent && parent.is('td')) {
905
- // record action
906
- parent = parent.closest('tr.record');
907
- var target = parent.find('a.as_action');
908
- var loading_indicator = parent.find('td.actions .loading-indicator');
909
- new ActiveScaffold.Actions.Record(target, parent, loading_indicator);
910
- } else if (parent && parent.is('div')) {
911
- //table action
912
- new ActiveScaffold.Actions.Table(parent.find('a.as_action'), parent.closest('div.active-scaffold').find('tbody.before-header').first(), parent.find('.loading-indicator').first());
913
- }
914
- element = jQuery(element);
915
- }
916
- return element.data('action_link');
917
- } else {
918
- return null;
919
- }
920
- }
921
- };
922
- ActiveScaffold.ActionLink.Abstract = Class.extend({
923
- init: function(a, target, loading_indicator) {
924
- this.tag = jQuery(a);
925
- this.url = this.tag.attr('href');
926
- this.method = this.tag.attr('data-method') || 'get';
927
- this.target = target;
928
- this.loading_indicator = loading_indicator;
929
- this.hide_target = false;
930
- this.position = this.tag.attr('data-position');
931
- this.action = this.tag.attr('data-action');
932
-
933
- this.tag.data('action_link', this);
934
- return this;
935
- },
936
-
937
- open: function(event) {
938
- this.tag.click();
939
- },
940
-
941
- insert: function(content) {
942
- throw 'unimplemented'
943
- },
944
-
945
- close: function() {
946
- this.enable();
947
- this.adapter.remove();
948
- if (this.hide_target) this.target.show();
949
- if (ActiveScaffold.config.scroll_on_close) ActiveScaffold.scroll_to(this.target.attr('id'), ActiveScaffold.config.scroll_on_close == 'checkInViewport');
950
- },
951
-
952
- get_new_adapter_id: function() {
953
- var id = 'adapter_';
954
- var i = 0;
955
- while (jQuery(id + i)) i++;
956
- return id + i;
957
- },
958
-
959
- enable: function() {
960
- return this.tag.removeClass('disabled');
961
- },
962
-
963
- disable: function() {
964
- return this.tag.addClass('disabled');
965
- },
966
-
967
- is_disabled: function() {
968
- return this.tag.hasClass('disabled');
969
- },
970
-
971
- scaffold_id: function() {
972
- return '#' + this.tag.closest('div.active-scaffold').attr('id');
973
- },
974
-
975
- scaffold: function() {
976
- return this.tag.closest('div.active-scaffold');
977
- },
978
-
979
- update_flash_messages: function(messages) {
980
- message_node = jQuery(this.scaffold_id().replace(/-active-scaffold/, '-messages'));
981
- if (message_node) message_node.html(messages);
982
- },
983
- set_adapter: function(element) {
984
- this.adapter = element;
985
- this.adapter.addClass('as_adapter');
986
- this.adapter.data('action_link', this);
987
- if (this.refresh_url) jQuery('.as_cancel', this.adapter).attr('href', this.refresh_url);
988
- }
989
- });
990
-
991
- /**
992
- * Concrete classes for record actions
993
- */
994
- ActiveScaffold.Actions.Record = ActiveScaffold.Actions.Abstract.extend({
995
- instantiate_link: function(link) {
996
- var l = new ActiveScaffold.ActionLink.Record(link, this.target, this.loading_indicator);
997
- var refresh = this.target.attr('data-refresh');
998
- if (refresh) l.refresh_url = refresh;
999
-
1000
- if (l.position) {
1001
- l.url = l.url.append_params({adapter: '_list_inline_adapter'});
1002
- l.tag.attr('href', l.url);
1003
- }
1004
- l.set = this;
1005
- return l;
1006
- }
1007
- });
1008
-
1009
- ActiveScaffold.ActionLink.Record = ActiveScaffold.ActionLink.Abstract.extend({
1010
- close_previous_adapter: function() {
1011
- var _this = this;
1012
- jQuery.each(this.set.links, function(index, item) {
1013
- if (item.url != _this.url && item.is_disabled() && item.adapter) {
1014
- item.enable();
1015
- item.adapter.remove();
1016
- }
1017
- });
1018
- },
1019
-
1020
- insert: function(content) {
1021
- this.close_previous_adapter();
1022
-
1023
- if (this.position == 'replace') {
1024
- this.position = 'after';
1025
- this.hide_target = true;
1026
- }
1027
-
1028
- if (this.position == 'after') {
1029
- this.target.after(content);
1030
- this.set_adapter(this.target.next());
1031
- }
1032
- else if (this.position == 'before') {
1033
- this.target.before(content);
1034
- this.set_adapter(this.target.prev());
1035
- }
1036
- else {
1037
- return false;
1038
- }
1039
- ActiveScaffold.highlight(this.adapter.find('td'));
1040
- },
1041
-
1042
- close: function(refreshed_content_or_reload) {
1043
- this._super();
1044
- if (refreshed_content_or_reload) {
1045
- if (typeof refreshed_content_or_reload == 'string') {
1046
- ActiveScaffold.update_row(this.target, refreshed_content_or_reload);
1047
- } else if (this.refresh_url) {
1048
- var target = this.target;
1049
- jQuery.get(this.refresh_url, function(e, status, response) {
1050
- ActiveScaffold.update_row(target, response.responseText);
1051
- });
1052
- }
1053
- }
1054
- },
1055
-
1056
- enable: function() {
1057
- var _this = this;
1058
- jQuery.each(this.set.links, function(index, item) {
1059
- if (item.url != _this.url) return;
1060
- item.tag.removeClass('disabled');
1061
- });
1062
- },
1063
-
1064
- disable: function() {
1065
- var _this = this;
1066
- jQuery.each(this.set.links, function(index, item) {
1067
- if (item.url != _this.url) return;
1068
- item.tag.addClass('disabled');
1069
- });
1070
- },
1071
-
1072
- set_opened: function() {
1073
- if (this.position == 'after') {
1074
- this.set_adapter(this.target.next());
1075
- }
1076
- else if (this.position == 'before') {
1077
- this.set_adapter(this.target.prev());
1078
- }
1079
- this.disable();
1080
- }
1081
- });
1082
-
1083
- /**
1084
- * Concrete classes for table actions
1085
- */
1086
- ActiveScaffold.Actions.Table = ActiveScaffold.Actions.Abstract.extend({
1087
- instantiate_link: function(link) {
1088
- var l = new ActiveScaffold.ActionLink.Table(link, this.target, this.loading_indicator);
1089
- if (l.position) {
1090
- l.url = l.url.append_params({adapter: '_list_inline_adapter'});
1091
- l.tag.attr('href', l.url);
1092
- }
1093
- return l;
1094
- }
1095
- });
1096
-
1097
- ActiveScaffold.ActionLink.Table = ActiveScaffold.ActionLink.Abstract.extend({
1098
- insert: function(content) {
1099
- if (this.position == 'top') {
1100
- this.target.prepend(content);
1101
- this.set_adapter(this.target.children().first());
1102
- }
1103
- else {
1104
- throw 'Unknown position "' + this.position + '"'
1105
- }
1106
- ActiveScaffold.highlight(this.adapter.find('td').first().children());
1107
- },
1108
-
1109
- reload: function() {
1110
- this.close();
1111
- this.open();
1112
- },
1113
- });