active_scaffold 3.2.17 → 3.2.18
Sign up to get free protection for your applications and to get access to all the features.
- 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,64 +0,0 @@
|
|
1
|
-
module ActiveScaffold::Config
|
2
|
-
class Form < Base
|
3
|
-
def initialize(core_config)
|
4
|
-
super
|
5
|
-
# start with the ActionLink defined globally
|
6
|
-
@link = self.class.link.clone unless self.class.link.nil?
|
7
|
-
@show_unauthorized_columns = self.class.show_unauthorized_columns
|
8
|
-
@refresh_list = self.class.refresh_list
|
9
|
-
@persistent = self.class.persistent
|
10
|
-
|
11
|
-
# no global setting here because multipart should only be set for specific forms
|
12
|
-
@multipart = false
|
13
|
-
end
|
14
|
-
|
15
|
-
# global level configuration
|
16
|
-
# --------------------------
|
17
|
-
# show value of unauthorized columns instead of skip them
|
18
|
-
class_attribute :show_unauthorized_columns
|
19
|
-
|
20
|
-
# whether the form stays open after an update or not
|
21
|
-
cattr_accessor :persistent
|
22
|
-
@@persistent = false
|
23
|
-
|
24
|
-
# whether we should refresh list after update or not
|
25
|
-
cattr_accessor :refresh_list
|
26
|
-
@@refresh_list = false
|
27
|
-
|
28
|
-
# instance-level configuration
|
29
|
-
# ----------------------------
|
30
|
-
|
31
|
-
# show value of unauthorized columns instead of skip them
|
32
|
-
attr_accessor :show_unauthorized_columns
|
33
|
-
|
34
|
-
# the ActionLink for this action
|
35
|
-
attr_accessor :link
|
36
|
-
|
37
|
-
# the label for this Form action. used for the header.
|
38
|
-
attr_writer :label
|
39
|
-
|
40
|
-
# whether the form stays open after a create or not
|
41
|
-
attr_accessor :persistent
|
42
|
-
|
43
|
-
# whether we should refresh list after create or not
|
44
|
-
attr_accessor :refresh_list
|
45
|
-
|
46
|
-
# provides access to the list of columns specifically meant for the Form to use
|
47
|
-
def columns
|
48
|
-
unless @columns # lazy evaluation
|
49
|
-
self.columns = @core.columns._inheritable
|
50
|
-
self.columns.exclude :created_on, :created_at, :updated_on, :updated_at, :as_marked
|
51
|
-
self.columns.exclude *@core.columns.collect{|c| c.name if c.polymorphic_association?}.compact
|
52
|
-
end
|
53
|
-
@columns
|
54
|
-
end
|
55
|
-
|
56
|
-
public :columns=
|
57
|
-
|
58
|
-
# whether the form should be multipart
|
59
|
-
attr_writer :multipart
|
60
|
-
def multipart?
|
61
|
-
@multipart ? true : false
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,247 +0,0 @@
|
|
1
|
-
module ActiveScaffold::Config
|
2
|
-
class List < Base
|
3
|
-
self.crud_type = :read
|
4
|
-
|
5
|
-
def initialize(core_config)
|
6
|
-
super
|
7
|
-
# inherit from global scope
|
8
|
-
# full configuration path is: defaults => global table => local table
|
9
|
-
@per_page = self.class.per_page
|
10
|
-
@page_links_inner_window = self.class.page_links_inner_window
|
11
|
-
@page_links_outer_window = self.class.page_links_outer_window
|
12
|
-
|
13
|
-
# originates here
|
14
|
-
@sorting = ActiveScaffold::DataStructures::Sorting.new(@core.columns)
|
15
|
-
@sorting.set_default_sorting(@core.model)
|
16
|
-
|
17
|
-
# inherit from global scope
|
18
|
-
@empty_field_text = self.class.empty_field_text
|
19
|
-
@association_join_text = self.class.association_join_text
|
20
|
-
@pagination = self.class.pagination
|
21
|
-
@show_search_reset = self.class.show_search_reset
|
22
|
-
@reset_link = self.class.reset_link.clone
|
23
|
-
@wrap_tag = self.class.wrap_tag
|
24
|
-
@always_show_search = self.class.always_show_search
|
25
|
-
@always_show_create = self.class.always_show_create
|
26
|
-
end
|
27
|
-
|
28
|
-
# global level configuration
|
29
|
-
# --------------------------
|
30
|
-
# how many records to show per page
|
31
|
-
cattr_accessor :per_page
|
32
|
-
@@per_page = 15
|
33
|
-
|
34
|
-
# how many page links around current page to show
|
35
|
-
cattr_accessor :page_links_inner_window
|
36
|
-
@@page_links_inner_window = 2
|
37
|
-
|
38
|
-
# how many page links around first and last page to show
|
39
|
-
cattr_accessor :page_links_outer_window
|
40
|
-
@@page_links_outer_window = 0
|
41
|
-
|
42
|
-
class << self
|
43
|
-
def page_links_window=(value)
|
44
|
-
ActiveSupport::Deprecation.warn("Use page_links_inner_window", caller(1))
|
45
|
-
self.page_links_inner_window = value
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# what string to use when a field is empty
|
50
|
-
cattr_accessor :empty_field_text
|
51
|
-
@@empty_field_text = '-'
|
52
|
-
|
53
|
-
# what string to use to join records from plural associations
|
54
|
-
cattr_accessor :association_join_text
|
55
|
-
@@association_join_text = ', '
|
56
|
-
|
57
|
-
# What kind of pagination to use:
|
58
|
-
# * true: The usual pagination
|
59
|
-
# * :infinite: Treat the source as having an infinite number of pages (i.e. don't count the records; useful for large tables where counting is slow and we don't really care anyway)
|
60
|
-
# * false: Disable pagination
|
61
|
-
cattr_accessor :pagination
|
62
|
-
@@pagination = true
|
63
|
-
|
64
|
-
# show a link to reset the search next to filtered message
|
65
|
-
cattr_accessor :show_search_reset
|
66
|
-
@@show_search_reset = true
|
67
|
-
|
68
|
-
# the ActionLink to reset search
|
69
|
-
cattr_reader :reset_link
|
70
|
-
@@reset_link = ActiveScaffold::DataStructures::ActionLink.new('index', :label => :click_to_reset, :type => :collection, :position => false)
|
71
|
-
|
72
|
-
# wrap normal cells (not inplace editable columns or with link) with a tag
|
73
|
-
# it allows for more css styling
|
74
|
-
cattr_accessor :wrap_tag
|
75
|
-
@@wrap_tag = nil
|
76
|
-
|
77
|
-
# Show search form in the list header instead of display the link
|
78
|
-
cattr_accessor :always_show_search
|
79
|
-
@@always_show_search = false
|
80
|
-
|
81
|
-
# Show create form in the list header instead of display the link
|
82
|
-
cattr_accessor :always_show_create
|
83
|
-
@@always_show_create = false
|
84
|
-
|
85
|
-
# instance-level configuration
|
86
|
-
# ----------------------------
|
87
|
-
|
88
|
-
# provides access to the list of columns specifically meant for the Table to use
|
89
|
-
def columns
|
90
|
-
self.columns = @core.columns._inheritable unless @columns # lazy evaluation
|
91
|
-
@columns
|
92
|
-
end
|
93
|
-
|
94
|
-
public :columns=
|
95
|
-
|
96
|
-
# how many rows to show at once
|
97
|
-
attr_accessor :per_page
|
98
|
-
|
99
|
-
# how many page links around current page to show
|
100
|
-
attr_accessor :page_links_inner_window
|
101
|
-
|
102
|
-
# how many page links around current page to show
|
103
|
-
attr_accessor :page_links_outer_window
|
104
|
-
|
105
|
-
def page_links_window=(value)
|
106
|
-
ActiveSupport::Deprecation.warn("Use page_links_inner_window", caller(1))
|
107
|
-
self.page_links_inner_window = value
|
108
|
-
end
|
109
|
-
|
110
|
-
# What kind of pagination to use:
|
111
|
-
# * true: The usual pagination
|
112
|
-
# * :infinite: Treat the source as having an infinite number of pages (i.e. don't count the records; useful for large tables where counting is slow and we don't really care anyway)
|
113
|
-
# * false: Disable pagination
|
114
|
-
attr_accessor :pagination
|
115
|
-
|
116
|
-
# what string to use when a field is empty
|
117
|
-
attr_accessor :empty_field_text
|
118
|
-
|
119
|
-
# what string to use to join records from plural associations
|
120
|
-
attr_accessor :association_join_text
|
121
|
-
|
122
|
-
# show a link to reset the search next to filtered message
|
123
|
-
attr_accessor :show_search_reset
|
124
|
-
|
125
|
-
# the ActionLink to reset search
|
126
|
-
attr_reader :reset_link
|
127
|
-
|
128
|
-
# the default sorting. should be an array of hashes of {column_name => direction}, e.g. [{:a => 'desc'}, {:b => 'asc'}]. to just sort on one column, you can simply provide a hash, though, e.g. {:a => 'desc'}.
|
129
|
-
def sorting=(val)
|
130
|
-
val = [val] if val.is_a? Hash
|
131
|
-
sorting.clear
|
132
|
-
val.each { |clause| sorting.add *Array(clause).first }
|
133
|
-
end
|
134
|
-
def sorting
|
135
|
-
@sorting ||= ActiveScaffold::DataStructures::Sorting.new(@core.columns)
|
136
|
-
end
|
137
|
-
|
138
|
-
# overwrite the includes used for the count sql query
|
139
|
-
attr_accessor :count_includes
|
140
|
-
|
141
|
-
# the label for this List action. used for the header.
|
142
|
-
attr_writer :label
|
143
|
-
def label
|
144
|
-
@label ? as_(@label, :count => 2) : @core.label(:count => 2)
|
145
|
-
end
|
146
|
-
|
147
|
-
attr_writer :no_entries_message
|
148
|
-
def no_entries_message
|
149
|
-
@no_entries_message ? @no_entries_message : :no_entries
|
150
|
-
end
|
151
|
-
|
152
|
-
attr_writer :filtered_message
|
153
|
-
def filtered_message
|
154
|
-
@filtered_message ? @filtered_message : :filtered
|
155
|
-
end
|
156
|
-
|
157
|
-
attr_writer :always_show_search
|
158
|
-
def always_show_search
|
159
|
-
@always_show_search && !search_partial.blank?
|
160
|
-
end
|
161
|
-
|
162
|
-
def search_partial
|
163
|
-
return "search" if @core.actions.include?(:search)
|
164
|
-
return "field_search" if @core.actions.include?(:field_search)
|
165
|
-
end
|
166
|
-
|
167
|
-
# always show create
|
168
|
-
attr_writer :always_show_create
|
169
|
-
def always_show_create
|
170
|
-
@always_show_create && @core.actions.include?(:create)
|
171
|
-
end
|
172
|
-
|
173
|
-
# if list view is nested hide nested_column
|
174
|
-
attr_writer :hide_nested_column
|
175
|
-
def hide_nested_column
|
176
|
-
@hide_nested_column.nil? ? true : @hide_nested_column
|
177
|
-
end
|
178
|
-
|
179
|
-
# might be set to open nested_link automatically in view
|
180
|
-
# conf.nested.add_link(:players)
|
181
|
-
# conf.list.nested_auto_open = {:players => 2}
|
182
|
-
# will open nested players view if there are 2 or less records in parent
|
183
|
-
attr_accessor :nested_auto_open
|
184
|
-
|
185
|
-
# wrap normal cells (not inplace editable columns or with link) with a tag
|
186
|
-
# it allows for more css styling
|
187
|
-
attr_accessor :wrap_tag
|
188
|
-
|
189
|
-
class UserSettings < UserSettings
|
190
|
-
def initialize(conf, storage, params)
|
191
|
-
super(conf,storage,params)
|
192
|
-
@sorting = nil
|
193
|
-
end
|
194
|
-
|
195
|
-
# This label has alread been localized.
|
196
|
-
def label
|
197
|
-
@session[:label] ? @session[:label] : @conf.label
|
198
|
-
end
|
199
|
-
|
200
|
-
def per_page
|
201
|
-
@session['per_page'] = @params['limit'].to_i if @params.has_key? 'limit'
|
202
|
-
@session['per_page'] || @conf.per_page
|
203
|
-
end
|
204
|
-
|
205
|
-
def page
|
206
|
-
@session['page'] = @params['page'] if @params.has_key? 'page'
|
207
|
-
@session['page'] || 1
|
208
|
-
end
|
209
|
-
|
210
|
-
def page=(value = nil)
|
211
|
-
@session['page'] = value
|
212
|
-
end
|
213
|
-
|
214
|
-
attr_reader :nested_default_sorting
|
215
|
-
|
216
|
-
def nested_default_sorting=(options)
|
217
|
-
@nested_default_sorting ||= @conf.sorting.clone
|
218
|
-
@nested_default_sorting.set_nested_sorting(options[:table_name], options[:default_sorting])
|
219
|
-
end
|
220
|
-
|
221
|
-
def default_sorting
|
222
|
-
nested_default_sorting.nil? ? @conf.sorting : nested_default_sorting
|
223
|
-
end
|
224
|
-
|
225
|
-
def sorting
|
226
|
-
if @sorting.nil?
|
227
|
-
# we want to store as little as possible in the session, but we want to return a Sorting data structure. so we recreate it each page load based on session data.
|
228
|
-
@session['sort'] = [@params['sort'], @params['sort_direction']] if @params['sort'] and @params['sort_direction']
|
229
|
-
@session['sort'] = nil if @params['sort_direction'] == 'reset'
|
230
|
-
|
231
|
-
if @session['sort']
|
232
|
-
sorting = @conf.sorting.clone
|
233
|
-
sorting.set(*@session['sort'])
|
234
|
-
@sorting = sorting
|
235
|
-
else
|
236
|
-
@sorting = default_sorting
|
237
|
-
end
|
238
|
-
end
|
239
|
-
@sorting
|
240
|
-
end
|
241
|
-
|
242
|
-
def count_includes
|
243
|
-
@conf.count_includes
|
244
|
-
end
|
245
|
-
end
|
246
|
-
end
|
247
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module ActiveScaffold::Config
|
2
|
-
class Mark < Base
|
3
|
-
self.crud_type = :read
|
4
|
-
|
5
|
-
# What kind of mark all mode to use:
|
6
|
-
# * :search: de-/mark all records using current search conditions
|
7
|
-
# * :page: de-/mark all records on current page
|
8
|
-
cattr_accessor :mark_all_mode
|
9
|
-
@@mark_all_mode = :search
|
10
|
-
|
11
|
-
attr_accessor :mark_all_mode
|
12
|
-
|
13
|
-
def initialize(core_config)
|
14
|
-
@core = core_config
|
15
|
-
@mark_all_mode = self.class.mark_all_mode
|
16
|
-
@core.model.send(:include, ActiveScaffold::MarkedModel) unless @core.model < ActiveScaffold::MarkedModel
|
17
|
-
add_mark_column
|
18
|
-
end
|
19
|
-
|
20
|
-
protected
|
21
|
-
|
22
|
-
def add_mark_column
|
23
|
-
@core.columns.add :as_marked
|
24
|
-
@core.columns[:as_marked].label = 'M'
|
25
|
-
@core.columns[:as_marked].list_ui = :marked
|
26
|
-
@core.columns[:as_marked].sort = false
|
27
|
-
@core.list.columns = [:as_marked] + @core.list.columns.names_without_auth_check unless @core.list.columns.include? :as_marked
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module ActiveScaffold::Config
|
2
|
-
class Nested < Base
|
3
|
-
self.crud_type = :read
|
4
|
-
|
5
|
-
def initialize(core_config)
|
6
|
-
super
|
7
|
-
@label = :add_existing_model
|
8
|
-
@shallow_delete = self.class.shallow_delete
|
9
|
-
end
|
10
|
-
|
11
|
-
# global level configuration
|
12
|
-
# --------------------------
|
13
|
-
cattr_accessor :shallow_delete
|
14
|
-
@@shallow_delete = true
|
15
|
-
|
16
|
-
# instance-level configuration
|
17
|
-
# ----------------------------
|
18
|
-
attr_accessor :shallow_delete
|
19
|
-
|
20
|
-
# Add a nested ActionLink
|
21
|
-
def add_link(attribute, options = {})
|
22
|
-
column = @core.columns[attribute.to_sym]
|
23
|
-
unless column.nil? || column.association.nil?
|
24
|
-
options.reverse_merge! :security_method => :nested_authorized?, :label => column.association.klass.model_name.human({:count => column.singular_association? ? 1 : 2, :default => column.association.klass.name.pluralize})
|
25
|
-
action_group = options.delete(:action_group) || self.action_group
|
26
|
-
action_link = @core.link_for_association(column, options)
|
27
|
-
action_link.action ||= :index
|
28
|
-
@core.action_links.add_to_group(action_link, action_group) unless action_link.nil?
|
29
|
-
else
|
30
|
-
# TODO: raise exception
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def add_scoped_link(named_scope, options = {})
|
35
|
-
action_link = @core.link_for_association_as_scope(named_scope.to_sym, options)
|
36
|
-
@core.action_links.add_to_group(action_link, action_group) unless action_link.nil?
|
37
|
-
end
|
38
|
-
|
39
|
-
# the label for this Nested action. used for the header.
|
40
|
-
attr_writer :label
|
41
|
-
end
|
42
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
module ActiveScaffold::Config
|
2
|
-
class Search < Base
|
3
|
-
self.crud_type = :read
|
4
|
-
|
5
|
-
def initialize(core_config)
|
6
|
-
super
|
7
|
-
@text_search = self.class.text_search
|
8
|
-
@live = self.class.live?
|
9
|
-
@split_terms = self.class.split_terms
|
10
|
-
|
11
|
-
# start with the ActionLink defined globally
|
12
|
-
@link = self.class.link.clone
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
# global level configuration
|
17
|
-
# --------------------------
|
18
|
-
# the ActionLink for this action
|
19
|
-
cattr_accessor :link
|
20
|
-
@@link = ActiveScaffold::DataStructures::ActionLink.new('show_search', :label => :search, :type => :collection, :security_method => :search_authorized?, :ignore_method => :search_ignore?)
|
21
|
-
|
22
|
-
# A flag for how the search should do full-text searching in the database:
|
23
|
-
# * :full: LIKE %?%
|
24
|
-
# * :start: LIKE ?%
|
25
|
-
# * :end: LIKE %?
|
26
|
-
# * false: LIKE ?
|
27
|
-
# Default is :full
|
28
|
-
cattr_accessor :text_search
|
29
|
-
@@text_search = :full
|
30
|
-
|
31
|
-
# whether submits the search as you type
|
32
|
-
cattr_writer :live
|
33
|
-
def self.live?
|
34
|
-
@@live
|
35
|
-
end
|
36
|
-
|
37
|
-
cattr_accessor :split_terms
|
38
|
-
@@split_terms = " "
|
39
|
-
|
40
|
-
# instance-level configuration
|
41
|
-
# ----------------------------
|
42
|
-
|
43
|
-
# provides access to the list of columns specifically meant for the Search to use
|
44
|
-
def columns
|
45
|
-
# we want to delay initializing to the @core.columns set for as long as possible. Too soon and .search_sql will not be available to .searchable?
|
46
|
-
unless @columns
|
47
|
-
self.columns = @core.columns.collect{|c| c.name if @core.columns._inheritable.include?(c.name) and c.searchable? and c.column and c.column.text?}.compact
|
48
|
-
end
|
49
|
-
@columns
|
50
|
-
end
|
51
|
-
|
52
|
-
public :columns=
|
53
|
-
|
54
|
-
# A flag for how the search should do full-text searching in the database:
|
55
|
-
# * :full: LIKE %?%
|
56
|
-
# * :start: LIKE ?%
|
57
|
-
# * :end: LIKE %?
|
58
|
-
# * false: LIKE ?
|
59
|
-
# Default is :full
|
60
|
-
attr_accessor :text_search
|
61
|
-
|
62
|
-
attr_accessor :split_terms
|
63
|
-
|
64
|
-
# the ActionLink for this action
|
65
|
-
attr_accessor :link
|
66
|
-
|
67
|
-
# whether submits the search as you type
|
68
|
-
attr_writer :live
|
69
|
-
def live?
|
70
|
-
@live
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|