active_scaffold 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +27 -0
- data/CHANGELOG +152 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +20 -0
- data/README +51 -0
- data/Rakefile +24 -0
- data/active_scaffold.gemspec +24 -0
- data/environment.rb +22 -0
- data/frontends/default/images/add.gif +0 -0
- data/frontends/default/images/arrow_down.gif +0 -0
- data/frontends/default/images/arrow_up.gif +0 -0
- data/frontends/default/images/close.gif +0 -0
- data/frontends/default/images/cross.png +0 -0
- data/frontends/default/images/indicator-small.gif +0 -0
- data/frontends/default/images/indicator.gif +0 -0
- data/frontends/default/images/magnifier.png +0 -0
- data/frontends/default/javascripts/jquery/active_scaffold.js +957 -0
- data/frontends/default/javascripts/jquery/jquery.editinplace.js +726 -0
- data/frontends/default/javascripts/prototype/active_scaffold.js +954 -0
- data/frontends/default/javascripts/prototype/dhtml_history.js +867 -0
- data/frontends/default/javascripts/prototype/form_enhancements.js +117 -0
- data/frontends/default/javascripts/prototype/rico_corner.js +370 -0
- data/frontends/default/stylesheets/stylesheet-ie.css +35 -0
- data/frontends/default/stylesheets/stylesheet.css +858 -0
- data/frontends/default/views/_add_existing_form.html.erb +30 -0
- data/frontends/default/views/_base_form.html.erb +41 -0
- data/frontends/default/views/_create_form.html.erb +6 -0
- data/frontends/default/views/_create_form_on_list.html.erb +5 -0
- data/frontends/default/views/_field_search.html.erb +32 -0
- data/frontends/default/views/_form.html.erb +24 -0
- data/frontends/default/views/_form_association.html.erb +14 -0
- data/frontends/default/views/_form_association_footer.html.erb +40 -0
- data/frontends/default/views/_form_attribute.html.erb +15 -0
- data/frontends/default/views/_form_hidden_attribute.html.erb +2 -0
- data/frontends/default/views/_form_messages.html.erb +5 -0
- data/frontends/default/views/_horizontal_subform.html.erb +19 -0
- data/frontends/default/views/_horizontal_subform_header.html.erb +10 -0
- data/frontends/default/views/_horizontal_subform_record.html.erb +37 -0
- data/frontends/default/views/_human_conditions.html.erb +1 -0
- data/frontends/default/views/_list.html.erb +18 -0
- data/frontends/default/views/_list_actions.html.erb +16 -0
- data/frontends/default/views/_list_calculations.html.erb +16 -0
- data/frontends/default/views/_list_column_headings.html.erb +12 -0
- data/frontends/default/views/_list_header.html.erb +12 -0
- data/frontends/default/views/_list_inline_adapter.html.erb +10 -0
- data/frontends/default/views/_list_messages.html.erb +32 -0
- data/frontends/default/views/_list_pagination.html.erb +11 -0
- data/frontends/default/views/_list_pagination_links.html.erb +9 -0
- data/frontends/default/views/_list_record.html.erb +14 -0
- data/frontends/default/views/_list_record_columns.html.erb +8 -0
- data/frontends/default/views/_list_with_header.html.erb +32 -0
- data/frontends/default/views/_messages.html.erb +10 -0
- data/frontends/default/views/_render_field.js.rjs +13 -0
- data/frontends/default/views/_row.html.erb +12 -0
- data/frontends/default/views/_search.html.erb +34 -0
- data/frontends/default/views/_search_attribute.html.erb +10 -0
- data/frontends/default/views/_show.html.erb +8 -0
- data/frontends/default/views/_show_columns.html.erb +12 -0
- data/frontends/default/views/_update_actions.html.erb +9 -0
- data/frontends/default/views/_update_form.html.erb +5 -0
- data/frontends/default/views/_vertical_subform.html.erb +12 -0
- data/frontends/default/views/_vertical_subform_record.html.erb +38 -0
- data/frontends/default/views/add_existing.js.rjs +17 -0
- data/frontends/default/views/add_existing_form.html.erb +5 -0
- data/frontends/default/views/create.html.erb +5 -0
- data/frontends/default/views/delete.html.erb +13 -0
- data/frontends/default/views/destroy.js.rjs +5 -0
- data/frontends/default/views/edit_associated.js.rjs +11 -0
- data/frontends/default/views/field_search.html.erb +5 -0
- data/frontends/default/views/form_messages.js.rjs +1 -0
- data/frontends/default/views/list.html.erb +1 -0
- data/frontends/default/views/list.js.rjs +1 -0
- data/frontends/default/views/on_action_update.js.rjs +8 -0
- data/frontends/default/views/on_create.js.rjs +24 -0
- data/frontends/default/views/on_update.js.rjs +15 -0
- data/frontends/default/views/search.html.erb +5 -0
- data/frontends/default/views/show.html.erb +5 -0
- data/frontends/default/views/update.html.erb +8 -0
- data/frontends/default/views/update_column.js.rjs +13 -0
- data/frontends/default/views/update_row.js.rjs +1 -0
- data/init.rb +1 -0
- data/install_assets.rb +44 -0
- data/lib/active_record_permissions.rb +134 -0
- data/lib/active_scaffold.rb +279 -0
- data/lib/active_scaffold/actions/common_search.rb +22 -0
- data/lib/active_scaffold/actions/core.rb +150 -0
- data/lib/active_scaffold/actions/create.rb +152 -0
- data/lib/active_scaffold/actions/delete.rb +72 -0
- data/lib/active_scaffold/actions/field_search.rb +82 -0
- data/lib/active_scaffold/actions/list.rb +128 -0
- data/lib/active_scaffold/actions/mark.rb +50 -0
- data/lib/active_scaffold/actions/nested.rb +241 -0
- data/lib/active_scaffold/actions/search.rb +47 -0
- data/lib/active_scaffold/actions/show.rb +54 -0
- data/lib/active_scaffold/actions/subform.rb +17 -0
- data/lib/active_scaffold/actions/update.rb +134 -0
- data/lib/active_scaffold/attribute_params.rb +207 -0
- data/lib/active_scaffold/bridges/ancestry/bridge.rb +5 -0
- data/lib/active_scaffold/bridges/ancestry/lib/ancestry_bridge.rb +38 -0
- data/lib/active_scaffold/bridges/bridge.rb +52 -0
- data/lib/active_scaffold/bridges/calendar_date_select/bridge.rb +16 -0
- data/lib/active_scaffold/bridges/calendar_date_select/lib/as_cds_bridge.rb +79 -0
- data/lib/active_scaffold/bridges/carrierwave/bridge.rb +7 -0
- data/lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge.rb +38 -0
- data/lib/active_scaffold/bridges/carrierwave/lib/carrierwave_bridge_helpers.rb +26 -0
- data/lib/active_scaffold/bridges/carrierwave/lib/form_ui.rb +35 -0
- data/lib/active_scaffold/bridges/carrierwave/lib/list_ui.rb +17 -0
- data/lib/active_scaffold/bridges/date_picker/bridge.rb +22 -0
- data/lib/active_scaffold/bridges/date_picker/lib/datepicker_bridge.rb +225 -0
- data/lib/active_scaffold/bridges/date_picker/public/javascripts/date_picker_bridge.js +22 -0
- data/lib/active_scaffold/bridges/file_column/bridge.rb +11 -0
- data/lib/active_scaffold/bridges/file_column/lib/as_file_column_bridge.rb +46 -0
- data/lib/active_scaffold/bridges/file_column/lib/file_column_helpers.rb +59 -0
- data/lib/active_scaffold/bridges/file_column/lib/form_ui.rb +37 -0
- data/lib/active_scaffold/bridges/file_column/lib/list_ui.rb +26 -0
- data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +43 -0
- data/lib/active_scaffold/bridges/file_column/test/mock_model.rb +9 -0
- data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +15 -0
- data/lib/active_scaffold/bridges/paperclip/bridge.rb +12 -0
- data/lib/active_scaffold/bridges/paperclip/lib/form_ui.rb +27 -0
- data/lib/active_scaffold/bridges/paperclip/lib/list_ui.rb +16 -0
- data/lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge.rb +38 -0
- data/lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb +26 -0
- data/lib/active_scaffold/bridges/semantic_attributes/bridge.rb +5 -0
- data/lib/active_scaffold/bridges/semantic_attributes/lib/semantic_attributes_bridge.rb +20 -0
- data/lib/active_scaffold/bridges/shared/date_bridge.rb +187 -0
- data/lib/active_scaffold/bridges/tiny_mce/bridge.rb +5 -0
- data/lib/active_scaffold/bridges/tiny_mce/lib/tiny_mce_bridge.rb +45 -0
- data/lib/active_scaffold/bridges/validation_reflection/bridge.rb +8 -0
- data/lib/active_scaffold/bridges/validation_reflection/lib/validation_reflection_bridge.rb +21 -0
- data/lib/active_scaffold/config/base.rb +54 -0
- data/lib/active_scaffold/config/core.rb +229 -0
- data/lib/active_scaffold/config/create.rb +43 -0
- data/lib/active_scaffold/config/delete.rb +25 -0
- data/lib/active_scaffold/config/field_search.rb +74 -0
- data/lib/active_scaffold/config/form.rb +46 -0
- data/lib/active_scaffold/config/list.rb +174 -0
- data/lib/active_scaffold/config/mark.rb +22 -0
- data/lib/active_scaffold/config/nested.rb +43 -0
- data/lib/active_scaffold/config/search.rb +68 -0
- data/lib/active_scaffold/config/show.rb +34 -0
- data/lib/active_scaffold/config/subform.rb +35 -0
- data/lib/active_scaffold/config/update.rb +38 -0
- data/lib/active_scaffold/configurable.rb +29 -0
- data/lib/active_scaffold/constraints.rb +179 -0
- data/lib/active_scaffold/data_structures/action_columns.rb +133 -0
- data/lib/active_scaffold/data_structures/action_link.rb +162 -0
- data/lib/active_scaffold/data_structures/action_links.rb +59 -0
- data/lib/active_scaffold/data_structures/actions.rb +45 -0
- data/lib/active_scaffold/data_structures/column.rb +348 -0
- data/lib/active_scaffold/data_structures/columns.rb +75 -0
- data/lib/active_scaffold/data_structures/error_message.rb +24 -0
- data/lib/active_scaffold/data_structures/nested_info.rb +108 -0
- data/lib/active_scaffold/data_structures/set.rb +62 -0
- data/lib/active_scaffold/data_structures/sorting.rb +168 -0
- data/lib/active_scaffold/finder.rb +333 -0
- data/lib/active_scaffold/helpers/association_helpers.rb +40 -0
- data/lib/active_scaffold/helpers/controller_helpers.rb +40 -0
- data/lib/active_scaffold/helpers/country_helpers.rb +352 -0
- data/lib/active_scaffold/helpers/form_column_helpers.rb +343 -0
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +59 -0
- data/lib/active_scaffold/helpers/id_helpers.rb +131 -0
- data/lib/active_scaffold/helpers/list_column_helpers.rb +363 -0
- data/lib/active_scaffold/helpers/pagination_helpers.rb +55 -0
- data/lib/active_scaffold/helpers/search_column_helpers.rb +238 -0
- data/lib/active_scaffold/helpers/show_column_helpers.rb +46 -0
- data/lib/active_scaffold/helpers/view_helpers.rb +315 -0
- data/lib/active_scaffold/locale/de.rb +113 -0
- data/lib/active_scaffold/locale/en.rb +118 -0
- data/lib/active_scaffold/locale/es.yml +112 -0
- data/lib/active_scaffold/locale/fr.rb +113 -0
- data/lib/active_scaffold/locale/hu.yml +63 -0
- data/lib/active_scaffold/locale/ja.yml +64 -0
- data/lib/active_scaffold/locale/ru.yml +62 -0
- data/lib/active_scaffold/marked_model.rb +38 -0
- data/lib/dhtml_confirm.rb +54 -0
- data/lib/extensions/action_controller_rendering.rb +20 -0
- data/lib/extensions/action_view_rendering.rb +113 -0
- data/lib/extensions/action_view_resolver.rb +7 -0
- data/lib/extensions/active_record_offset.rb +12 -0
- data/lib/extensions/array.rb +7 -0
- data/lib/extensions/localize.rb +10 -0
- data/lib/extensions/name_option_for_datetime.rb +12 -0
- data/lib/extensions/nil_id_in_url_params.rb +7 -0
- data/lib/extensions/paginator_extensions.rb +26 -0
- data/lib/extensions/reverse_associations.rb +62 -0
- data/lib/extensions/routing_mapper.rb +34 -0
- data/lib/extensions/to_label.rb +8 -0
- data/lib/extensions/unsaved_associated.rb +61 -0
- data/lib/extensions/unsaved_record.rb +20 -0
- data/lib/extensions/usa_state.rb +46 -0
- data/lib/generators/active_scaffold/USAGE +29 -0
- data/lib/generators/active_scaffold/active_scaffold_generator.rb +20 -0
- data/lib/generators/active_scaffold_controller/USAGE +19 -0
- data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +28 -0
- data/lib/generators/active_scaffold_controller/templates/controller.rb +4 -0
- data/lib/generators/active_scaffold_setup/USAGE +10 -0
- data/lib/generators/active_scaffold_setup/active_scaffold_setup_generator.rb +53 -0
- data/lib/paginator.rb +136 -0
- data/lib/responds_to_parent.rb +70 -0
- data/public/blank.html +33 -0
- data/shoulda_macros/macros.rb +136 -0
- data/test/bridges/bridge_test.rb +47 -0
- data/test/config/base_test.rb +15 -0
- data/test/config/create_test.rb +55 -0
- data/test/config/list_test.rb +74 -0
- data/test/config/show_test.rb +43 -0
- data/test/config/update_test.rb +17 -0
- data/test/const_mocker.rb +36 -0
- data/test/data_structures/action_columns_test.rb +113 -0
- data/test/data_structures/action_link_test.rb +78 -0
- data/test/data_structures/action_links_test.rb +78 -0
- data/test/data_structures/actions_test.rb +25 -0
- data/test/data_structures/association_column_test.rb +42 -0
- data/test/data_structures/column_test.rb +185 -0
- data/test/data_structures/columns_test.rb +69 -0
- data/test/data_structures/error_message_test.rb +28 -0
- data/test/data_structures/set_test.rb +86 -0
- data/test/data_structures/sorting_test.rb +126 -0
- data/test/data_structures/standard_column_test.rb +24 -0
- data/test/data_structures/virtual_column_test.rb +23 -0
- data/test/extensions/active_record_test.rb +45 -0
- data/test/extensions/array_test.rb +12 -0
- data/test/helpers/form_column_helpers_test.rb +31 -0
- data/test/helpers/list_column_helpers_test.rb +31 -0
- data/test/helpers/pagination_helpers_test.rb +55 -0
- data/test/misc/active_record_permissions_test.rb +154 -0
- data/test/misc/attribute_params_test.rb +110 -0
- data/test/misc/configurable_test.rb +96 -0
- data/test/misc/constraints_test.rb +193 -0
- data/test/misc/finder_test.rb +93 -0
- data/test/misc/lang_test.rb +12 -0
- data/test/mock_app/.gitignore +2 -0
- data/test/mock_app/app/controllers/application_controller.rb +10 -0
- data/test/mock_app/app/helpers/application_helper.rb +3 -0
- data/test/mock_app/config/boot.rb +110 -0
- data/test/mock_app/config/database.yml +16 -0
- data/test/mock_app/config/environment.rb +43 -0
- data/test/mock_app/config/environments/development.rb +17 -0
- data/test/mock_app/config/environments/production.rb +28 -0
- data/test/mock_app/config/environments/test.rb +28 -0
- data/test/mock_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/mock_app/config/initializers/inflections.rb +10 -0
- data/test/mock_app/config/initializers/mime_types.rb +5 -0
- data/test/mock_app/config/initializers/new_rails_defaults.rb +19 -0
- data/test/mock_app/config/initializers/session_store.rb +15 -0
- data/test/mock_app/config/locales/en.yml +5 -0
- data/test/mock_app/config/routes.rb +43 -0
- data/test/mock_app/db/test.sqlite3 +1 -0
- data/test/mock_app/public/blank.html +33 -0
- data/test/mock_app/public/images/active_scaffold/DO_NOT_EDIT +2 -0
- data/test/mock_app/public/images/active_scaffold/default/add.gif +0 -0
- data/test/mock_app/public/images/active_scaffold/default/arrow_down.gif +0 -0
- data/test/mock_app/public/images/active_scaffold/default/arrow_up.gif +0 -0
- data/test/mock_app/public/images/active_scaffold/default/close.gif +0 -0
- data/test/mock_app/public/images/active_scaffold/default/cross.png +0 -0
- data/test/mock_app/public/images/active_scaffold/default/indicator-small.gif +0 -0
- data/test/mock_app/public/images/active_scaffold/default/indicator.gif +0 -0
- data/test/mock_app/public/images/active_scaffold/default/magnifier.png +0 -0
- data/test/mock_app/public/javascripts/active_scaffold/DO_NOT_EDIT +2 -0
- data/test/mock_app/public/javascripts/active_scaffold/default/active_scaffold.js +532 -0
- data/test/mock_app/public/javascripts/active_scaffold/default/dhtml_history.js +867 -0
- data/test/mock_app/public/javascripts/active_scaffold/default/form_enhancements.js +117 -0
- data/test/mock_app/public/javascripts/active_scaffold/default/rico_corner.js +370 -0
- data/test/mock_app/public/stylesheets/active_scaffold/DO_NOT_EDIT +2 -0
- data/test/mock_app/public/stylesheets/active_scaffold/default/stylesheet-ie.css +35 -0
- data/test/mock_app/public/stylesheets/active_scaffold/default/stylesheet.css +839 -0
- data/test/model_stub.rb +55 -0
- data/test/run_all.rb +8 -0
- data/test/test_helper.rb +39 -0
- data/uninstall.rb +13 -0
- metadata +478 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
<% url_options = params_for(:action => :add_existing) -%>
|
2
|
+
<% xhr = request.xhr? -%>
|
3
|
+
<%=
|
4
|
+
options = {:id => element_form_id(:action => :add_existing),
|
5
|
+
:class => "as_form create",
|
6
|
+
:method => :post,
|
7
|
+
'data-loading' => true}
|
8
|
+
options[:remote] = true if xhr
|
9
|
+
form_tag url_options, options -%>
|
10
|
+
|
11
|
+
<h4><%= active_scaffold_config.nested.label -%></h4>
|
12
|
+
|
13
|
+
<% if xhr -%>
|
14
|
+
<div id="<%= element_messages_id(:action => :add_existing) %>" class="messages-container"></div>
|
15
|
+
<% else -%>
|
16
|
+
<%= render :partial => 'form_messages' %>
|
17
|
+
<% end -%>
|
18
|
+
|
19
|
+
<label for="<%= "record_#{active_scaffold_config.model}" %>"><%= active_scaffold_add_existing_label %></label>
|
20
|
+
<%= active_scaffold_add_existing_input(:name => 'associated_id', :url_options => url_options) %>
|
21
|
+
|
22
|
+
<p class="form-footer">
|
23
|
+
<%= submit_tag as_(:add), :class => "submit" %>
|
24
|
+
<%= link_to as_(:cancel), main_path_to_return, :class => 'as_cancel', :remote => true %>
|
25
|
+
<%= loading_indicator_tag(:action => :add_existing, :id => params[:id]) %>
|
26
|
+
</p>
|
27
|
+
|
28
|
+
</form>
|
29
|
+
<%= javascript_tag("ActiveScaffold.focus_first_element_of_form('#{element_form_id(:action => :add_existing)}');") %>
|
30
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<% url_options ||= params_for(:action => form_action)
|
2
|
+
xhr = request.xhr? if xhr.nil?
|
3
|
+
as_action_config = active_scaffold_config.send(form_action)
|
4
|
+
body_partial ||= 'form' %>
|
5
|
+
<%=
|
6
|
+
options = {:onsubmit => onsubmit,
|
7
|
+
:id => element_form_id(:action => form_action),
|
8
|
+
:multipart => as_action_config.multipart?,
|
9
|
+
:class => "as_form #{form_action.to_s}",
|
10
|
+
:method => method,
|
11
|
+
'data-loading' => true}
|
12
|
+
if xhr && as_action_config.multipart? # file_uploads
|
13
|
+
form_remote_upload_tag url_options.merge({:iframe => true}), options
|
14
|
+
else
|
15
|
+
options[:remote] = true if xhr && !as_action_config.multipart?
|
16
|
+
form_tag url_options, options
|
17
|
+
end -%>
|
18
|
+
|
19
|
+
<h4><%= headline -%></h4>
|
20
|
+
|
21
|
+
<div id="<%= element_messages_id(:action => form_action) %>" class="messages-container">
|
22
|
+
<% if request.xhr? -%>
|
23
|
+
<% records = @error_records || Array(@record)
|
24
|
+
records.each do |record| %>
|
25
|
+
<%= error_messages_for record, :object_name => "#{record.class.model_name.human.downcase}#{record.new_record? ? '' : ": #{record.to_label}"}" %>
|
26
|
+
<% end %>
|
27
|
+
<% else -%>
|
28
|
+
<%= render :partial => 'form_messages' %>
|
29
|
+
<% end -%>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<%= render :partial => body_partial, :locals => { :columns => as_action_config.columns } %>
|
33
|
+
|
34
|
+
<p class="form-footer">
|
35
|
+
<%= submit_tag as_(form_action), :class => "submit" %>
|
36
|
+
<%= link_to(as_(:cancel), main_path_to_return, :class => 'as_cancel', :remote => true, 'data-refresh' => false) if cancel_link %>
|
37
|
+
<%= loading_indicator_tag(:action => form_action, :id => params[:id]) %>
|
38
|
+
</p>
|
39
|
+
|
40
|
+
</form>
|
41
|
+
<%= javascript_tag("ActiveScaffold.focus_first_element_of_form('#{element_form_id(:action => form_action)}');") %>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= render :partial => "base_form", :locals => {:xhr => xhr ||= nil,
|
2
|
+
:form_action => form_action ||= :create,
|
3
|
+
:method => method ||= :post,
|
4
|
+
:cancel_link => cancel_link ||= true,
|
5
|
+
:headline => headline ||= active_scaffold_config.create.label(active_scaffold_config.sti_create_links ? @record.class.model_name.human(:count => 1) : nil)} %>
|
6
|
+
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<%= render :partial => "base_form", :locals => {:xhr => xhr ||= nil,
|
2
|
+
:form_action => form_action ||= :create,
|
3
|
+
:method => method ||= :post,
|
4
|
+
:cancel_link => cancel_link ||= false,
|
5
|
+
:headline => headline ||= active_scaffold_config.create.label(active_scaffold_config.sti_create_links ? @record.class.model_name.human(:count => 1) : nil)} %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<% url_options = params_for(:action => :index, :escape => false, :search => nil) -%>
|
2
|
+
<%=
|
3
|
+
options = {:id => search_form_id,
|
4
|
+
:class => "as_form search",
|
5
|
+
:remote => true,
|
6
|
+
:method => :get,
|
7
|
+
'data-loading' => true}
|
8
|
+
form_tag url_options, options %>
|
9
|
+
<ol class="form">
|
10
|
+
<% visibles, hiddens = visibles_and_hiddens(active_scaffold_config.field_search) %>
|
11
|
+
<% visibles.each do |column| -%>
|
12
|
+
<%= render :partial => 'search_attribute', :locals => {:column => column} %>
|
13
|
+
<% end -%>
|
14
|
+
<% unless hiddens.empty? -%>
|
15
|
+
<li class="sub-section">
|
16
|
+
<h5><%= as_(:optional_attributes) %></h5>
|
17
|
+
<ol id ="<%= sub_section_id(:sub_section => 'further_options') %>" class="form" 'style="display: none;"'>
|
18
|
+
<% hiddens.each do |column| -%>
|
19
|
+
<%= render :partial => 'search_attribute', :locals => {:column => column} %>
|
20
|
+
<% end -%>
|
21
|
+
</ol>
|
22
|
+
<%= link_to_visibility_toggle(sub_section_id(:sub_section => 'further_options'), {:default_visible => false}) %>
|
23
|
+
</li>
|
24
|
+
<% end -%>
|
25
|
+
</ol>
|
26
|
+
<p class="form-footer">
|
27
|
+
<%= submit_tag as_(:search), :class => "submit" %>
|
28
|
+
<%= link_to as_(:reset), url_for(url_options.merge(:search => '')), :class => 'as_cancel', :remote => true %>
|
29
|
+
<%= loading_indicator_tag(:action => :search) %>
|
30
|
+
</p>
|
31
|
+
</form>
|
32
|
+
<%= javascript_tag("ActiveScaffold.focus_first_element_of_form('#{search_form_id}');") %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<% subsection_id ||= nil %>
|
2
|
+
<ol class="form" <%= "id=#{subsection_id}" unless subsection_id.nil? %> <%= 'style="display: none;"' if columns.collapsed -%>>
|
3
|
+
<% columns.each :for => @record do |column| %>
|
4
|
+
<% renders_as = column_renders_as(column) %>
|
5
|
+
<% if renders_as == :subsection -%>
|
6
|
+
<% subsection_id = sub_section_id(:sub_section => column.label) %>
|
7
|
+
<li class="sub-section">
|
8
|
+
<h5><%= column.label %></h5>
|
9
|
+
<%= render :partial => 'form', :locals => { :columns => column, :subsection_id => subsection_id} %>
|
10
|
+
<%= link_to_visibility_toggle(subsection_id, {:default_visible => !column.collapsed}) -%>
|
11
|
+
</li>
|
12
|
+
<% elsif column.readonly_association?
|
13
|
+
next %>
|
14
|
+
<% elsif renders_as == :subform and !override_form_field?(column) -%>
|
15
|
+
<li class="sub-form <%= active_scaffold_config_for(column.association.klass).subform.layout %>-sub-form <%= column.css_class unless column.css_class.nil? %>" id="<%= sub_form_id(:association => column.name) %>">
|
16
|
+
<%= render :partial => form_partial_for_column(column, renders_as), :locals => { :column => column } -%>
|
17
|
+
</li>
|
18
|
+
<% else -%>
|
19
|
+
<li class="form-element <%= 'required' if column.required? %> <%= column.css_class unless column.css_class.nil? %>">
|
20
|
+
<%= render :partial => form_partial_for_column(column, renders_as), :locals => { :column => column } -%>
|
21
|
+
</li>
|
22
|
+
<% end -%>
|
23
|
+
<% end -%>
|
24
|
+
</ol>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%
|
2
|
+
parent_record = @record
|
3
|
+
associated = column.singular_association? ? [parent_record.send(column.name)].compact : parent_record.send(column.name).to_a
|
4
|
+
associated = associated.sort_by {|r| r.new_record? ? 99999999999 : r.id} unless column.association.options.has_key?(:order)
|
5
|
+
|
6
|
+
associated << column.association.klass.new if column.show_blank_record? associated
|
7
|
+
subform_div_id = "#{sub_form_id({:association => column.name, :id => parent_record.id || 99999999999})}-div"
|
8
|
+
-%>
|
9
|
+
<h5><%= column.label -%></h5>
|
10
|
+
<div id ="<%= subform_div_id %>" <%= 'style="display: none;"'.html_safe if column.collapsed -%>>
|
11
|
+
<%= render :partial => subform_partial_for_column(column), :locals => {:column => column, :parent_record => parent_record, :associated => associated} %>
|
12
|
+
</div>
|
13
|
+
<%= link_to_visibility_toggle(subform_div_id, {:default_visible => !column.collapsed}) -%>
|
14
|
+
<% @record = parent_record -%>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<%
|
2
|
+
begin
|
3
|
+
remote_controller = active_scaffold_controller_for(column.association.klass)
|
4
|
+
rescue ActiveScaffold::ControllerNotFound
|
5
|
+
remote_controller = nil
|
6
|
+
end
|
7
|
+
|
8
|
+
show_add_existing = column_show_add_existing(column)
|
9
|
+
show_add_new = column_show_add_new(column, associated, @record)
|
10
|
+
|
11
|
+
return unless show_add_new or show_add_existing
|
12
|
+
|
13
|
+
edit_associated_url = url_for(:action => 'edit_associated', :id => parent_record.id, :association => column.name, :associated_id => '--ID--', :escape => false, :eid => params[:eid], :parent_controller => params[:parent_controller], :parent_id => params[:parent_id]) if show_add_existing
|
14
|
+
add_new_url = url_for(:action => 'edit_associated', :id => parent_record.id, :association => column.name, :escape => false, :eid => params[:eid], :parent_controller => params[:parent_controller], :parent_id => params[:parent_id]) if show_add_new
|
15
|
+
|
16
|
+
-%>
|
17
|
+
<div class="footer-wrapper">
|
18
|
+
<div class="footer">
|
19
|
+
<% if show_add_new -%>
|
20
|
+
<% add_label = column.plural_association? ? as_(:create_another, :model => column.association.klass.model_name.human) : as_(:replace_with_new)
|
21
|
+
create_another_id = "#{sub_form_id(:association => column.name)}-create-another" %>
|
22
|
+
<%= tag(:input, {:id => create_another_id, :type => 'button', :value => add_label, :href => add_new_url.html_safe, 'data-remote' => true, :style=> "display: none;"}) %>
|
23
|
+
<%= javascript_tag("ActiveScaffold.show('#{create_another_id}');") %>
|
24
|
+
<% end -%>
|
25
|
+
|
26
|
+
<%= '|' if show_add_new and show_add_existing %>
|
27
|
+
|
28
|
+
<% if show_add_existing -%>
|
29
|
+
<% if remote_controller and remote_controller.respond_to? :uses_record_select? and remote_controller.uses_record_select? -%>
|
30
|
+
<%= link_to_record_select as_(:add_existing), remote_controller.controller_path, :onselect => "ActiveScaffold.record_select_onselect(#{edit_associated_url.to_json}, #{active_scaffold_id.to_json}, id);" -%>
|
31
|
+
<% else -%>
|
32
|
+
<% select_options = options_for_select(options_for_association(column.association))
|
33
|
+
add_existing_id = "#{sub_form_id(:association => column.name)}-add-existing" %>
|
34
|
+
<%= select_tag 'associated_id', '<option value="">'.html_safe + as_(:_select_) + '</option>'.html_safe + select_options %>
|
35
|
+
<%= tag(:input, {:id => add_existing_id, :type => 'button', :value => as_(:add_existing), :href => edit_associated_url.html_safe, 'data-remote' => true, :class=> 'as_add_existing', :style => "display: none;"}) %>
|
36
|
+
<%= javascript_tag("ActiveScaffold.show('#{add_existing_id}');") %>
|
37
|
+
<% end -%>
|
38
|
+
<% end -%>
|
39
|
+
</div>
|
40
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% scope ||= nil %>
|
2
|
+
<dl>
|
3
|
+
<dt>
|
4
|
+
<label for="<%= active_scaffold_input_options(column, scope)[:id] %>"><%= column.label %></label>
|
5
|
+
</dt>
|
6
|
+
<dd>
|
7
|
+
<%= active_scaffold_input_for column, scope %>
|
8
|
+
<% if column.update_columns -%>
|
9
|
+
<%= loading_indicator_tag(:action => :render_field, :id => params[:id]) %>
|
10
|
+
<% end -%>
|
11
|
+
<% if column.description -%>
|
12
|
+
<span class="description"><%= column.description %></span>
|
13
|
+
<% end -%>
|
14
|
+
</dd>
|
15
|
+
</dl>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<table cellpadding="0" cellspacing="0">
|
2
|
+
<% @record = column.association.klass.new -%>
|
3
|
+
<%= render :partial => 'horizontal_subform_header', :locals => {:parent_record => parent_record} %>
|
4
|
+
|
5
|
+
<tbody id="<%= sub_form_list_id(:association => column.name) %>">
|
6
|
+
<% associated.each_index do |index| %>
|
7
|
+
<% @record = associated[index] -%>
|
8
|
+
<% if @record.errors.count -%>
|
9
|
+
<tr class="association-record-errors">
|
10
|
+
<td colspan="<%= active_scaffold_config_for(@record.class).subform.columns.length + 1 %>" id="<%= element_messages_id :action => @record.class.name.underscore, :id => "#{parent_record.id}-#{index}" %>">
|
11
|
+
<%= error_messages_for :record, :object_name => @record.class.model_name.human.downcase %>
|
12
|
+
</td>
|
13
|
+
</tr>
|
14
|
+
<% end %>
|
15
|
+
<%= render :partial => 'horizontal_subform_record', :locals => {:scope => column_scope(column), :parent_record => parent_record, :column => column, :locked => @record.new_record? && @record == associated.last} %>
|
16
|
+
<% end -%>
|
17
|
+
</tbody>
|
18
|
+
</table>
|
19
|
+
<%= render :partial => 'form_association_footer', :locals => {:parent_record => parent_record, :column => column, :associated => associated} -%>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<thead>
|
2
|
+
<tr>
|
3
|
+
<%
|
4
|
+
active_scaffold_config_for(@record.class).subform.columns.each :for => @record, :flatten => true do |column|
|
5
|
+
next unless in_subform?(column, parent_record) and column_renders_as(column) != :hidden
|
6
|
+
-%>
|
7
|
+
<th<%= ' class="required"' if column.required? %>><label><%= column.label %></label></th>
|
8
|
+
<% end -%>
|
9
|
+
</tr>
|
10
|
+
</thead>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<% record_column = column
|
2
|
+
readonly = (@record.readonly? or not @record.authorized_for?(:crud_type => :update))
|
3
|
+
crud_type = @record.new_record? ? :create : (readonly ? :read : nil)
|
4
|
+
show_actions = false
|
5
|
+
config = active_scaffold_config_for(@record.class)
|
6
|
+
options = active_scaffold_input_options(config.columns[@record.class.primary_key], scope)
|
7
|
+
tr_id = "association-#{options[:id]}"
|
8
|
+
%>
|
9
|
+
<tr id="<%= tr_id %>" class="association-record <%= 'association-record-new' if @record.new_record? -%> <%= 'locked' if locked -%>">
|
10
|
+
<% config.subform.columns.each :for => @record.class, :crud_type => crud_type, :flatten => true do |column| %>
|
11
|
+
<%
|
12
|
+
next unless in_subform?(column, parent_record)
|
13
|
+
show_actions = true
|
14
|
+
column = column.clone
|
15
|
+
column.form_ui ||= :select if column.association
|
16
|
+
-%>
|
17
|
+
<td>
|
18
|
+
<% unless readonly and not @record.new_record? -%>
|
19
|
+
<%= render :partial => form_partial_for_column(column), :locals => { :column => column, :scope => scope } -%>
|
20
|
+
<% else -%>
|
21
|
+
<p><%= get_column_value(@record, column) -%></p>
|
22
|
+
<% end -%>
|
23
|
+
</td>
|
24
|
+
<% end -%>
|
25
|
+
<% if show_actions -%>
|
26
|
+
<td class="actions">
|
27
|
+
<% if record_column.plural_association? and (@record.authorized_for?(:crud_type => :delete) or not [:destroy, :delete_all].include?(record_column.association.options[:dependent])) %>
|
28
|
+
<% destroy_id = "#{options[:id]}-destroy" %>
|
29
|
+
<%= link_to as_(:remove), '#', :class => 'destroy', :id => destroy_id , :onclick => "ActiveScaffold.remove(\"#{tr_id}\"); return false;", :style=> "display: none;" %>
|
30
|
+
<%= javascript_tag("ActiveScaffold.show('#{destroy_id}');") if !locked %>
|
31
|
+
<% end %>
|
32
|
+
<% unless @record.new_record? %>
|
33
|
+
<input type="hidden" name="<%= options[:name] -%>" id="<%= options[:id] -%>" value="<%= @record.id -%>" />
|
34
|
+
<% end -%>
|
35
|
+
</td>
|
36
|
+
<% end -%>
|
37
|
+
</tr>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= columns.collect {|column| active_scaffold_human_condition_for(column)}.compact.join(I18n.t('support.array.two_words_connector')) %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<table cellpadding="0" cellspacing="0">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<% columns = list_columns %>
|
5
|
+
<%= render :partial => 'list_column_headings', :locals => {:columns => columns} %>
|
6
|
+
</tr>
|
7
|
+
</thead>
|
8
|
+
<%= render :partial => 'list_messages', :locals => {:columns => columns} %>
|
9
|
+
<tbody class="records" id="<%= active_scaffold_tbody_id %>">
|
10
|
+
<% if !@records.empty? -%>
|
11
|
+
<%= render :partial => 'list_record', :collection => @page.items, :locals => { :hidden => false, :columns => columns, :action_links => active_scaffold_config.action_links.collect_by_type(:member)} %>
|
12
|
+
<% end -%>
|
13
|
+
<% if columns.any? {|c| c.calculation?} -%>
|
14
|
+
<%= render :partial => 'list_calculations', :locals => {:columns => columns} %>
|
15
|
+
<% end -%>
|
16
|
+
</tbody>
|
17
|
+
</table>
|
18
|
+
<%= render :partial => 'list_pagination' %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% action_links ||= active_scaffold_config.action_links %>
|
2
|
+
<td class="actions"><table cellpadding="0" cellspacing="0">
|
3
|
+
<tr>
|
4
|
+
<td class="indicator-container">
|
5
|
+
<%= loading_indicator_tag(:action => :record, :id => record.id) %>
|
6
|
+
</td>
|
7
|
+
<% action_links.each do |link| -%>
|
8
|
+
<% next if skip_action_link(link, record) -%>
|
9
|
+
<td>
|
10
|
+
<%= record.authorized_for?(:crud_type => link.crud_type, :action => link.action) ? render_action_link(link, url_options, record) : action_link_html(link, nil, {:class => "disabled #{link.action}#{link.html_options[:class].blank? ? '' : (' ' + link.html_options[:class])}"}) %>
|
11
|
+
</td>
|
12
|
+
<% end -%>
|
13
|
+
</tr>
|
14
|
+
</table>
|
15
|
+
</td>
|
16
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% display_class = ( @records.kind_of?(Array) ? @records.first : @records )
|
2
|
+
columns ||= list_columns -%>
|
3
|
+
<tr id="<%= active_scaffold_calculations_id %>" class="active-scaffold-calculations">
|
4
|
+
<% columns.each do |column| -%>
|
5
|
+
<td id="<%= active_scaffold_calculations_id(column) if column.calculation? %>">
|
6
|
+
<% if column.calculation? -%>
|
7
|
+
<%= render_column_calculation(column) %>
|
8
|
+
<% else -%>
|
9
|
+
|
10
|
+
<% end -%>
|
11
|
+
</td>
|
12
|
+
<% end -%>
|
13
|
+
<% unless active_scaffold_config.action_links.empty? -%>
|
14
|
+
<td class="actions"> </td>
|
15
|
+
<% end -%>
|
16
|
+
</tr>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%
|
2
|
+
sorting = active_scaffold_config.list.user.sorting
|
3
|
+
sorting_stages = ['reset', 'ASC', 'DESC']
|
4
|
+
default_sorting = active_scaffold_config.list.user.default_sorting
|
5
|
+
default_sorting_stages = ['ASC', 'DESC']
|
6
|
+
-%>
|
7
|
+
<% columns.each do |column| -%>
|
8
|
+
<% stages = default_sorting.sorts_on?(column) ? default_sorting_stages : sorting_stages -%>
|
9
|
+
<%= render_column_heading(column, sorting, stages.after(sorting.direction_of(column)) || 'ASC') %>
|
10
|
+
<% end -%>
|
11
|
+
<th class="actions">
|
12
|
+
</th>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<% action_links = active_scaffold_config.action_links.collect_by_type(:collection)
|
2
|
+
unless action_links.empty? -%>
|
3
|
+
<div class="actions">
|
4
|
+
<% new_params = params_for %>
|
5
|
+
<% action_links.send(nested.nil? ? :each : :reverse_each) do |link| -%>
|
6
|
+
<% next if skip_action_link(link) -%>
|
7
|
+
<%= render_action_link(link, new_params) -%>
|
8
|
+
<% end -%>
|
9
|
+
<%= loading_indicator_tag(:action => :table) %>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
<h2><%= active_scaffold_config.list.user.label %></h2>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%# nested_id, allows us to remove a nested scaffold programmatically %>
|
2
|
+
<tr class="inline-adapter" id="<%= element_row_id :action => :nested %>">
|
3
|
+
<td colspan="99" class="inline-adapter-cell">
|
4
|
+
<div class="<%= "#{params[:action]}-view" if params[:action] %> <%= "#{params[:associations] ? params[:associations] : params[:controller]}-view" %> view">
|
5
|
+
<%= link_to(as_(:close), '', :class => 'inline-adapter-close as_cancel', :remote => true, :title => as_(:close), 'data-refresh' => (action_name == 'index' ? true : false)) -%>
|
6
|
+
<%= payload -%>
|
7
|
+
</div>
|
8
|
+
</td>
|
9
|
+
</tr>
|
10
|
+
<%= javascript_tag("var action_link = ActiveScaffold.ActionLink.get('#{element_row_id(:action => :nested)}'); if (action_link) action_link.update_flash_messages('#{escape_javascript(render(:partial => 'messages').strip)}');") %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<tbody class="messages">
|
2
|
+
<tr class="record even-record">
|
3
|
+
<td colspan="<%= columns.length -%>" class="messages-container">
|
4
|
+
<p class="error-message message server-error" style="display:none;">
|
5
|
+
<%= as_(:internal_error).html_safe %>
|
6
|
+
<a href="#" onclick="ActiveScaffold.hide(this.parentNode); return false;" title="<%= as_(:close).html_safe %>"><%= as_(:close).html_safe %></a>
|
7
|
+
</p>
|
8
|
+
<div id="<%= active_scaffold_messages_id -%>">
|
9
|
+
<%= render :partial => 'messages' %>
|
10
|
+
</div>
|
11
|
+
<p class="filtered-message" <%= ' style="display:none;" '.html_safe unless @filtered %>>
|
12
|
+
<%= @filtered.is_a?(Array) ? render(:partial => 'human_conditions', :locals => {:columns => @filtered}) : as_(active_scaffold_config.list.filtered_message) %>
|
13
|
+
</p>
|
14
|
+
<p id="<%= empty_message_id %>" class="empty-message" <%= ' style="display:none;" '.html_safe unless @page.items.empty? %>>
|
15
|
+
<%= as_(active_scaffold_config.list.no_entries_message) %>
|
16
|
+
</p>
|
17
|
+
</td>
|
18
|
+
<% if active_scaffold_config.list.show_search_reset && @filtered -%>
|
19
|
+
<% search_link = ActiveScaffold::DataStructures::ActionLink.new('index', :label => :click_to_reset, :type => :member, :position => false)
|
20
|
+
action_links = ActiveScaffold::DataStructures::ActionLinks.new
|
21
|
+
record = active_scaffold_config.model.new
|
22
|
+
record.id = 0
|
23
|
+
action_links.add(search_link) -%>
|
24
|
+
<%= render :partial => 'list_actions', :locals => {:record => record, :url_options => params_for(:escape => false, :search => ''), :action_links => action_links} %>
|
25
|
+
<% else %>
|
26
|
+
<td class='actions'><%= '<p class="empty-message"> </p>'.html_safe if @page.items.empty? %></td>
|
27
|
+
<% end -%>
|
28
|
+
|
29
|
+
</tr>
|
30
|
+
</tbody>
|
31
|
+
|
32
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% if active_scaffold_config.list.pagination -%>
|
2
|
+
<div class="active-scaffold-footer">
|
3
|
+
<% unless @page.pager.infinite? -%>
|
4
|
+
<div class="active-scaffold-found"><span class="active-scaffold-records"><%= @page.pager.count -%></span> <%=as_(:found, :count => @page.pager.count) %></div>
|
5
|
+
<% end -%>
|
6
|
+
<div class="active-scaffold-pagination">
|
7
|
+
<%= render :partial => 'list_pagination_links', :locals => { :current_page => @page } if @page.pager.infinite? || @page.pager.number_of_pages > 1 %>
|
8
|
+
</div>
|
9
|
+
<br clear="both" /><%# a hack for the Rico Corner problem %>
|
10
|
+
</div>
|
11
|
+
<% end -%>
|