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
@@ -1,12 +0,0 @@
1
- <%
2
- associated_form = render :partial => "#{subform_partial_for_column(@column)}_record", :locals => {:scope => @scope, :parent_record => @parent_record, :column => @column, :locked => @record.new_record? && @column.singular_association?}
3
- options = {:singular => false}
4
- if @column.singular_association?
5
- options[:singular] = true
6
- else
7
- unless @record.new_record?
8
- column = active_scaffold_config_for(@record.class).columns[@record.class.primary_key]
9
- options[:id] = active_scaffold_input_options(column, @scope)[:id]
10
- end
11
- end %>
12
- ActiveScaffold.create_associated_record_form('<%=sub_form_list_id(:association => @column.name)%>','<%=escape_javascript(associated_form)%>', <%= options.to_json.html_safe %>);
@@ -1,5 +0,0 @@
1
- <div class="active-scaffold">
2
- <div class="search-view view">
3
- <%= render :partial => 'field_search' -%>
4
- </div>
5
- </div>
@@ -1 +0,0 @@
1
- ActiveScaffold.replace_html('<%=element_messages_id%>','<%=escape_javascript(render(:partial => 'form_messages'))%>');
@@ -1 +0,0 @@
1
- <%= render :partial => 'list_with_header' -%>
@@ -1,22 +0,0 @@
1
- <% if controller.send :successful? %>
2
- <% if @record %>
3
- <%= render :partial => 'update_messages' %>
4
- <% row = escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) -%>
5
- <% if @action_link.nil? || @action_link.position %>
6
- ActiveScaffold.find_action_link('<%= element_row_id(:action => :list, :id => @record.id) %>').close('<%= row %>');
7
- <% else %>
8
- ActiveScaffold.update_row('<%= element_row_id(:action => :list, :id => @record.id) %>', '<%= row %>');
9
- ActiveScaffold.scroll_to('<%= element_row_id(:action => :list, :id => @record.id) %>', true);
10
- <% end %>
11
- <%= render :partial => 'update_calculations', :formats => [:js] %>
12
- <% else %>
13
- <% if @action_link.nil? || @action_link.position %>
14
- ActiveScaffold.find_action_link('<%= element_row_id(:action => action_name) %>').close();
15
- <% end %>
16
- <%= render :partial => 'refresh_list' %>
17
- <% end %>
18
- <% else %>
19
- <% flash[:error] = active_scaffold_error_messages_for(@record, :object_name => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :header_message => '', :message => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :container_tag => nil, :list_type => :br) %>
20
- ActiveScaffold.replace_html('<%= active_scaffold_messages_id %>','<%= escape_javascript(render(:partial => 'messages')) %>');
21
- ActiveScaffold.scroll_to('<%= active_scaffold_messages_id %>', true);
22
- <% end %>
@@ -1,38 +0,0 @@
1
- try {
2
- <% form_selector = "#{element_form_id(:action => :create)}"
3
- insert_at ||= :top %>
4
- var action_link = ActiveScaffold.find_action_link('<%= form_selector%>');
5
- action_link.update_flash_messages('<%=escape_javascript(render(:partial => 'messages'))%>');
6
- <% if controller.send :successful? %>
7
- <% if render_parent? %>
8
- <% if nested_singular_association? %>
9
- action_link.close(true);
10
- <% elsif params[:parent_sti] && render_parent_action == :row %>
11
- ActiveScaffold.create_record_row_from_url(action_link,'<%= url_for(render_parent_options) %>', <%= {:insert_at => insert_at}.to_json.html_safe %>);
12
- <% else %>
13
- ActiveScaffold.reload('<%= url_for render_parent_options %>');
14
- <% end %>
15
- <% elsif (active_scaffold_config.create.refresh_list) %>
16
- <%= render :partial => 'refresh_list' %>
17
- <% elsif params[:parent_controller].nil? %>
18
- <% new_row = render :partial => 'list_record', :locals => {:record => @record} %>
19
- ActiveScaffold.create_record_row(action_link.scaffold(),'<%= escape_javascript(new_row) %>', <%= {:insert_at => insert_at}.to_json.html_safe %>);
20
- <%= render :partial => 'update_calculations', :formats => [:js] %>
21
- <% end %>
22
-
23
- <% unless render_parent? %>
24
- <% if (active_scaffold_config.create.persistent) %>
25
- action_link.reload();
26
- <% else %>
27
- action_link.close();
28
- <% end %>
29
- <% if (active_scaffold_config.create.action_after_create) %>
30
- var link = ActiveScaffold.find_action_link('<%= action_link_id active_scaffold_config.create.action_after_create, @record.id %>');
31
- if (link) (function() { link.open() })<%= '.defer' if ActiveScaffold.js_framework == :prototype %>();
32
- <% end %>
33
- <% end %>
34
- <% else %>
35
- ActiveScaffold.replace('<%= form_selector %>','<%= escape_javascript(render(:partial => 'create_form', :locals => {:xhr => true})) %>');
36
- ActiveScaffold.scroll_to('<%= form_selector %>', true);
37
- <% end %>
38
- } catch (e) { alert('RJS error:\n\n' + e.toString());}
@@ -1,6 +0,0 @@
1
- <%
2
- checked = all_marked? unless local_assigns.has_key? :checked
3
- options = {:checked => checked, :include_mark_all => true, :include_checkboxes => params[:id].nil?}
4
- %>
5
- ActiveScaffold.mark_records('<%= active_scaffold_tbody_id %>',<%= options.to_json.html_safe %>);
6
- <%= render :partial => 'update_messages' %>
@@ -1,29 +0,0 @@
1
- try {
2
- <% form_selector = "#{element_form_id(:action => :update)}" %>
3
- var action_link = ActiveScaffold.find_action_link('<%= form_selector %>');
4
- action_link.update_flash_messages('<%= escape_javascript(render(:partial => 'messages')) %>');
5
- <% if controller.send :successful? %>
6
- <% if params[:dont_close] %>
7
- <% row_selector = element_row_id(:action => :list, :id => @record.id) %>
8
- ActiveScaffold.update_row('<%= row_selector %>', '<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
9
- <%= render :partial => 'update_calculations', :formats => [:js] %>
10
- ActiveScaffold.scroll_to('<%= row_selector %>', true);
11
- <% else %>
12
- <% if render_parent? %>
13
- <% if nested_singular_association? || render_parent_action == :row %>
14
- action_link.close(true);
15
- <% else %>
16
- ActiveScaffold.reload('<%= url_for render_parent_options %>');
17
- <% end %>
18
- <% elsif update_refresh_list? %>
19
- <%= render :partial => 'refresh_list' %>
20
- <% else %>
21
- action_link.close('<%= escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) %>');
22
- <%= render :partial => 'update_calculations', :formats => [:js] %>
23
- <% end %>
24
- <% end %>
25
- <% else %>
26
- ActiveScaffold.replace('<%= form_selector %>', '<%= escape_javascript(render(:partial => 'update_form', :locals => {:xhr => true})) %>');
27
- ActiveScaffold.scroll_to('<%= form_selector %>', true);
28
- <% end %>
29
- } catch (e) { alert('RJS error:\n\n' + e.toString());}
@@ -1,2 +0,0 @@
1
- <% ActiveSupport::Deprecation.warn "You should use render :partial => 'refresh_list' instead of render :action => 'refresh_list'" %>
2
- <%= render :partial => 'refresh_list' %>
@@ -1 +0,0 @@
1
- <%= render :partial => "render_field", :collection => @columns, :locals => {:source_id => @source_id, :scope => @scope} %>
@@ -1,2 +0,0 @@
1
- ActiveScaffold.update_row('<%= element_row_id(:action => :list) %>', '<%= escape_javascript render(:partial => 'row', :locals => {:record => @record}) %>');
2
- <%= render :partial => 'update_calculations', :formats => [:js] %>
@@ -1,5 +0,0 @@
1
- <div class="active-scaffold">
2
- <div class="search-view <%= "#{id_from_controller params[:controller]}-view" %> view">
3
- <%= render :partial => 'search' -%>
4
- </div>
5
- </div>
@@ -1,5 +0,0 @@
1
- <div class="active-scaffold">
2
- <div class="show-view <%= "#{id_from_controller params[:controller]}-view" %> view">
3
- <%= render :partial => 'show' -%>
4
- </div>
5
- </div>
@@ -1,8 +0,0 @@
1
- <div class="active-scaffold">
2
- <div class="update-view <%= "#{id_from_controller params[:controller]}-view" %> view">
3
- <% if active_scaffold_config.update.nested_links and active_scaffold_config.action_links.member.empty? -%>
4
- <%= render :partial => 'update_actions', :locals => {:record => @record, :url_options => params_for(:action => :list, :id => @record.id)} %>
5
- <% end -%>
6
- <%= render :partial => 'update_form' -%>
7
- </div>
8
- </div>
@@ -1,15 +0,0 @@
1
- <% @column_span_id ||= element_cell_id(:id => @record.id.to_s, :action => 'update_column', :name => params[:column]) %>
2
- <% unless controller.send :successful? %>
3
- alert('<%= escape_javascript(@record.errors.full_messages.join("\n")) %>');
4
- <% @record.reload %>
5
- <% end %>
6
- <% column = active_scaffold_config.columns[params[:column]] %>
7
- <% formatted_value = get_column_value(@record, column) %>
8
- <% if column.inplace_edit %>
9
- ActiveScaffold.update_inplace_edit('<%= @column_span_id %>','<%= escape_javascript(formatted_value) %>', <%= column_empty?(formatted_value).to_json %>);
10
- <% else %>
11
- ActiveScaffold.replace_html('<%= @column_span_id %>','<%= escape_javascript(formatted_value) %>');
12
- <% end %>
13
- <% if column.calculation? %>
14
- ActiveScaffold.replace_html('<%= active_scaffold_calculations_id(:column => column) %>', '<%= escape_javascript(render_column_calculation(column)) %>');
15
- <% end %>
@@ -1 +0,0 @@
1
- ActiveScaffold.update_row('<%=element_row_id(:action => 'list', :id => @record.id)%>','<%=escape_javascript(render(:partial => 'list_record', :locals => {:record => @record}))%>');
@@ -1,373 +0,0 @@
1
- unless Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >= 1
2
- raise "This version of ActiveScaffold requires Rails 3.1 or higher. Please use an earlier version."
3
- end
4
-
5
- begin
6
- require 'render_component'
7
- rescue LoadError
8
- end
9
-
10
- require 'active_scaffold/active_record_permissions'
11
- require 'active_scaffold/paginator'
12
- require 'active_scaffold/responds_to_parent'
13
-
14
- require 'active_scaffold/version'
15
- require 'active_scaffold/engine' unless defined? ACTIVE_SCAFFOLD_PLUGIN
16
- require 'json' # for js_config
17
-
18
- module ActiveScaffold
19
- autoload :AttributeParams, 'active_scaffold/attribute_params'
20
- autoload :Configurable, 'active_scaffold/configurable'
21
- autoload :Constraints, 'active_scaffold/constraints'
22
- autoload :Finder, 'active_scaffold/finder'
23
- autoload :MarkedModel, 'active_scaffold/marked_model'
24
- autoload :Bridges, 'active_scaffold/bridges'
25
-
26
- mattr_accessor :stylesheets
27
- self.stylesheets = []
28
- mattr_accessor :javascripts
29
- self.javascripts = []
30
-
31
- def self.autoload_subdir(dir, mod=self, root = File.dirname(__FILE__))
32
- Dir["#{root}/active_scaffold/#{dir}/*.rb"].each { |file|
33
- basename = File.basename(file, ".rb")
34
- mod.module_eval {
35
- autoload basename.camelcase.to_sym, "active_scaffold/#{dir}/#{basename}"
36
- }
37
- }
38
- end
39
-
40
- module Actions
41
- ActiveScaffold.autoload_subdir('actions', self)
42
- end
43
-
44
- module Config
45
- ActiveScaffold.autoload_subdir('config', self)
46
- end
47
-
48
- module DataStructures
49
- ActiveScaffold.autoload_subdir('data_structures', self)
50
- end
51
-
52
- module Helpers
53
- ActiveScaffold.autoload_subdir('helpers', self)
54
- end
55
-
56
- class ControllerNotFound < RuntimeError; end
57
- class DependencyFailure < RuntimeError; end
58
- class MalformedConstraint < RuntimeError; end
59
- class RecordNotAllowed < SecurityError; end
60
- class ActionNotAllowed < SecurityError; end
61
- class ReverseAssociationRequired < RuntimeError; end
62
-
63
- def self.included(base)
64
- base.extend(ClassMethods)
65
- base.module_eval do
66
- # TODO: these should be in actions/core
67
- before_filter :handle_user_settings
68
- before_filter :check_input_device
69
- end
70
-
71
- base.helper_method :touch_device?
72
- base.helper_method :hover_via_click?
73
- base.helper_method :active_scaffold_constraints
74
- end
75
-
76
- def self.set_defaults(&block)
77
- ActiveScaffold::Config::Core.configure &block
78
- end
79
-
80
- def active_scaffold_config
81
- self.class.active_scaffold_config
82
- end
83
-
84
- def active_scaffold_config_for(klass)
85
- self.class.active_scaffold_config_for(klass)
86
- end
87
-
88
- def active_scaffold_session_storage(id = nil)
89
- id ||= params[:eid] || "#{params[:controller]}#{"_#{nested.parent_id}" if nested?}"
90
- session_index = "as:#{id}"
91
- session[session_index] ||= {}
92
- session[session_index]
93
- end
94
-
95
- # at some point we need to pass the session and params into config. we'll just take care of that before any particular action occurs by passing those hashes off to the UserSettings class of each action.
96
- def handle_user_settings
97
- if self.class.uses_active_scaffold?
98
- active_scaffold_config.actions.each do |action_name|
99
- conf_instance = active_scaffold_config.send(action_name) rescue next
100
- next if conf_instance.class::UserSettings == ActiveScaffold::Config::Base::UserSettings # if it hasn't been extended, skip it
101
- active_scaffold_session_storage[action_name] ||= {}
102
- conf_instance.user = conf_instance.class::UserSettings.new(conf_instance, active_scaffold_session_storage[action_name], params)
103
- end
104
- end
105
- end
106
-
107
- def check_input_device
108
- if request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(iPhone|iPod|iPad)/i]
109
- session[:input_device_type] = 'TOUCH'
110
- session[:hover_supported] = false
111
- else
112
- session[:input_device_type] = 'MOUSE'
113
- session[:hover_supported] = true
114
- end if session[:input_device_type].nil?
115
- end
116
-
117
- def touch_device?
118
- session[:input_device_type] == 'TOUCH'
119
- end
120
-
121
- def hover_via_click?
122
- session[:hover_supported] == false
123
- end
124
-
125
- def self.js_framework=(framework)
126
- @@js_framework = framework
127
- end
128
-
129
- def self.js_framework
130
- @@js_framework ||= if defined? Jquery
131
- :jquery
132
- elsif defined? PrototypeRails
133
- :prototype
134
- end
135
- end
136
-
137
- def self.js_config=(config)
138
- @@js_config = config
139
- end
140
-
141
- def self.js_config
142
- @@js_config ||= {:scroll_on_close => :checkInViewport}
143
- end
144
-
145
- # exclude bridges you do not need
146
- # name of bridge subdir should be used to exclude it
147
- # eg
148
- # ActiveScaffold.exclude_bridges = [:cancan, :ancestry]
149
- # if you are using Activescaffold as a gem add to initializer
150
- # if you are using Activescaffold as a plugin add to active_scaffold_env.rb
151
- def self.exclude_bridges=(bridges)
152
- @@exclude_bridges = bridges
153
- end
154
-
155
- def self.exclude_bridges
156
- @@exclude_bridges ||= []
157
- end
158
-
159
- def self.root
160
- File.dirname(__FILE__) + "/.."
161
- end
162
-
163
- module ClassMethods
164
- def active_scaffold(model_id = nil, &block)
165
- # initialize bridges here
166
- ActiveScaffold::Bridges.run_all
167
-
168
- # converts Foo::BarController to 'bar' and FooBarsController to 'foo_bar' and AddressController to 'address'
169
- model_id = self.to_s.split('::').last.sub(/Controller$/, '').pluralize.singularize.underscore unless model_id
170
-
171
- # run the configuration
172
- @active_scaffold_config = ActiveScaffold::Config::Core.new(model_id)
173
- @active_scaffold_config_block = block
174
- self.links_for_associations
175
-
176
- @active_scaffold_frontends = []
177
- if active_scaffold_config.frontend.to_sym != :default
178
- active_scaffold_custom_frontend_path = File.join(ActiveScaffold::Config::Core.plugin_directory, 'frontends', active_scaffold_config.frontend.to_s , 'views')
179
- @active_scaffold_frontends << active_scaffold_custom_frontend_path
180
- end
181
- active_scaffold_default_frontend_path = File.join(ActiveScaffold::Config::Core.plugin_directory, 'frontends', 'default' , 'views')
182
- @active_scaffold_frontends << active_scaffold_default_frontend_path
183
- @active_scaffold_custom_paths = []
184
-
185
- self.active_scaffold_superclasses_blocks.each {|superblock| self.active_scaffold_config.configure &superblock}
186
- self.active_scaffold_config.sti_children = nil # reset sti_children if set in parent block
187
- self.active_scaffold_config.configure &block if block_given?
188
- self.active_scaffold_config._configure_sti unless self.active_scaffold_config.sti_children.nil?
189
- self.active_scaffold_config._load_action_columns
190
-
191
- # defines the attribute read methods on the model, so record.send() doesn't find protected/private methods instead
192
- klass = self.active_scaffold_config.model
193
- klass.define_attribute_methods unless klass.attribute_methods_generated?
194
- # include the rest of the code into the controller: the action core and the included actions
195
- module_eval do
196
- include ActiveScaffold::Finder
197
- include ActiveScaffold::Constraints
198
- include ActiveScaffold::AttributeParams
199
- include ActiveScaffold::Actions::Core
200
- active_scaffold_config.actions.each do |mod|
201
- name = mod.to_s.camelize
202
- include "ActiveScaffold::Actions::#{name}".constantize
203
-
204
- # sneak the action links from the actions into the main set
205
- if link = active_scaffold_config.send(mod).link rescue nil
206
- if link.is_a? Array
207
- link.each {|current| active_scaffold_config.action_links.add_to_group(current, active_scaffold_config.send(mod).action_group)}
208
- elsif link.is_a? ActiveScaffold::DataStructures::ActionLink
209
- active_scaffold_config.action_links.add_to_group(link, active_scaffold_config.send(mod).action_group)
210
- end
211
- end
212
- end
213
- end
214
- self.append_view_path active_scaffold_paths
215
- self._add_sti_create_links if self.active_scaffold_config.add_sti_create_links?
216
- end
217
-
218
- def parent_prefixes
219
- @parent_prefixes ||= super << 'active_scaffold_overrides' << ''
220
- end
221
-
222
- # To be called after include action modules
223
- def _add_sti_create_links
224
- new_action_link = active_scaffold_config.action_links.collection['new']
225
- unless new_action_link.nil? || active_scaffold_config.sti_children.empty?
226
- active_scaffold_config.action_links.collection.delete('new')
227
- active_scaffold_config.sti_children.each do |child|
228
- new_sti_link = Marshal.load(Marshal.dump(new_action_link)) # deep clone
229
- new_sti_link.label = child.to_s.camelize.constantize.model_name.human
230
- new_sti_link.parameters = {:parent_sti => controller_path}
231
- new_sti_link.controller = Proc.new { active_scaffold_controller_for(child.to_s.camelize.constantize).controller_path }
232
- active_scaffold_config.action_links.collection.create.add(new_sti_link)
233
- end
234
- end
235
- end
236
-
237
- # Create the automatic column links. Note that this has to happen when configuration is *done*, because otherwise the Nested module could be disabled. Actually, it could still be disabled later, couldn't it?
238
- def links_for_associations
239
- return unless active_scaffold_config.actions.include? :list and active_scaffold_config.actions.include? :nested
240
- active_scaffold_config.columns.each do |column|
241
- next unless column.link.nil? and column.autolink?
242
- #lazy load of action_link, cause it was really slowing down app in dev mode
243
- #and might lead to trouble cause of cyclic constantization of controllers
244
- #and might be unnecessary cause it is done before columns are configured
245
- column.set_link(Proc.new {|col| link_for_association(col)})
246
- end
247
- end
248
-
249
- def active_scaffold_controller_for_column(column, options = {})
250
- begin
251
- if column.polymorphic_association?
252
- :polymorph
253
- elsif options.include?(:controller)
254
- "#{options[:controller].to_s.camelize}Controller".constantize
255
- else
256
- active_scaffold_controller_for(column.association.klass)
257
- end
258
- rescue ActiveScaffold::ControllerNotFound
259
- nil
260
- end
261
- end
262
-
263
- def link_for_association(column, options = {})
264
- controller = active_scaffold_controller_for_column(column, options)
265
-
266
- unless controller.nil?
267
- options.reverse_merge! :label => column.label, :position => :after, :type => :member, :controller => (controller == :polymorph ? controller : controller.controller_path), :column => column
268
- options[:parameters] ||= {}
269
- options[:parameters].reverse_merge! :association => column.association.name
270
- if column.plural_association?
271
- # note: we can't create nested scaffolds on :through associations because there's no reverse association.
272
-
273
- ActiveScaffold::DataStructures::ActionLink.new('index', options.merge(:refresh_on_close => true)) #unless column.through_association?
274
- else
275
- actions = controller.active_scaffold_config.actions unless controller == :polymorph
276
- actions ||= [:create, :update, :show]
277
- column.actions_for_association_links.delete :new unless actions.include? :create
278
- column.actions_for_association_links.delete :edit unless actions.include? :update
279
- column.actions_for_association_links.delete :show unless actions.include? :show
280
- ActiveScaffold::DataStructures::ActionLink.new(nil, options.merge(:html_options => {:class => column.name}))
281
- end
282
- end
283
- end
284
-
285
- def link_for_association_as_scope(scope, options = {})
286
- options.reverse_merge! :label => scope, :position => :after, :type => :member, :controller => controller_path
287
- options[:parameters] ||= {}
288
- options[:parameters].reverse_merge! :named_scope => scope
289
- ActiveScaffold::DataStructures::ActionLink.new('index', options)
290
- end
291
-
292
- def add_active_scaffold_path(path)
293
- @active_scaffold_paths = nil # Force active_scaffold_paths to rebuild
294
- @active_scaffold_custom_paths << path
295
- end
296
-
297
- def active_scaffold_paths
298
- return @active_scaffold_paths unless @active_scaffold_paths.nil?
299
-
300
- @active_scaffold_paths = []
301
- @active_scaffold_paths.concat @active_scaffold_custom_paths unless @active_scaffold_custom_paths.nil?
302
- @active_scaffold_paths.concat @active_scaffold_frontends unless @active_scaffold_frontends.nil?
303
- @active_scaffold_paths
304
- end
305
-
306
- def active_scaffold_config
307
- if @active_scaffold_config.nil?
308
- self.superclass.active_scaffold_config if self.superclass.respond_to? :active_scaffold_config
309
- else
310
- @active_scaffold_config
311
- end
312
- end
313
-
314
- def active_scaffold_config_block
315
- @active_scaffold_config_block
316
- end
317
-
318
- def active_scaffold_superclasses_blocks
319
- blocks = []
320
- klass = self.superclass
321
- while klass.respond_to? :active_scaffold_superclasses_blocks
322
- blocks << klass.active_scaffold_config_block
323
- klass = klass.superclass
324
- end
325
- blocks.compact.reverse
326
- end
327
-
328
- def active_scaffold_config_for(klass)
329
- begin
330
- controller = active_scaffold_controller_for(klass)
331
- rescue ActiveScaffold::ControllerNotFound
332
- config = ActiveScaffold::Config::Core.new(klass)
333
- config._load_action_columns
334
- config
335
- else
336
- controller.active_scaffold_config
337
- end
338
- end
339
-
340
- # Tries to find a controller for the given ActiveRecord model.
341
- # Searches in the namespace of the current controller for singular and plural versions of the conventional "#{model}Controller" syntax.
342
- # You may override this method to customize the search routine.
343
- def active_scaffold_controller_for(klass)
344
- controller_namespace = self.to_s.split('::')[0...-1].join('::') + '::'
345
- error_message = []
346
- [controller_namespace, ''].each do |namespace|
347
- ["#{klass.to_s.underscore.pluralize}", "#{klass.to_s.underscore.pluralize.singularize}"].each do |controller_name|
348
- begin
349
- controller = "#{namespace}#{controller_name.camelize}Controller".constantize
350
- rescue NameError => error
351
- # Only rescue NameError associated with the controller constant not existing - not other compile errors
352
- if error.message["uninitialized constant #{controller}"]
353
- error_message << "#{namespace}#{controller_name.camelize}Controller"
354
- next
355
- else
356
- raise
357
- end
358
- end
359
- raise ActiveScaffold::ControllerNotFound, "#{controller} missing ActiveScaffold", caller unless controller.uses_active_scaffold?
360
- raise ActiveScaffold::ControllerNotFound, "ActiveScaffold on #{controller} is not for #{klass} model.", caller unless controller.active_scaffold_config.model.to_s == klass.to_s
361
- return controller
362
- end
363
- end
364
- raise ActiveScaffold::ControllerNotFound, "Could not find " + error_message.join(" or "), caller
365
- end
366
-
367
- def uses_active_scaffold?
368
- !active_scaffold_config.nil?
369
- end
370
- end
371
- end
372
-
373
- require 'active_scaffold_env'