active_scaffold 3.2.17 → 3.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +5 -1
- metadata +17 -261
- data/app/assets/images/active_scaffold/add.png +0 -0
- data/app/assets/images/active_scaffold/arrow_down.png +0 -0
- data/app/assets/images/active_scaffold/arrow_up.png +0 -0
- data/app/assets/images/active_scaffold/close.png +0 -0
- data/app/assets/images/active_scaffold/close_touch.png +0 -0
- data/app/assets/images/active_scaffold/config.png +0 -0
- data/app/assets/images/active_scaffold/cross.png +0 -0
- data/app/assets/images/active_scaffold/gears.png +0 -0
- data/app/assets/images/active_scaffold/indicator-small.gif +0 -0
- data/app/assets/images/active_scaffold/indicator.gif +0 -0
- data/app/assets/images/active_scaffold/magnifier.png +0 -0
- data/app/assets/javascripts/active_scaffold.js.erb +0 -19
- data/app/assets/javascripts/jquery/active_scaffold.js +0 -1113
- data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +0 -24
- data/app/assets/javascripts/jquery/draggable_lists.js +0 -27
- data/app/assets/javascripts/jquery/jquery.editinplace.js +0 -743
- data/app/assets/javascripts/jquery/tiny_mce_bridge.js +0 -7
- data/app/assets/javascripts/prototype/active_scaffold.js +0 -1107
- data/app/assets/javascripts/prototype/dhtml_history.js +0 -870
- data/app/assets/javascripts/prototype/form_enhancements.js +0 -117
- data/app/assets/javascripts/prototype/rico_corner.js +0 -370
- data/app/assets/javascripts/prototype/tiny_mce_bridge.js +0 -7
- data/app/assets/stylesheets/active_scaffold-ie.css.scss +0 -54
- data/app/assets/stylesheets/active_scaffold.css.scss +0 -14
- data/app/assets/stylesheets/active_scaffold_colors.css.scss +0 -395
- data/app/assets/stylesheets/active_scaffold_extensions.css.erb +0 -2
- data/app/assets/stylesheets/active_scaffold_images.css.scss +0 -40
- data/app/assets/stylesheets/active_scaffold_layout.css +0 -936
- data/app/assets/stylesheets/blue-theme.css +0 -74
- data/config/locales/de.yml +0 -125
- data/config/locales/en.yml +0 -127
- data/config/locales/es.yml +0 -128
- data/config/locales/fr.yml +0 -131
- data/config/locales/hu.yml +0 -126
- data/config/locales/ja.yml +0 -126
- data/config/locales/ru.yml +0 -135
- data/frontends/default/views/_action_group.html.erb +0 -24
- data/frontends/default/views/_add_existing_form.html.erb +0 -30
- data/frontends/default/views/_base_form.html.erb +0 -53
- data/frontends/default/views/_create_form.html.erb +0 -8
- data/frontends/default/views/_create_form_on_list.html.erb +0 -6
- data/frontends/default/views/_field_search.html.erb +0 -32
- data/frontends/default/views/_form.html.erb +0 -28
- data/frontends/default/views/_form_association.html.erb +0 -17
- data/frontends/default/views/_form_association_footer.html.erb +0 -47
- data/frontends/default/views/_form_attribute.html.erb +0 -23
- data/frontends/default/views/_form_hidden_attribute.html.erb +0 -7
- data/frontends/default/views/_form_messages.html.erb +0 -5
- data/frontends/default/views/_horizontal_subform.html.erb +0 -22
- data/frontends/default/views/_horizontal_subform_footer.html.erb +0 -0
- data/frontends/default/views/_horizontal_subform_header.html.erb +0 -11
- data/frontends/default/views/_horizontal_subform_record.html.erb +0 -43
- data/frontends/default/views/_human_conditions.html.erb +0 -1
- data/frontends/default/views/_list.html.erb +0 -18
- data/frontends/default/views/_list_actions.html.erb +0 -15
- data/frontends/default/views/_list_calculations.html.erb +0 -16
- data/frontends/default/views/_list_column_headings.html.erb +0 -12
- data/frontends/default/views/_list_header.html.erb +0 -10
- data/frontends/default/views/_list_inline_adapter.html.erb +0 -21
- data/frontends/default/views/_list_messages.html.erb +0 -28
- data/frontends/default/views/_list_pagination.html.erb +0 -11
- data/frontends/default/views/_list_pagination_links.html.erb +0 -9
- data/frontends/default/views/_list_record.html.erb +0 -13
- data/frontends/default/views/_list_record_columns.html.erb +0 -8
- data/frontends/default/views/_list_with_header.html.erb +0 -36
- data/frontends/default/views/_messages.html.erb +0 -10
- data/frontends/default/views/_refresh_list.js.erb +0 -1
- data/frontends/default/views/_render_field.js.erb +0 -20
- data/frontends/default/views/_row.html.erb +0 -1
- data/frontends/default/views/_search.html.erb +0 -34
- data/frontends/default/views/_search_attribute.html.erb +0 -10
- data/frontends/default/views/_show.html.erb +0 -8
- data/frontends/default/views/_show_columns.html.erb +0 -15
- data/frontends/default/views/_update_actions.html.erb +0 -9
- data/frontends/default/views/_update_calculations.js.erb +0 -4
- data/frontends/default/views/_update_form.html.erb +0 -6
- data/frontends/default/views/_update_messages.js.erb +0 -2
- data/frontends/default/views/_vertical_subform.html.erb +0 -12
- data/frontends/default/views/_vertical_subform_record.html.erb +0 -43
- data/frontends/default/views/action_confirmation.html.erb +0 -13
- data/frontends/default/views/add_existing.js.erb +0 -14
- data/frontends/default/views/add_existing_form.html.erb +0 -5
- data/frontends/default/views/create.html.erb +0 -5
- data/frontends/default/views/delete.html.erb +0 -13
- data/frontends/default/views/destroy.js.erb +0 -26
- data/frontends/default/views/edit_associated.js.erb +0 -12
- data/frontends/default/views/field_search.html.erb +0 -5
- data/frontends/default/views/form_messages.js.erb +0 -1
- data/frontends/default/views/list.html.erb +0 -1
- data/frontends/default/views/on_action_update.js.erb +0 -22
- data/frontends/default/views/on_create.js.erb +0 -38
- data/frontends/default/views/on_mark.js.erb +0 -6
- data/frontends/default/views/on_update.js.erb +0 -29
- data/frontends/default/views/refresh_list.js.erb +0 -2
- data/frontends/default/views/render_field.js.erb +0 -1
- data/frontends/default/views/row.js.erb +0 -2
- data/frontends/default/views/search.html.erb +0 -5
- data/frontends/default/views/show.html.erb +0 -5
- data/frontends/default/views/update.html.erb +0 -8
- data/frontends/default/views/update_column.js.erb +0 -15
- data/frontends/default/views/update_row.js.erb +0 -1
- data/lib/active_scaffold.rb +0 -373
- data/lib/active_scaffold/actions/common_search.rb +0 -22
- data/lib/active_scaffold/actions/core.rb +0 -203
- data/lib/active_scaffold/actions/create.rb +0 -139
- data/lib/active_scaffold/actions/delete.rb +0 -74
- data/lib/active_scaffold/actions/field_search.rb +0 -78
- data/lib/active_scaffold/actions/list.rb +0 -208
- data/lib/active_scaffold/actions/mark.rb +0 -89
- data/lib/active_scaffold/actions/nested.rb +0 -244
- data/lib/active_scaffold/actions/search.rb +0 -48
- data/lib/active_scaffold/actions/show.rb +0 -61
- data/lib/active_scaffold/actions/subform.rb +0 -23
- data/lib/active_scaffold/actions/update.rb +0 -156
- data/lib/active_scaffold/active_record_permissions.rb +0 -135
- data/lib/active_scaffold/attribute_params.rb +0 -200
- data/lib/active_scaffold/bridges.rb +0 -61
- data/lib/active_scaffold/bridges/ancestry.rb +0 -5
- data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +0 -39
- data/lib/active_scaffold/bridges/bitfields.rb +0 -6
- data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +0 -37
- data/lib/active_scaffold/bridges/calendar_date_select.rb +0 -24
- data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +0 -66
- data/lib/active_scaffold/bridges/cancan.rb +0 -15
- data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +0 -127
- data/lib/active_scaffold/bridges/carrierwave.rb +0 -12
- data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +0 -31
- data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge_helpers.rb +0 -10
- data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +0 -45
- data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +0 -17
- data/lib/active_scaffold/bridges/country_helper.rb +0 -9
- data/lib/active_scaffold/bridges/country_helper/country_helper_bridge.rb +0 -358
- data/lib/active_scaffold/bridges/date_picker.rb +0 -23
- data/lib/active_scaffold/bridges/date_picker/ext.rb +0 -63
- data/lib/active_scaffold/bridges/date_picker/helper.rb +0 -180
- data/lib/active_scaffold/bridges/dragonfly.rb +0 -9
- data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +0 -34
- data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge_helpers.rb +0 -10
- data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +0 -27
- data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +0 -16
- data/lib/active_scaffold/bridges/file_column.rb +0 -11
- data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +0 -46
- data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +0 -57
- data/lib/active_scaffold/bridges/file_column/form_ui.rb +0 -34
- data/lib/active_scaffold/bridges/file_column/list_ui.rb +0 -26
- data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +0 -43
- data/lib/active_scaffold/bridges/file_column/test/mock_model.rb +0 -9
- data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +0 -15
- data/lib/active_scaffold/bridges/paperclip.rb +0 -12
- data/lib/active_scaffold/bridges/paperclip/form_ui.rb +0 -27
- data/lib/active_scaffold/bridges/paperclip/list_ui.rb +0 -16
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +0 -36
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +0 -24
- data/lib/active_scaffold/bridges/record_select.rb +0 -11
- data/lib/active_scaffold/bridges/record_select/helpers.rb +0 -92
- data/lib/active_scaffold/bridges/semantic_attributes.rb +0 -5
- data/lib/active_scaffold/bridges/semantic_attributes/column.rb +0 -20
- data/lib/active_scaffold/bridges/shared/date_bridge.rb +0 -209
- data/lib/active_scaffold/bridges/tiny_mce.rb +0 -17
- data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +0 -46
- data/lib/active_scaffold/config/base.rb +0 -75
- data/lib/active_scaffold/config/core.rb +0 -236
- data/lib/active_scaffold/config/create.rb +0 -32
- data/lib/active_scaffold/config/delete.rb +0 -32
- data/lib/active_scaffold/config/field_search.rb +0 -79
- data/lib/active_scaffold/config/form.rb +0 -64
- data/lib/active_scaffold/config/list.rb +0 -247
- data/lib/active_scaffold/config/mark.rb +0 -30
- data/lib/active_scaffold/config/nested.rb +0 -42
- data/lib/active_scaffold/config/search.rb +0 -73
- data/lib/active_scaffold/config/show.rb +0 -31
- data/lib/active_scaffold/config/subform.rb +0 -35
- data/lib/active_scaffold/config/update.rb +0 -33
- data/lib/active_scaffold/configurable.rb +0 -29
- data/lib/active_scaffold/constraints.rb +0 -171
- data/lib/active_scaffold/data_structures/action_columns.rb +0 -142
- data/lib/active_scaffold/data_structures/action_link.rb +0 -185
- data/lib/active_scaffold/data_structures/action_links.rb +0 -191
- data/lib/active_scaffold/data_structures/actions.rb +0 -45
- data/lib/active_scaffold/data_structures/bridge.rb +0 -22
- data/lib/active_scaffold/data_structures/column.rb +0 -401
- data/lib/active_scaffold/data_structures/columns.rb +0 -75
- data/lib/active_scaffold/data_structures/error_message.rb +0 -24
- data/lib/active_scaffold/data_structures/nested_info.rb +0 -171
- data/lib/active_scaffold/data_structures/set.rb +0 -61
- data/lib/active_scaffold/data_structures/sorting.rb +0 -167
- data/lib/active_scaffold/engine.rb +0 -4
- data/lib/active_scaffold/extensions/action_controller_rendering.rb +0 -20
- data/lib/active_scaffold/extensions/action_controller_rescueing.rb +0 -7
- data/lib/active_scaffold/extensions/action_view_rendering.rb +0 -115
- data/lib/active_scaffold/extensions/active_record_offset.rb +0 -12
- data/lib/active_scaffold/extensions/array.rb +0 -7
- data/lib/active_scaffold/extensions/cache_association.rb +0 -16
- data/lib/active_scaffold/extensions/localize.rb +0 -10
- data/lib/active_scaffold/extensions/name_option_for_datetime.rb +0 -12
- data/lib/active_scaffold/extensions/nil_id_in_url_params.rb +0 -7
- data/lib/active_scaffold/extensions/paginator_extensions.rb +0 -26
- data/lib/active_scaffold/extensions/reverse_associations.rb +0 -64
- data/lib/active_scaffold/extensions/routing_mapper.rb +0 -48
- data/lib/active_scaffold/extensions/to_label.rb +0 -8
- data/lib/active_scaffold/extensions/unsaved_associated.rb +0 -61
- data/lib/active_scaffold/extensions/unsaved_record.rb +0 -20
- data/lib/active_scaffold/extensions/usa_state.rb +0 -46
- data/lib/active_scaffold/finder.rb +0 -399
- data/lib/active_scaffold/helpers/association_helpers.rb +0 -42
- data/lib/active_scaffold/helpers/controller_helpers.rb +0 -94
- data/lib/active_scaffold/helpers/form_column_helpers.rb +0 -322
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +0 -64
- data/lib/active_scaffold/helpers/id_helpers.rb +0 -131
- data/lib/active_scaffold/helpers/list_column_helpers.rb +0 -374
- data/lib/active_scaffold/helpers/pagination_helpers.rb +0 -62
- data/lib/active_scaffold/helpers/search_column_helpers.rb +0 -257
- data/lib/active_scaffold/helpers/show_column_helpers.rb +0 -44
- data/lib/active_scaffold/helpers/view_helpers.rb +0 -398
- data/lib/active_scaffold/marked_model.rb +0 -38
- data/lib/active_scaffold/paginator.rb +0 -136
- data/lib/active_scaffold/responds_to_parent.rb +0 -70
- data/lib/active_scaffold/tableless.rb +0 -83
- data/lib/active_scaffold/version.rb +0 -9
- data/lib/active_scaffold_env.rb +0 -13
- data/lib/generators/active_scaffold/USAGE +0 -29
- data/lib/generators/active_scaffold/active_scaffold_generator.rb +0 -21
- data/lib/generators/active_scaffold_controller/USAGE +0 -19
- data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +0 -29
- data/lib/generators/active_scaffold_controller/templates/controller.rb +0 -4
- data/lib/generators/active_scaffold_controller/templates/helper.rb +0 -2
- data/public/blank.html +0 -33
- data/shoulda_macros/macros.rb +0 -136
- data/vendor/assets/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/vendor/assets/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/vendor/assets/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/vendor/assets/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/vendor/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/vendor/assets/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/vendor/assets/images/ui-icons_222222_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_228ef1_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_ef8c08_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_ffd27a_256x240.png +0 -0
- data/vendor/assets/images/ui-icons_ffffff_256x240.png +0 -0
- data/vendor/assets/javascripts/jquery-ui-timepicker-addon.js +0 -1276
- data/vendor/assets/stylesheets/jquery-ui.css +0 -568
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# wrap the action rendering for ActiveScaffold controllers
|
|
2
|
-
module ActionController #:nodoc:
|
|
3
|
-
class Base
|
|
4
|
-
def render_with_active_scaffold(*args, &block)
|
|
5
|
-
if self.class.uses_active_scaffold? and params[:adapter] and @rendering_adapter.nil? and request.xhr?
|
|
6
|
-
@rendering_adapter = true # recursion control
|
|
7
|
-
# if we need an adapter, then we render the actual stuff to a string and insert it into the adapter template
|
|
8
|
-
opts = args.blank? ? Hash.new : args.first
|
|
9
|
-
render :partial => params[:adapter][1..-1],
|
|
10
|
-
:locals => {:payload => render_to_string(opts.merge(:layout => false), &block).html_safe},
|
|
11
|
-
:use_full_path => true, :layout => false, :content_type => :html
|
|
12
|
-
@rendering_adapter = nil # recursion control
|
|
13
|
-
else
|
|
14
|
-
render_without_active_scaffold(*args, &block)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
alias_method_chain :render, :active_scaffold
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
module ActionView
|
|
2
|
-
class LookupContext
|
|
3
|
-
module ViewPaths
|
|
4
|
-
def find_all_templates(name, partial = false, locals = {})
|
|
5
|
-
prefixes.collect do |prefix|
|
|
6
|
-
view_paths.collect do |resolver|
|
|
7
|
-
if Rails.version < '3.2.0' # FIXME: remove when rails 3.1 support is dropped
|
|
8
|
-
temp_args = *args_for_lookup(name, [prefix], partial, locals)
|
|
9
|
-
else
|
|
10
|
-
temp_args = *args_for_lookup(name, [prefix], partial, locals, {})
|
|
11
|
-
end
|
|
12
|
-
temp_args[1] = temp_args[1][0]
|
|
13
|
-
resolver.find_all(*temp_args)
|
|
14
|
-
end
|
|
15
|
-
end.flatten!
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# wrap the action rendering for ActiveScaffold views
|
|
22
|
-
module ActionView::Helpers #:nodoc:
|
|
23
|
-
module RenderingHelper
|
|
24
|
-
#
|
|
25
|
-
# Adds two rendering options.
|
|
26
|
-
#
|
|
27
|
-
# ==render :super
|
|
28
|
-
#
|
|
29
|
-
# This syntax skips all template overrides and goes directly to the provided ActiveScaffold templates.
|
|
30
|
-
# Useful if you want to wrap an existing template. Just call super!
|
|
31
|
-
#
|
|
32
|
-
# ==render :active_scaffold => #{controller.to_s}, options = {}+
|
|
33
|
-
#
|
|
34
|
-
# Lets you embed an ActiveScaffold by referencing the controller where it's configured.
|
|
35
|
-
#
|
|
36
|
-
# You may specify options[:constraints] for the embedded scaffold. These constraints have three effects:
|
|
37
|
-
# * the scaffold's only displays records matching the constraint
|
|
38
|
-
# * all new records created will be assigned the constrained values
|
|
39
|
-
# * constrained columns will be hidden (they're pretty boring at this point)
|
|
40
|
-
#
|
|
41
|
-
# You may also specify options[:conditions] for the embedded scaffold. These only do 1/3 of what
|
|
42
|
-
# constraints do (they only limit search results). Any format accepted by ActiveRecord::Base.find is valid.
|
|
43
|
-
#
|
|
44
|
-
# Defining options[:label] lets you completely customize the list title for the embedded scaffold.
|
|
45
|
-
#
|
|
46
|
-
def render_with_active_scaffold(*args, &block)
|
|
47
|
-
if args.first == :super
|
|
48
|
-
last_view = view_stack.last || {:view => instance_variable_get(:@virtual_path).split('/').last}
|
|
49
|
-
options = args[1] || {}
|
|
50
|
-
options[:locals] ||= {}
|
|
51
|
-
options[:locals].reverse_merge!(last_view[:locals] || {})
|
|
52
|
-
if last_view[:templates].nil?
|
|
53
|
-
last_view[:templates] = lookup_context.find_all_templates(last_view[:view], last_view[:partial], options[:locals].keys)
|
|
54
|
-
last_view[:templates].shift
|
|
55
|
-
end
|
|
56
|
-
options[:template] = last_view[:templates].shift
|
|
57
|
-
view_stack << last_view
|
|
58
|
-
result = render_without_active_scaffold options
|
|
59
|
-
view_stack.pop
|
|
60
|
-
result
|
|
61
|
-
elsif args.first.is_a? Hash and args.first[:active_scaffold]
|
|
62
|
-
require 'digest/md5'
|
|
63
|
-
options = args.first
|
|
64
|
-
|
|
65
|
-
remote_controller = options[:active_scaffold]
|
|
66
|
-
constraints = options[:constraints]
|
|
67
|
-
conditions = options[:conditions]
|
|
68
|
-
eid = Digest::MD5.hexdigest(params[:controller] + remote_controller.to_s + constraints.to_s + conditions.to_s)
|
|
69
|
-
session["as:#{eid}"] = {:constraints => constraints, :conditions => conditions, :list => {:label => args.first[:label]}}
|
|
70
|
-
options[:params] ||= {}
|
|
71
|
-
options[:params].merge! :eid => eid, :embedded => true
|
|
72
|
-
|
|
73
|
-
id = "as_#{eid}-embedded"
|
|
74
|
-
url_options = {:controller => remote_controller.to_s, :action => 'index'}.merge(options[:params])
|
|
75
|
-
|
|
76
|
-
if controller.respond_to?(:render_component_into_view)
|
|
77
|
-
controller.send(:render_component_into_view, url_options)
|
|
78
|
-
else
|
|
79
|
-
content_tag(:div, :id => id, :class => 'active-scaffold-component') do
|
|
80
|
-
url = url_for(url_options)
|
|
81
|
-
# parse the ActiveRecord model name from the controller path, which
|
|
82
|
-
# might be a namespaced controller (e.g., 'admin/admins')
|
|
83
|
-
model = remote_controller.to_s.sub(/.*\//, '').singularize
|
|
84
|
-
content_tag(:div, :class => 'active-scaffold-header') do
|
|
85
|
-
content_tag :h2, link_to(args.first[:label] || active_scaffold_config_for(model).list.label, url, :remote => true)
|
|
86
|
-
end <<
|
|
87
|
-
if ActiveScaffold.js_framework == :prototype
|
|
88
|
-
javascript_tag("new Ajax.Updater('#{id}', '#{url}', {method: 'get', evalScripts: true});")
|
|
89
|
-
elsif ActiveScaffold.js_framework == :jquery
|
|
90
|
-
javascript_tag("jQuery('##{id}').load('#{url}');")
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
else
|
|
96
|
-
options = args.first
|
|
97
|
-
if options.is_a?(Hash)
|
|
98
|
-
current_view = {:view => options[:partial], :partial => true} if options[:partial]
|
|
99
|
-
current_view = {:view => options[:template], :partial => false} if current_view.nil? && options[:template]
|
|
100
|
-
current_view[:locals] = options[:locals] if !current_view.nil? && options[:locals]
|
|
101
|
-
view_stack << current_view if current_view.present?
|
|
102
|
-
end
|
|
103
|
-
result = render_without_active_scaffold(*args, &block)
|
|
104
|
-
view_stack.pop if current_view.present?
|
|
105
|
-
result
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
alias_method_chain :render, :active_scaffold
|
|
109
|
-
|
|
110
|
-
def view_stack
|
|
111
|
-
@_view_stack ||= []
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
end
|
|
115
|
-
end
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Bugfix: Team.offset(1).limit(1) throws an error
|
|
2
|
-
ActiveRecord::Base.instance_eval do
|
|
3
|
-
def offset(*args, &block)
|
|
4
|
-
scoped.__send__(:offset, *args, &block)
|
|
5
|
-
rescue NoMethodError
|
|
6
|
-
if scoped.nil?
|
|
7
|
-
'depends on :allow_nil'
|
|
8
|
-
else
|
|
9
|
-
raise
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module ActiveRecord
|
|
2
|
-
class Relation
|
|
3
|
-
def target=(records)
|
|
4
|
-
@loaded = true
|
|
5
|
-
@records = records
|
|
6
|
-
@records
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
module ActiveRecord
|
|
11
|
-
module Associations
|
|
12
|
-
class CollectionProxy
|
|
13
|
-
delegate :target=, :to => :@association
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
class Object
|
|
2
|
-
def as_(key, options = {})
|
|
3
|
-
unless key.blank?
|
|
4
|
-
text = I18n.translate "#{key}", {:scope => [:active_scaffold, *options.delete(:scope)], :default => key.is_a?(String) ? key : key.to_s.titleize}.merge(options)
|
|
5
|
-
# text = nil if text.include?('translation missing:')
|
|
6
|
-
end
|
|
7
|
-
text ||= key
|
|
8
|
-
text
|
|
9
|
-
end
|
|
10
|
-
end
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
module ActionView
|
|
2
|
-
module Helpers
|
|
3
|
-
class InstanceTag
|
|
4
|
-
private
|
|
5
|
-
def datetime_selector_with_name(options, html_options)
|
|
6
|
-
options.merge!(:prefix => options[:name].gsub(/\[[^\[]*\]$/,'')) if options[:name]
|
|
7
|
-
datetime_selector_without_name(options, html_options)
|
|
8
|
-
end
|
|
9
|
-
alias_method_chain :datetime_selector, :name
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
require 'active_scaffold/paginator'
|
|
2
|
-
|
|
3
|
-
class Paginator
|
|
4
|
-
|
|
5
|
-
# Total number of pages
|
|
6
|
-
def number_of_pages_with_infinite
|
|
7
|
-
number_of_pages_without_infinite unless infinite?
|
|
8
|
-
end
|
|
9
|
-
alias_method_chain :number_of_pages, :infinite
|
|
10
|
-
|
|
11
|
-
# Is this an "infinite" paginator
|
|
12
|
-
def infinite?
|
|
13
|
-
@count.nil?
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
class Page
|
|
17
|
-
# Checks to see if there's a page after this one
|
|
18
|
-
def next_with_infinite?
|
|
19
|
-
return true if @pager.infinite?
|
|
20
|
-
next_without_infinite?
|
|
21
|
-
end
|
|
22
|
-
alias_method_chain :next?, :infinite
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
end
|
|
26
|
-
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
module ActiveRecord
|
|
2
|
-
module Reflection
|
|
3
|
-
class AssociationReflection #:nodoc:
|
|
4
|
-
def inverse_for?(klass)
|
|
5
|
-
inverse_class = inverse_of.try(:active_record)
|
|
6
|
-
inverse_class.present? && (inverse_class == klass || klass < inverse_class)
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
attr_writer :reverse
|
|
10
|
-
def reverse
|
|
11
|
-
@reverse ||= inverse_of.try(:name)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def inverse_of_with_autodetect
|
|
15
|
-
inverse_of_without_autodetect || autodetect_inverse
|
|
16
|
-
end
|
|
17
|
-
alias_method_chain :inverse_of, :autodetect
|
|
18
|
-
|
|
19
|
-
protected
|
|
20
|
-
|
|
21
|
-
def autodetect_inverse
|
|
22
|
-
return nil if options[:polymorphic]
|
|
23
|
-
reverse_matches = []
|
|
24
|
-
|
|
25
|
-
# stage 1 filter: collect associations that point back to this model and use the same foreign_key
|
|
26
|
-
klass.reflect_on_all_associations.each do |assoc|
|
|
27
|
-
if self.options[:through]
|
|
28
|
-
# only iterate has_many :through associations
|
|
29
|
-
next unless assoc.options[:through]
|
|
30
|
-
next unless assoc.through_reflection.klass == self.through_reflection.klass
|
|
31
|
-
else
|
|
32
|
-
# skip over has_many :through associations
|
|
33
|
-
next if assoc.options[:through]
|
|
34
|
-
next unless assoc.options[:polymorphic] or assoc.class_name.constantize == self.active_record
|
|
35
|
-
|
|
36
|
-
case [assoc.macro, self.macro].find_all{|m| m == :has_and_belongs_to_many}.length
|
|
37
|
-
# if both are a habtm, then match them based on the join table
|
|
38
|
-
when 2
|
|
39
|
-
next unless assoc.options[:join_table] == self.options[:join_table]
|
|
40
|
-
|
|
41
|
-
# if only one is a habtm, they do not match
|
|
42
|
-
when 1
|
|
43
|
-
next
|
|
44
|
-
|
|
45
|
-
# otherwise, match them based on the foreign_key
|
|
46
|
-
when 0
|
|
47
|
-
next unless assoc.foreign_key.to_sym == self.foreign_key.to_sym
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
reverse_matches << assoc
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# stage 2 filter: name-based matching (association name vs self.active_record.to_s)
|
|
55
|
-
reverse_matches.find_all do |assoc|
|
|
56
|
-
self.active_record.to_s.underscore.include? assoc.name.to_s.pluralize.singularize
|
|
57
|
-
end if reverse_matches.length > 1
|
|
58
|
-
|
|
59
|
-
reverse_matches.first
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
module ActionDispatch
|
|
2
|
-
module Routing
|
|
3
|
-
ACTIVE_SCAFFOLD_CORE_ROUTING = {
|
|
4
|
-
:collection => {:show_search => :get, :render_field => :get, :mark => :post},
|
|
5
|
-
:member => {:row => :get, :update_column => :post, :render_field => :get, :mark => :post}
|
|
6
|
-
}
|
|
7
|
-
ACTIVE_SCAFFOLD_ASSOCIATION_ROUTING = {
|
|
8
|
-
:collection => {:edit_associated => :get, :new_existing => :get, :add_existing => :post},
|
|
9
|
-
:member => {:edit_associated => :get, :add_association => :get, :destroy_existing => :delete}
|
|
10
|
-
}
|
|
11
|
-
class Mapper
|
|
12
|
-
module Base
|
|
13
|
-
def as_routes(options = {:association => true})
|
|
14
|
-
collection do
|
|
15
|
-
ActionDispatch::Routing::ACTIVE_SCAFFOLD_CORE_ROUTING[:collection].each {|name, type| send(type, name)}
|
|
16
|
-
end
|
|
17
|
-
member do
|
|
18
|
-
ActionDispatch::Routing::ACTIVE_SCAFFOLD_CORE_ROUTING[:member].each {|name, type| send(type, name)}
|
|
19
|
-
end
|
|
20
|
-
as_association_routes if options[:association]
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def as_association_routes
|
|
24
|
-
collection do
|
|
25
|
-
ActionDispatch::Routing::ACTIVE_SCAFFOLD_ASSOCIATION_ROUTING[:collection].each {|name, type| send(type, name)}
|
|
26
|
-
end
|
|
27
|
-
member do
|
|
28
|
-
ActionDispatch::Routing::ACTIVE_SCAFFOLD_ASSOCIATION_ROUTING[:member].each {|name, type| send(type, name)}
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def as_nested_resources(*resources)
|
|
33
|
-
options = resources.extract_options!
|
|
34
|
-
resources.each do |resource|
|
|
35
|
-
resources(resource, options.merge(:parent_scaffold => merge_module_scope(@scope[:module], parent_resource.plural), :association => resource)) { yield if block_given? }
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def as_scoped_routes(*scopes)
|
|
40
|
-
options = scopes.extract_options!
|
|
41
|
-
scopes.each do |scope|
|
|
42
|
-
resources(scope, options.merge(:parent_scaffold => merge_module_scope(@scope[:module], parent_resource.plural), :named_scope => scope, :controller => parent_resource.plural)) { yield if block_given? }
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# save and validation support for associations.
|
|
2
|
-
class ActiveRecord::Base
|
|
3
|
-
def associated_valid?(path = [])
|
|
4
|
-
return true if path.include?(self) # prevent recursion (if associated and parent are new records)
|
|
5
|
-
path << self
|
|
6
|
-
# using [].all? syntax to avoid a short-circuit
|
|
7
|
-
with_unsaved_associated { |a| [a.valid?, a.associated_valid?(path)].all? {|v| v == true} }
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def save_associated
|
|
11
|
-
with_unsaved_associated { |a| a.save and a.save_associated }
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def save_associated!
|
|
15
|
-
save_associated or raise(ActiveRecord::RecordNotSaved)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def no_errors_in_associated?
|
|
19
|
-
with_unsaved_associated {|a| a.errors.count == 0 and a.no_errors_in_associated?}
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
protected
|
|
23
|
-
|
|
24
|
-
# Provide an override to allow the model to restrict which associations are considered
|
|
25
|
-
# by ActiveScaffolds update mechanism. This allows the model to restrict things like
|
|
26
|
-
# Acts-As-Versioned versions associations being traversed.
|
|
27
|
-
#
|
|
28
|
-
# By defining the method :scaffold_update_nofollow returning an array of associations
|
|
29
|
-
# these associations will not be traversed.
|
|
30
|
-
# By defining the method :scaffold_update_follow returning an array of associations,
|
|
31
|
-
# only those associations will be traversed.
|
|
32
|
-
#
|
|
33
|
-
# Otherwise the default behaviour of traversing all associations will be preserved.
|
|
34
|
-
def associations_for_update
|
|
35
|
-
if self.respond_to?( :scaffold_update_nofollow )
|
|
36
|
-
self.class.reflect_on_all_associations.reject { |association| self.scaffold_update_nofollow.include?( association.name ) }
|
|
37
|
-
elsif self.respond_to?( :scaffold_update_follow )
|
|
38
|
-
self.class.reflect_on_all_associations.select { |association| self.scaffold_update_follow.include?( association.name ) }
|
|
39
|
-
else
|
|
40
|
-
self.class.reflect_on_all_associations
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
private
|
|
45
|
-
|
|
46
|
-
# yields every associated object that has been instantiated and is flagged as unsaved.
|
|
47
|
-
# returns false if any yield returns false.
|
|
48
|
-
# returns true otherwise, even when none of the associations have been instantiated. build wrapper methods accordingly.
|
|
49
|
-
def with_unsaved_associated
|
|
50
|
-
associations_for_update.all? do |association|
|
|
51
|
-
association_proxy = send(association.name)
|
|
52
|
-
if association_proxy
|
|
53
|
-
records = association_proxy
|
|
54
|
-
records = [records] unless records.is_a? Array # convert singular associations into collections for ease of use
|
|
55
|
-
records.select {|r| r.unsaved? and not r.readonly?}.all? {|r| yield r} # must use select instead of find_all, which Rails overrides on association proxies for db access
|
|
56
|
-
else
|
|
57
|
-
true
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# a simple (manual) unsaved? flag and method. at least it automatically reverts after a save!
|
|
2
|
-
class ActiveRecord::Base
|
|
3
|
-
# acts like a dirty? flag, manually thrown during update_record_from_params.
|
|
4
|
-
def unsaved=(val)
|
|
5
|
-
@unsaved = (val) ? true : false
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
# whether the unsaved? flag has been thrown
|
|
9
|
-
def unsaved?
|
|
10
|
-
@unsaved
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
# automatically unsets the unsaved flag
|
|
14
|
-
def save_with_unsaved_flag(*args)
|
|
15
|
-
result = save_without_unsaved_flag(*args)
|
|
16
|
-
self.unsaved = false
|
|
17
|
-
return result
|
|
18
|
-
end
|
|
19
|
-
alias_method_chain :save, :unsaved_flag
|
|
20
|
-
end
|