active_scaffold 3.0.26 → 3.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. data/CHANGELOG +1 -1
  2. data/{frontends/default → app/assets}/images/add.gif +0 -0
  3. data/{frontends/default → app/assets}/images/arrow_down.gif +0 -0
  4. data/{frontends/default → app/assets}/images/arrow_up.gif +0 -0
  5. data/{frontends/default → app/assets}/images/close.gif +0 -0
  6. data/{frontends/default → app/assets}/images/close_touch.png +0 -0
  7. data/{frontends/default → app/assets}/images/config.png +0 -0
  8. data/{frontends/default → app/assets}/images/cross.png +0 -0
  9. data/{frontends/default → app/assets}/images/gears.png +0 -0
  10. data/{frontends/default → app/assets}/images/indicator-small.gif +0 -0
  11. data/{frontends/default → app/assets}/images/indicator.gif +0 -0
  12. data/{frontends/default → app/assets}/images/magnifier.png +0 -0
  13. data/app/assets/javascripts/active_scaffold.js.erb +16 -0
  14. data/{frontends/default → app/assets}/javascripts/jquery/active_scaffold.js +16 -28
  15. data/app/assets/javascripts/jquery/active_scaffold.js~ +1036 -0
  16. data/{lib/active_scaffold/bridges/date_picker/public/javascripts/date_picker_bridge.js → app/assets/javascripts/jquery/date_picker_bridge.js.erb} +3 -1
  17. data/{frontends/default → app/assets}/javascripts/jquery/jquery.editinplace.js +0 -0
  18. data/app/assets/javascripts/prototype/active_scaffold.js +1033 -0
  19. data/{frontends/default/javascripts/prototype/active_scaffold.js → app/assets/javascripts/prototype/active_scaffold.js~} +1 -0
  20. data/{frontends/default → app/assets}/javascripts/prototype/dhtml_history.js +0 -0
  21. data/{frontends/default → app/assets}/javascripts/prototype/form_enhancements.js +0 -0
  22. data/{frontends/default → app/assets}/javascripts/prototype/rico_corner.js +0 -0
  23. data/{frontends/default/stylesheets/stylesheet-ie.css → app/assets/stylesheets/active_scaffold-ie.css} +0 -0
  24. data/{frontends/default/stylesheets/stylesheet.css → app/assets/stylesheets/active_scaffold.css.erb} +29 -24
  25. data/{lib/active_scaffold/locale → config/locales}/de.yml +3 -0
  26. data/{lib/active_scaffold/locale → config/locales}/en.yml +3 -0
  27. data/{lib/active_scaffold/locale → config/locales}/es.yml +5 -0
  28. data/{lib/active_scaffold/locale → config/locales}/fr.yml +3 -0
  29. data/{lib/active_scaffold/locale → config/locales}/hu.yml +13 -2
  30. data/{lib/active_scaffold/locale → config/locales}/ja.yml +9 -0
  31. data/{lib/active_scaffold/locale → config/locales}/ru.yml +3 -0
  32. data/frontends/default/views/_form.html.erb +1 -1
  33. data/frontends/default/views/_form_association.html.erb +1 -5
  34. data/frontends/default/views/_horizontal_subform.html.erb +7 -4
  35. data/frontends/default/views/_horizontal_subform.html.erb~ +2 -5
  36. data/frontends/default/views/_horizontal_subform_footer.html.erb +0 -0
  37. data/frontends/default/views/_horizontal_subform_header.html.erb +1 -1
  38. data/frontends/default/views/_horizontal_subform_header.html.erb~ +1 -1
  39. data/frontends/default/views/_horizontal_subform_record.html.erb~ +1 -1
  40. data/frontends/default/views/_list_actions.html.erb +1 -1
  41. data/frontends/default/views/_list_messages.html.erb +1 -3
  42. data/frontends/default/views/_render_field.js.erb +20 -0
  43. data/frontends/default/views/_row.html.erb +3 -9
  44. data/frontends/default/views/_show.html.erb +2 -2
  45. data/frontends/default/views/add_existing.js.erb +20 -0
  46. data/frontends/default/views/destroy.js.erb +24 -0
  47. data/frontends/default/views/{edit_associated.js.rjs → edit_associated.js.erb} +3 -2
  48. data/frontends/default/views/form_messages.js.erb +1 -0
  49. data/frontends/default/views/list.js.erb +1 -0
  50. data/frontends/default/views/mark.js.rjs +6 -0
  51. data/frontends/default/views/on_action_update.js.erb +13 -0
  52. data/frontends/default/views/{on_create.js.erb~ → on_create.js.erb} +0 -0
  53. data/frontends/default/views/on_mark_all.js.erb +12 -0
  54. data/frontends/default/views/{on_update.js.erb~ → on_update.js.erb} +0 -0
  55. data/frontends/default/views/render_field.js.erb +1 -0
  56. data/frontends/default/views/search.html.erb +1 -1
  57. data/frontends/default/views/{update_column.js.erb~ → update_column.js.erb} +3 -3
  58. data/frontends/default/views/update_row.js.erb +1 -0
  59. data/lib/active_scaffold.rb +22 -46
  60. data/lib/active_scaffold/actions/core.rb +14 -6
  61. data/lib/active_scaffold/actions/core.rb~ +3 -3
  62. data/lib/active_scaffold/actions/create.rb +2 -5
  63. data/lib/active_scaffold/actions/create.rb~ +3 -2
  64. data/lib/active_scaffold/actions/delete.rb +1 -0
  65. data/lib/active_scaffold/actions/field_search.rb +1 -1
  66. data/lib/active_scaffold/actions/list.rb +10 -6
  67. data/lib/active_scaffold/actions/list.rb~ +3 -3
  68. data/lib/active_scaffold/actions/mark.rb +8 -8
  69. data/lib/active_scaffold/actions/nested.rb +2 -9
  70. data/lib/active_scaffold/actions/nested.rb~ +5 -7
  71. data/lib/active_scaffold/actions/search.rb +2 -1
  72. data/lib/active_scaffold/actions/subform.rb +1 -5
  73. data/lib/active_scaffold/actions/update.rb +1 -4
  74. data/lib/active_scaffold/actions/update.rb~ +5 -5
  75. data/lib/active_scaffold/attribute_params.rb +15 -26
  76. data/lib/active_scaffold/attribute_params.rb~ +1 -2
  77. data/lib/active_scaffold/bridges.rb +61 -0
  78. data/lib/active_scaffold/bridges/ancestry.rb +5 -0
  79. data/lib/active_scaffold/bridges/ancestry/{lib/ancestry_bridge.rb → ancestry_bridge.rb} +3 -3
  80. data/lib/active_scaffold/bridges/{calendar_date_select/bridge.rb → calendar_date_select.rb} +13 -5
  81. data/lib/active_scaffold/bridges/calendar_date_select/{lib/as_cds_bridge.rb → as_cds_bridge.rb} +4 -20
  82. data/lib/active_scaffold/bridges/cancan.rb +15 -0
  83. data/lib/active_scaffold/bridges/cancan/{lib/cancan_bridge.rb → cancan_bridge.rb} +2 -2
  84. data/lib/active_scaffold/bridges/carrierwave.rb +12 -0
  85. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +31 -0
  86. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge_helpers.rb +10 -0
  87. data/lib/active_scaffold/bridges/carrierwave/{lib/form_ui.rb → form_ui.rb} +0 -0
  88. data/lib/active_scaffold/bridges/carrierwave/{lib/list_ui.rb → list_ui.rb} +1 -1
  89. data/lib/active_scaffold/bridges/country_helper.rb +9 -0
  90. data/lib/active_scaffold/bridges/country_helper/{lib/country_helper_bridge.rb → country_helper_bridge.rb} +5 -5
  91. data/lib/active_scaffold/bridges/date_picker.rb +23 -0
  92. data/lib/active_scaffold/bridges/date_picker/ext.rb +54 -0
  93. data/lib/active_scaffold/bridges/date_picker/helper.rb +188 -0
  94. data/lib/active_scaffold/bridges/dragonfly.rb +9 -0
  95. data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +34 -0
  96. data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge_helpers.rb +10 -0
  97. data/lib/active_scaffold/bridges/dragonfly/{lib/form_ui.rb → form_ui.rb} +0 -0
  98. data/lib/active_scaffold/bridges/dragonfly/{lib/list_ui.rb → list_ui.rb} +2 -2
  99. data/lib/active_scaffold/bridges/file_column.rb +11 -0
  100. data/lib/active_scaffold/bridges/file_column/{lib/as_file_column_bridge.rb → as_file_column_bridge.rb} +2 -2
  101. data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +57 -0
  102. data/lib/active_scaffold/bridges/file_column/{lib/form_ui.rb → form_ui.rb} +2 -2
  103. data/lib/active_scaffold/bridges/file_column/{lib/list_ui.rb → list_ui.rb} +0 -0
  104. data/lib/active_scaffold/bridges/paperclip.rb +12 -0
  105. data/lib/active_scaffold/bridges/paperclip/{lib/form_ui.rb → form_ui.rb} +0 -0
  106. data/lib/active_scaffold/bridges/paperclip/{lib/list_ui.rb → list_ui.rb} +3 -3
  107. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +36 -0
  108. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +24 -0
  109. data/lib/active_scaffold/bridges/record_select.rb +11 -0
  110. data/lib/active_scaffold/bridges/record_select/{lib/record_select_bridge.rb → helpers.rb} +5 -16
  111. data/lib/active_scaffold/bridges/record_select/helpers.rb~ +9 -14
  112. data/lib/active_scaffold/bridges/semantic_attributes.rb +5 -0
  113. data/lib/active_scaffold/bridges/semantic_attributes/{lib/semantic_attributes_bridge.rb → column.rb} +3 -3
  114. data/lib/active_scaffold/bridges/tiny_mce.rb +5 -0
  115. data/lib/active_scaffold/bridges/tiny_mce/{lib/tiny_mce_bridge.rb → helpers.rb} +16 -8
  116. data/lib/active_scaffold/config/base.rb +9 -1
  117. data/lib/active_scaffold/config/core.rb +1 -1
  118. data/lib/active_scaffold/config/create.rb +3 -10
  119. data/lib/active_scaffold/config/delete.rb +1 -2
  120. data/lib/active_scaffold/config/field_search.rb +1 -2
  121. data/lib/active_scaffold/config/form.rb +2 -6
  122. data/lib/active_scaffold/config/list.rb +8 -2
  123. data/lib/active_scaffold/config/nested.rb +2 -6
  124. data/lib/active_scaffold/config/search.rb +6 -2
  125. data/lib/active_scaffold/config/show.rb +1 -4
  126. data/lib/active_scaffold/config/subform.rb +1 -1
  127. data/lib/active_scaffold/config/update.rb +1 -6
  128. data/lib/active_scaffold/data_structures/action_columns.rb +3 -0
  129. data/lib/active_scaffold/data_structures/action_link.rb +14 -10
  130. data/lib/active_scaffold/data_structures/bridge.rb +22 -0
  131. data/lib/active_scaffold/data_structures/column.rb +36 -4
  132. data/lib/active_scaffold/data_structures/nested_info.rb +4 -4
  133. data/lib/active_scaffold/data_structures/set.rb +1 -6
  134. data/lib/active_scaffold/data_structures/sorting.rb +2 -2
  135. data/lib/active_scaffold/engine.rb +4 -0
  136. data/lib/active_scaffold/extensions/action_controller_rendering.rb +2 -2
  137. data/lib/active_scaffold/extensions/action_controller_rendering.rb~ +1 -1
  138. data/lib/active_scaffold/extensions/action_view_rendering.rb +90 -93
  139. data/lib/active_scaffold/extensions/action_view_rendering.rb~ +1 -13
  140. data/lib/active_scaffold/extensions/active_association_reflection.rb +16 -7
  141. data/lib/active_scaffold/extensions/cache_association.rb +16 -0
  142. data/lib/active_scaffold/extensions/reverse_associations.rb +15 -13
  143. data/lib/active_scaffold/extensions/unsaved_associated.rb +1 -1
  144. data/lib/active_scaffold/finder.rb +40 -23
  145. data/lib/active_scaffold/finder.rb~ +3 -11
  146. data/lib/active_scaffold/helpers/association_helpers.rb +1 -1
  147. data/lib/active_scaffold/helpers/controller_helpers.rb +9 -1
  148. data/lib/active_scaffold/helpers/controller_helpers.rb~ +12 -5
  149. data/lib/active_scaffold/helpers/form_column_helpers.rb +20 -21
  150. data/lib/active_scaffold/helpers/form_column_helpers.rb~ +2 -1
  151. data/lib/active_scaffold/helpers/id_helpers.rb +5 -5
  152. data/lib/active_scaffold/helpers/list_column_helpers.rb +14 -24
  153. data/lib/active_scaffold/helpers/list_column_helpers.rb~ +15 -20
  154. data/lib/active_scaffold/helpers/search_column_helpers.rb +10 -1
  155. data/lib/active_scaffold/helpers/search_column_helpers.rb~ +1 -1
  156. data/lib/active_scaffold/helpers/view_helpers.rb +14 -40
  157. data/lib/active_scaffold/helpers/view_helpers.rb~ +3 -3
  158. data/lib/active_scaffold/version.rb +2 -2
  159. data/lib/active_scaffold_env.rb +0 -2
  160. data/test/bridges/active_scaffold_dependent_protect_test.rb +34 -0
  161. data/test/bridges/bridge_test.rb +43 -0
  162. data/test/bridges/company.rb +81 -0
  163. data/test/bridges/paperclip_test.rb +68 -0
  164. data/test/bridges/tiny_mce_test.rb +27 -0
  165. data/test/bridges/unobtrusive_date_picker_test.rb +49 -0
  166. data/test/bridges/validation_reflection_test.rb +57 -0
  167. data/test/config/base_test.rb +1 -1
  168. data/test/config/core_test.rb +58 -0
  169. data/test/config/create_test.rb +8 -5
  170. data/test/config/delete_test.rb +33 -0
  171. data/test/config/field_search_test.rb +47 -0
  172. data/test/config/list_test.rb +64 -9
  173. data/test/config/nested_test.rb +62 -0
  174. data/test/config/search_test.rb +60 -0
  175. data/test/config/show_test.rb +5 -5
  176. data/test/config/subform_test.rb +17 -0
  177. data/test/config/update_test.rb +27 -4
  178. data/test/helpers/list_column_helpers_test.rb +16 -5
  179. data/test/helpers/pagination_helpers_test.rb +4 -0
  180. data/test/misc/attribute_params_test.rb +37 -1
  181. data/test/misc/finder_test.rb +0 -1
  182. data/test/misc/lang_test.rb +2 -3
  183. data/test/mock_app/public/javascripts/active_scaffold/default/active_scaffold.js +2 -2
  184. data/test/mock_app/public/stylesheets/active_scaffold/default/stylesheet.css +13 -7
  185. metadata +137 -154
  186. data/frontends/default/views/_list_with_header.html.erb~ +0 -32
  187. data/frontends/default/views/_render_field.js.rjs +0 -14
  188. data/frontends/default/views/_show.html.erb~ +0 -8
  189. data/frontends/default/views/_update_form.html.erb~ +0 -6
  190. data/frontends/default/views/add_existing.js.erb~ +0 -18
  191. data/frontends/default/views/add_existing.js.rjs +0 -17
  192. data/frontends/default/views/destroy.js.rjs +0 -23
  193. data/frontends/default/views/form_messages.js.rjs +0 -1
  194. data/frontends/default/views/list.js.rjs +0 -1
  195. data/frontends/default/views/on_action_update.js.rjs +0 -10
  196. data/frontends/default/views/on_create.js.rjs +0 -41
  197. data/frontends/default/views/on_mark_all.js.rjs +0 -12
  198. data/frontends/default/views/on_update.js.rjs +0 -28
  199. data/frontends/default/views/render_field.js.rjs +0 -1
  200. data/frontends/default/views/update_column.js.rjs +0 -13
  201. data/frontends/default/views/update_row.js.rjs +0 -1
  202. data/lib/active_scaffold.rb~ +0 -362
  203. data/lib/active_scaffold/bridges/ancestry/bridge.rb +0 -5
  204. data/lib/active_scaffold/bridges/bridge.rb +0 -59
  205. data/lib/active_scaffold/bridges/cancan/bridge.rb +0 -12
  206. data/lib/active_scaffold/bridges/carrierwave/bridge.rb +0 -9
  207. data/lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge.rb +0 -33
  208. data/lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb +0 -12
  209. data/lib/active_scaffold/bridges/country_helper/bridge.rb +0 -9
  210. data/lib/active_scaffold/bridges/date_picker/bridge.rb +0 -24
  211. data/lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb +0 -234
  212. data/lib/active_scaffold/bridges/dragonfly/bridge.rb +0 -9
  213. data/lib/active_scaffold/bridges/dragonfly/lib/dragonfly_bridge.rb +0 -36
  214. data/lib/active_scaffold/bridges/dragonfly/lib/dragonfly_bridge_helpers.rb +0 -12
  215. data/lib/active_scaffold/bridges/file_column/bridge.rb +0 -11
  216. data/lib/active_scaffold/bridges/file_column/lib/file_column_helpers.rb +0 -59
  217. data/lib/active_scaffold/bridges/paperclip/bridge.rb +0 -12
  218. data/lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge.rb +0 -38
  219. data/lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb +0 -26
  220. data/lib/active_scaffold/bridges/record_select/bridge.rb +0 -5
  221. data/lib/active_scaffold/bridges/semantic_attributes/bridge.rb +0 -5
  222. data/lib/active_scaffold/bridges/shared/date_bridge.rb~ +0 -209
  223. data/lib/active_scaffold/bridges/tiny_mce/bridge.rb +0 -5
  224. data/lib/active_scaffold/bridges/validation_reflection/bridge.rb +0 -8
  225. data/lib/active_scaffold/bridges/validation_reflection/lib/validation_reflection_bridge.rb +0 -21
  226. data/lib/active_scaffold/config/base.rb~ +0 -70
  227. data/lib/active_scaffold/config/nested.rb~ +0 -41
  228. data/lib/active_scaffold/constraints.rb~ +0 -186
  229. data/lib/active_scaffold/data_structures/action_link.rb~ +0 -179
  230. data/lib/active_scaffold/data_structures/nested_info.rb~ +0 -123
  231. data/lib/active_scaffold/extensions/action_view_resolver.rb +0 -7
  232. data/lib/active_scaffold/extensions/active_association_reflection.rb~ +0 -22
  233. data/lib/active_scaffold/extensions/unsaved_associated.rb~ +0 -62
  234. data/lib/active_scaffold_assets.rb +0 -45
  235. data/lib/generators/active_scaffold_setup/USAGE +0 -10
  236. data/lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb +0 -59
@@ -1,32 +0,0 @@
1
- <div id="<%= active_scaffold_id -%>" class="<%= as_main_div_class %>" <%= "data-eid=#{id_from_controller(params[:eid])}" if params[:eid]%>>
2
- <div class="active-scaffold-header">
3
- <%= render :partial => 'list_header' %>
4
- </div>
5
- <table cellpadding="0" cellspacing="0">
6
- <tbody class="before-header" id="<%= before_header_id -%>">
7
- <% if active_scaffold_config.list.always_show_search %>
8
- <tr>
9
- <td>
10
- <div class="active-scaffold show_search-view <%= "#{params[:controller]}-view" %> view">
11
- <%= render :partial => active_scaffold_config.list.search_partial %>
12
- </div>
13
- </td>
14
- </tr>
15
- <% else %>
16
- <tr><td></td></tr>
17
- <% end %>
18
- <% if !nested? && active_scaffold_config.list.always_show_create %>
19
- <tr>
20
- <td>
21
- <div class="active-scaffold create-view <%= "#{params[:controller]}-view" %> view">
22
- <%= render :partial => 'create_form_on_list' %>
23
- </div>
24
- </td>
25
- </tr>
26
- <% end %>
27
- </tbody>
28
- </table>
29
- <div id="<%= active_scaffold_content_id-%>" class="as_content">
30
- <%= render :partial => 'list' %>
31
- </div>
32
- </div>
@@ -1,14 +0,0 @@
1
- column = active_scaffold_config.columns[render_field.to_sym]
2
- @rendered ||= Set.new
3
- return if @rendered.include? column.name
4
- @rendered << column.name
5
- if column_renders_as(column) == :subform
6
- options = {:is_subform => true, :field_class => "#{column.name}-sub-form"}
7
- else
8
- options = {:is_subform => false, :field_class => "#{column.name}-input"}
9
- end
10
- page.call 'ActiveScaffold.render_form_field', source_id, render(:partial => form_partial_for_column(column), :locals => { :column => column, :scope => scope }), options
11
- page << render(:partial => "render_field", :collection => column.update_columns, :locals => {:source_id => source_id, :scope => scope}) if column.update_columns && !column.update_columns.empty?
12
-
13
-
14
-
@@ -1,8 +0,0 @@
1
- <h4><%= active_scaffold_config.show.label(@record.to_label.nil? ? nil : clean_column_value(@record.to_label)) %></h4>
2
-
3
- <%= render :partial => 'show_columns', :locals => {:columns => active_scaffold_config.show.columns} -%>
4
-
5
- <p class="form-footer">
6
- <%= link_to as_(:close), main_path_to_return, :class => 'as_cancel', :remote => request.xhr?, 'data-refresh' => false %>
7
- <%= loading_indicator_tag(:action => :create, :id => params[:id]) %>
8
- </p>
@@ -1,6 +0,0 @@
1
- <% cancel_link = true if cancel_link.nil? %>
2
- <%= render :partial => "base_form", :locals => {:xhr => xhr ||= nil,
3
- :form_action => form_action ||= :update,
4
- :method => method ||= :put,
5
- :cancel_link => cancel_link,
6
- :headline => headline ||= @record.to_label.nil? ? active_scaffold_config.update.label : as_(:update_model, :model => clean_column_value(@record.to_label))} %>
@@ -1,18 +0,0 @@
1
- <% new_row = render :partial => 'list_record', :locals => {:record => @record} %>
2
- ActiveScaffold.create_record_row('<%= active_scaffold_id %>', '<%= escape_javascript(new_row) %>', <%= {:insert_at => :top}.to_json.html_safe %>);
3
-
4
- <% if active_scaffold_config.list.columns.any? {|c| c.calculation?} %>
5
- ActiveScaffold.replace('<%= active_scaffold_calculations_id %>', '<%= escape_javascript(render(:partial => 'list_calculations')) %>');
6
- <%end%>
7
-
8
- <% if form_stays_open ||= true %>
9
- <%# why not just re-render the form? that wouldn't utilize a possible do_new override which sets default values.%>
10
- ActiveScaffold.reset_form('<%= element_form_id %>');
11
- ActiveScaffold.replace_html('<%= element_messages_id(:action => :add_existing) %>', '<%= escape_javascript(render(:partial => 'form_messages')) %>');
12
- <%# have to delay the focus, because there's no "firstElement" in prototype until at least one element is not disabled%>
13
- <% if ActiveScaffold.js_framework == :prototype %>
14
- ActiveScaffold.focus_first_element_of_form.defer('<%= element_form_id %>');
15
- <% end %>
16
- <% else %>
17
- ActiveScaffold.find_action_link('<%element_form_id(:action => :new_existing)%>').close();
18
- <% end %>
@@ -1,17 +0,0 @@
1
- new_row = render :partial => 'list_record', :locals => {:record => @record}
2
- page << "ActiveScaffold.create_record_row('#{active_scaffold_id}','#{escape_javascript(new_row)}', #{{:insert_at => :top}.to_json});"
3
- page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}
4
-
5
- if (form_stays_open = true)
6
- # why not just re-render the form? that wouldn't utilize a possible do_new override which sets default values.
7
- page.call 'ActiveScaffold.reset_form', element_form_id
8
- page.call 'ActiveScaffold.replace_html', element_messages_id(:action => :add_existing), render(:partial => 'form_messages')
9
- # have to delay the focus, because there's no "firstElement" in prototype until at least one element is not disabled
10
- if ActiveScaffold.js_framework == :prototype
11
- page.delay 0.1 do
12
- page << "ActiveScaffold.focus_first_element_of_form('#{element_form_id}');"
13
- end
14
- end
15
- else
16
- page << "ActiveScaffold.find_action_link('#{element_form_id(:action => :new_existing)}').close();"
17
- end
@@ -1,23 +0,0 @@
1
- messages_id = active_scaffold_messages_id
2
- if controller.send(:successful?)
3
- if render_parent? && controller.respond_to?(:render_component_into_view)
4
- render_parent_options
5
- if render_parent_action == :row
6
- # TODO: That s not working with delete....
7
- page << "ActiveScaffold.delete_record_row('#{element_row_id(:controller_id => "as_#{id_from_controller(params[:eid] || params[:parent_sti])}", :action => 'list', :id => params[:id])}','#{url_for(params_for(:action => :index, :id => nil, :page => [active_scaffold_config.list.user.page.to_i - 1, 1].max, :escape => false))}');"
8
- messages_id = active_scaffold_messages_id(:controller_id => "as_#{id_from_controller(params[:eid] || params[:parent_sti])}")
9
- elsif render_parent_action == :index
10
- parent_rendered = controller.send(:render_component_into_view, render_parent_options)
11
- page << parent_rendered
12
- end
13
- #page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}
14
- elsif (active_scaffold_config.delete.refresh_list)
15
- page.call 'ActiveScaffold.replace_html', active_scaffold_content_id, render(:partial => 'list', :layout => false)
16
- else
17
- page << "ActiveScaffold.delete_record_row('#{element_row_id(:action => 'list', :id => params[:id])}','#{url_for(params_for(:action => :index, :id => nil, :page => [active_scaffold_config.list.user.page.to_i - 1, 1].max, :escape => false))}');"
18
- page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}
19
- end
20
- else
21
- 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)
22
- end
23
- page.call 'ActiveScaffold.replace_html', messages_id, render(:partial => 'messages')
@@ -1 +0,0 @@
1
- page.replace_html element_messages_id, :partial => 'form_messages'
@@ -1 +0,0 @@
1
- page.call 'ActiveScaffold.replace_html', active_scaffold_content_id, render(:partial => 'list', :layout => false)
@@ -1,10 +0,0 @@
1
- if controller.send :successful?
2
- page.call 'ActiveScaffold.replace_html', active_scaffold_messages_id, render(:partial => 'messages')
3
- page.call 'ActiveScaffold.update_row', element_row_id(:action => :list, :id => @record.id), render(:partial => 'list_record', :locals => {:record => @record}) if @record
4
- page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}
5
- else
6
- 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)
7
- page.call 'ActiveScaffold.replace_html', active_scaffold_messages_id, render(:partial => 'messages')
8
- page.call 'ActiveScaffold.scroll_to', active_scaffold_messages_id
9
- end
10
-
@@ -1,41 +0,0 @@
1
- form_selector = "#{element_form_id(:action => :create)}"
2
- insert_at ||= :top
3
- page << "var action_link = ActiveScaffold.find_action_link('#{form_selector}');"
4
- page << "action_link.update_flash_messages('#{escape_javascript(render(:partial => 'messages').strip)}');"
5
- if controller.send :successful?
6
- if render_parent? && controller.respond_to?(:render_component_into_view)
7
- parent_rendered = controller.send(:render_component_into_view, render_parent_options)
8
- if nested_singular_association?
9
- page << "action_link.close('#{escape_javascript(parent_rendered)}');"
10
- else
11
- if render_parent_action == :row
12
- page << "ActiveScaffold.create_record_row(action_link.scaffold(),'#{escape_javascript(parent_rendered)}', #{{:insert_at => insert_at}.to_json});"
13
- elsif render_parent_action == :index
14
- page << parent_rendered
15
- end
16
- page << "action_link.close();"
17
- end
18
- #page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}
19
- elsif (active_scaffold_config.create.refresh_list)
20
- page.call 'ActiveScaffold.replace_html', active_scaffold_content_id, render(:partial => 'list', :layout => false)
21
- elsif params[:parent_controller].nil?
22
- new_row = render :partial => 'list_record', :locals => {:record => @record}
23
- page << "ActiveScaffold.create_record_row(action_link.scaffold(),'#{escape_javascript(new_row)}', #{{:insert_at => insert_at}.to_json});"
24
- page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}
25
- end
26
-
27
- unless render_parent?
28
- if (active_scaffold_config.create.persistent)
29
- page << "action_link.reload();"
30
- else
31
- page << "action_link.close();"
32
- end
33
- if (active_scaffold_config.create.action_after_create)
34
- page << "var link = $('#{action_link_id active_scaffold_config.create.action_after_create, @record.id}');"
35
- page << "if (link) (function() { link.action_link.open() }).defer();"
36
- end
37
- end
38
- else
39
- page.call 'ActiveScaffold.replace', form_selector, render(:partial => 'create_form', :locals => {:xhr => true})
40
- page.call 'ActiveScaffold.scroll_to', form_selector
41
- end
@@ -1,12 +0,0 @@
1
- options = {:checked => mark_all,
2
- :include_mark_all => true}
3
- page << "ActiveScaffold.mark_records('#{active_scaffold_tbody_id}', #{options.to_json});"
4
- if active_scaffold_config.model.marked.length>0 then
5
- if active_scaffold_config.model.marked.length < @page.pager.count then
6
- page.call 'ActiveScaffold.replace_html', active_scaffold_messages_id, active_scaffold_config.model.marked.length.to_s + " records marked. Press <a href=\""+url_for(:action=>"mark_all",:mark_target=>"scope")+"\">here</a> to select all #{@page.pager.count} records.".html_safe
7
- else
8
- page.call 'ActiveScaffold.replace_html', active_scaffold_messages_id, "All #{@page.pager.count} records marked"
9
- end
10
- else
11
- page.call 'ActiveScaffold.replace_html', active_scaffold_messages_id, ""
12
- end
@@ -1,28 +0,0 @@
1
- form_selector = "#{element_form_id(:action => :update)}"
2
-
3
- page << "var action_link = ActiveScaffold.find_action_link('#{form_selector}');"
4
- page << "action_link.update_flash_messages('#{escape_javascript(render(:partial => 'messages').strip)}');"
5
- if controller.send :successful?
6
- if render_parent? && controller.respond_to?(:render_component_into_view)
7
- parent_rendered = controller.send(:render_component_into_view, render_parent_options)
8
- if nested_singular_association?
9
- page << "action_link.close('#{escape_javascript(parent_rendered)}');"
10
- else
11
- if render_parent_action == :row
12
- page << "action_link.close('#{escape_javascript(parent_rendered)}');"
13
- elsif render_parent_action == :index
14
- page << parent_rendered
15
- end
16
- end
17
- #page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}
18
- elsif update_refresh_list?
19
- page.call 'ActiveScaffold.replace_html', active_scaffold_content_id, render(:partial => 'list', :layout => false)
20
- else
21
- updated_row = render :partial => 'list_record', :locals => {:record => @record}
22
- page << "action_link.close('#{escape_javascript(updated_row)}');"
23
- page.call 'ActiveScaffold.replace', active_scaffold_calculations_id, render(:partial => 'list_calculations') if active_scaffold_config.list.columns.any? {|c| c.calculation?}
24
- end
25
- else
26
- page.call 'ActiveScaffold.replace', form_selector, render(:partial => 'update_form', :locals => {:xhr => true})
27
- page.call 'ActiveScaffold.scroll_to', form_selector
28
- end
@@ -1 +0,0 @@
1
- page << render(:partial => "render_field", :collection => columns, :locals => {:source_id => source_id, :scope => scope})
@@ -1,13 +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
- page.call 'alert', @record.errors.full_messages.join("\n")
4
- @record.reload
5
- end
6
- column = active_scaffold_config.columns[params[:column]]
7
- if column.inplace_edit
8
- page.call 'ActiveScaffold.replace_html', column_span_id, format_inplace_edit_column(@record, column)
9
- else
10
- formatted_value = get_column_value(@record, column)
11
- page.call 'ActiveScaffold.replace_html', column_span_id, formatted_value
12
- end
13
- page.call 'ActiveScaffold.replace_html', active_scaffold_calculations_id(column), render_column_calculation(column) if column.calculation?
@@ -1 +0,0 @@
1
- page.call 'ActiveScaffold.update_row', element_row_id(:action => 'list', :id => @record.id), render(:partial => 'list_record', :locals => {:record => @record})
@@ -1,362 +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
-
17
- module ActiveScaffold
18
- autoload :AttributeParams, 'active_scaffold/attribute_params'
19
- autoload :Configurable, 'active_scaffold/configurable'
20
- autoload :Constraints, 'active_scaffold/constraints'
21
- autoload :Finder, 'active_scaffold/finder'
22
- autoload :MarkedModel, 'active_scaffold/marked_model'
23
- autoload :Bridges, 'active_scaffold/bridges'
24
-
25
- mattr_accessor :stylesheets
26
- self.stylesheets = []
27
- mattr_accessor :javascripts
28
- self.javascripts = []
29
-
30
- def self.autoload_subdir(dir, mod=self, root = File.dirname(__FILE__))
31
- Dir["#{root}/active_scaffold/#{dir}/*.rb"].each { |file|
32
- basename = File.basename(file, ".rb")
33
- mod.module_eval {
34
- autoload basename.camelcase.to_sym, "active_scaffold/#{dir}/#{basename}"
35
- }
36
- }
37
- end
38
-
39
- module Actions
40
- ActiveScaffold.autoload_subdir('actions', self)
41
- end
42
-
43
- module Config
44
- ActiveScaffold.autoload_subdir('config', self)
45
- end
46
-
47
- module DataStructures
48
- ActiveScaffold.autoload_subdir('data_structures', self)
49
- end
50
-
51
- module Helpers
52
- ActiveScaffold.autoload_subdir('helpers', self)
53
- end
54
-
55
- class ControllerNotFound < RuntimeError; end
56
- class DependencyFailure < RuntimeError; end
57
- class MalformedConstraint < RuntimeError; end
58
- class RecordNotAllowed < SecurityError; end
59
- class ActionNotAllowed < SecurityError; end
60
- class ReverseAssociationRequired < RuntimeError; end
61
-
62
- def self.included(base)
63
- base.extend(ClassMethods)
64
- base.module_eval do
65
- # TODO: these should be in actions/core
66
- before_filter :handle_user_settings
67
- before_filter :check_input_device
68
- end
69
-
70
- base.helper_method :touch_device?
71
- base.helper_method :hover_via_click?
72
- end
73
-
74
- def self.set_defaults(&block)
75
- ActiveScaffold::Config::Core.configure &block
76
- end
77
-
78
- def active_scaffold_config
79
- self.class.active_scaffold_config
80
- end
81
-
82
- def active_scaffold_config_for(klass)
83
- self.class.active_scaffold_config_for(klass)
84
- end
85
-
86
- def active_scaffold_session_storage(id = (params[:eid] || params[:controller]))
87
- session_index = "as:#{id}"
88
- session[session_index] ||= {}
89
- session[session_index]
90
- end
91
-
92
- # 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.
93
- def handle_user_settings
94
- if self.class.uses_active_scaffold?
95
- active_scaffold_config.actions.each do |action_name|
96
- conf_instance = active_scaffold_config.send(action_name) rescue next
97
- next if conf_instance.class::UserSettings == ActiveScaffold::Config::Base::UserSettings # if it hasn't been extended, skip it
98
- active_scaffold_session_storage[action_name] ||= {}
99
- conf_instance.user = conf_instance.class::UserSettings.new(conf_instance, active_scaffold_session_storage[action_name], params)
100
- end
101
- end
102
- end
103
-
104
- def check_input_device
105
- if request.env["HTTP_USER_AGENT"] && request.env["HTTP_USER_AGENT"][/(iPhone|iPod|iPad)/i]
106
- session[:input_device_type] = 'TOUCH'
107
- session[:hover_supported] = false
108
- else
109
- session[:input_device_type] = 'MOUSE'
110
- session[:hover_supported] = true
111
- end if session[:input_device_type].nil?
112
- end
113
-
114
- def touch_device?
115
- session[:input_device_type] == 'TOUCH'
116
- end
117
-
118
- def hover_via_click?
119
- session[:hover_supported] == false
120
- end
121
-
122
- def self.js_framework=(framework)
123
- @@js_framework = framework
124
- end
125
-
126
- def self.js_framework
127
- @@js_framework ||= if defined? Jquery
128
- :jquery
129
- elsif defined? PrototypeRails
130
- :prototype
131
- end
132
- end
133
-
134
- # exclude bridges you do not need
135
- # name of bridge subdir should be used to exclude it
136
- # eg
137
- # ActiveScaffold.exclude_bridges = [:cancan, :ancestry]
138
- # if you are using Activescaffold as a gem add to initializer
139
- # if you are using Activescaffold as a plugin add to active_scaffold_env.rb
140
- def self.exclude_bridges=(bridges)
141
- @@exclude_bridges = bridges
142
- end
143
-
144
- def self.exclude_bridges
145
- @@exclude_bridges ||= []
146
- end
147
-
148
- def self.root
149
- File.dirname(__FILE__) + "/.."
150
- end
151
-
152
- module ClassMethods
153
- def active_scaffold(model_id = nil, &block)
154
- # initialize bridges here
155
- ActiveScaffold::Bridges.run_all
156
-
157
- # converts Foo::BarController to 'bar' and FooBarsController to 'foo_bar' and AddressController to 'address'
158
- model_id = self.to_s.split('::').last.sub(/Controller$/, '').pluralize.singularize.underscore unless model_id
159
-
160
- # run the configuration
161
- @active_scaffold_config = ActiveScaffold::Config::Core.new(model_id)
162
- @active_scaffold_config_block = block
163
- self.links_for_associations
164
-
165
- @active_scaffold_frontends = []
166
- if active_scaffold_config.frontend.to_sym != :default
167
- active_scaffold_custom_frontend_path = File.join(ActiveScaffold::Config::Core.plugin_directory, 'frontends', active_scaffold_config.frontend.to_s , 'views')
168
- @active_scaffold_frontends << active_scaffold_custom_frontend_path
169
- end
170
- active_scaffold_default_frontend_path = File.join(ActiveScaffold::Config::Core.plugin_directory, 'frontends', 'default' , 'views')
171
- @active_scaffold_frontends << active_scaffold_default_frontend_path
172
- @active_scaffold_custom_paths = []
173
-
174
- self.active_scaffold_superclasses_blocks.each {|superblock| self.active_scaffold_config.configure &superblock}
175
- self.active_scaffold_config.sti_children = nil # reset sti_children if set in parent block
176
- self.active_scaffold_config.configure &block if block_given?
177
- self.active_scaffold_config._configure_sti unless self.active_scaffold_config.sti_children.nil?
178
- self.active_scaffold_config._load_action_columns
179
-
180
- # defines the attribute read methods on the model, so record.send() doesn't find protected/private methods instead
181
- klass = self.active_scaffold_config.model
182
- klass.define_attribute_methods unless klass.attribute_methods_generated?
183
- # include the rest of the code into the controller: the action core and the included actions
184
- module_eval do
185
- include ActiveScaffold::Finder
186
- include ActiveScaffold::Constraints
187
- include ActiveScaffold::AttributeParams
188
- include ActiveScaffold::Actions::Core
189
- active_scaffold_config.actions.each do |mod|
190
- name = mod.to_s.camelize
191
- include "ActiveScaffold::Actions::#{name}".constantize
192
-
193
- # sneak the action links from the actions into the main set
194
- if link = active_scaffold_config.send(mod).link rescue nil
195
- if link.is_a? Array
196
- link.each {|current| active_scaffold_config.action_links.add_to_group(current, active_scaffold_config.send(mod).action_group)}
197
- elsif link.is_a? ActiveScaffold::DataStructures::ActionLink
198
- active_scaffold_config.action_links.add_to_group(link, active_scaffold_config.send(mod).action_group)
199
- end
200
- end
201
- end
202
- end
203
- self.append_view_path active_scaffold_paths
204
- self._add_sti_create_links if self.active_scaffold_config.add_sti_create_links?
205
- end
206
-
207
- def parent_prefixes
208
- @parent_prefixes ||= super << 'active_scaffold_overrides' << ''
209
- end
210
-
211
- # To be called after include action modules
212
- def _add_sti_create_links
213
- new_action_link = active_scaffold_config.action_links.collection['new']
214
- unless new_action_link.nil? || active_scaffold_config.sti_children.empty?
215
- active_scaffold_config.action_links.collection.delete('new')
216
- active_scaffold_config.sti_children.each do |child|
217
- new_sti_link = Marshal.load(Marshal.dump(new_action_link)) # deep clone
218
- new_sti_link.label = child.to_s.camelize.constantize.model_name.human
219
- new_sti_link.parameters = {:parent_sti => controller_path}
220
- new_sti_link.controller = Proc.new { active_scaffold_controller_for(child.to_s.camelize.constantize).controller_path }
221
- active_scaffold_config.action_links.collection.create.add(new_sti_link)
222
- end
223
- end
224
- end
225
-
226
- # 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?
227
- def links_for_associations
228
- return unless active_scaffold_config.actions.include? :list and active_scaffold_config.actions.include? :nested
229
- active_scaffold_config.columns.each do |column|
230
- next unless column.link.nil? and column.autolink?
231
- #lazy load of action_link, cause it was really slowing down app in dev mode
232
- #and might lead to trouble cause of cyclic constantization of controllers
233
- #and might be unnecessary cause it is done before columns are configured
234
- column.set_link(Proc.new {|col| link_for_association(col)})
235
- end
236
- end
237
-
238
- def active_scaffold_controller_for_column(column, options = {})
239
- begin
240
- if column.polymorphic_association?
241
- :polymorph
242
- elsif options.include?(:controller)
243
- "#{options[:controller].to_s.camelize}Controller".constantize
244
- else
245
- active_scaffold_controller_for(column.association.klass)
246
- end
247
- rescue ActiveScaffold::ControllerNotFound
248
- nil
249
- end
250
- end
251
-
252
- def link_for_association(column, options = {})
253
- controller = active_scaffold_controller_for_column(column, options)
254
-
255
- unless controller.nil?
256
- options.reverse_merge! :label => column.label, :position => :after, :type => :member, :controller => (controller == :polymorph ? controller : controller.controller_path), :column => column
257
- options[:parameters] ||= {}
258
- options[:parameters].reverse_merge! :parent_scaffold => controller_path, :association => column.association.name
259
- if column.plural_association?
260
- # note: we can't create nested scaffolds on :through associations because there's no reverse association.
261
-
262
- ActiveScaffold::DataStructures::ActionLink.new('index', options) #unless column.through_association?
263
- else
264
- actions = [:create, :update, :show]
265
- actions = controller.active_scaffold_config.actions unless controller == :polymorph
266
- column.actions_for_association_links.delete :new unless actions.include? :create
267
- column.actions_for_association_links.delete :edit unless actions.include? :update
268
- column.actions_for_association_links.delete :show unless actions.include? :show
269
- ActiveScaffold::DataStructures::ActionLink.new(nil, options.merge({:crud_type => nil, :html_options => {:class => column.name}}))
270
- end
271
- end
272
- end
273
-
274
- def link_for_association_as_scope(scope, options = {})
275
- options.reverse_merge! :label => scope, :position => :after, :type => :member, :controller => controller_path
276
- options[:parameters] ||= {}
277
- options[:parameters].reverse_merge! :parent_scaffold => controller_path, :named_scope => scope
278
- ActiveScaffold::DataStructures::ActionLink.new('index', options)
279
- end
280
-
281
- def add_active_scaffold_path(path)
282
- @active_scaffold_paths = nil # Force active_scaffold_paths to rebuild
283
- @active_scaffold_custom_paths << path
284
- end
285
-
286
- def active_scaffold_paths
287
- return @active_scaffold_paths unless @active_scaffold_paths.nil?
288
-
289
- @active_scaffold_paths = []
290
- @active_scaffold_paths.concat @active_scaffold_custom_paths unless @active_scaffold_custom_paths.nil?
291
- @active_scaffold_paths.concat @active_scaffold_frontends unless @active_scaffold_frontends.nil?
292
- @active_scaffold_paths
293
- end
294
-
295
- def active_scaffold_config
296
- if @active_scaffold_config.nil?
297
- self.superclass.active_scaffold_config if self.superclass.respond_to? :active_scaffold_config
298
- else
299
- @active_scaffold_config
300
- end
301
- end
302
-
303
- def active_scaffold_config_block
304
- @active_scaffold_config_block
305
- end
306
-
307
- def active_scaffold_superclasses_blocks
308
- blocks = []
309
- klass = self.superclass
310
- while klass.respond_to? :active_scaffold_superclasses_blocks
311
- blocks << klass.active_scaffold_config_block
312
- klass = klass.superclass
313
- end
314
- blocks.compact.reverse
315
- end
316
-
317
- def active_scaffold_config_for(klass)
318
- begin
319
- controller = active_scaffold_controller_for(klass)
320
- rescue ActiveScaffold::ControllerNotFound
321
- config = ActiveScaffold::Config::Core.new(klass)
322
- config._load_action_columns
323
- config
324
- else
325
- controller.active_scaffold_config
326
- end
327
- end
328
-
329
- # Tries to find a controller for the given ActiveRecord model.
330
- # Searches in the namespace of the current controller for singular and plural versions of the conventional "#{model}Controller" syntax.
331
- # You may override this method to customize the search routine.
332
- def active_scaffold_controller_for(klass)
333
- controller_namespace = self.to_s.split('::')[0...-1].join('::') + '::'
334
- error_message = []
335
- [controller_namespace, ''].each do |namespace|
336
- ["#{klass.to_s.underscore.pluralize}", "#{klass.to_s.underscore.pluralize.singularize}"].each do |controller_name|
337
- begin
338
- controller = "#{namespace}#{controller_name.camelize}Controller".constantize
339
- rescue NameError => error
340
- # Only rescue NameError associated with the controller constant not existing - not other compile errors
341
- if error.message["uninitialized constant #{controller}"]
342
- error_message << "#{namespace}#{controller_name.camelize}Controller"
343
- next
344
- else
345
- raise
346
- end
347
- end
348
- raise ActiveScaffold::ControllerNotFound, "#{controller} missing ActiveScaffold", caller unless controller.uses_active_scaffold?
349
- raise ActiveScaffold::ControllerNotFound, "ActiveScaffold on #{controller} is not for #{klass} model.", caller unless controller.active_scaffold_config.model.to_s == klass.to_s
350
- return controller
351
- end
352
- end
353
- raise ActiveScaffold::ControllerNotFound, "Could not find " + error_message.join(" or "), caller
354
- end
355
-
356
- def uses_active_scaffold?
357
- !active_scaffold_config.nil?
358
- end
359
- end
360
- end
361
-
362
- require 'active_scaffold_env'