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,17 +0,0 @@
|
|
1
|
-
class ActiveScaffold::Bridges::TinyMce < ActiveScaffold::DataStructures::Bridge
|
2
|
-
def self.install
|
3
|
-
require File.join(File.dirname(__FILE__), "tiny_mce/helpers.rb")
|
4
|
-
end
|
5
|
-
|
6
|
-
def self.install?
|
7
|
-
Object.const_defined? "TinyMCE"
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.javascripts
|
11
|
-
if ActiveScaffold.js_framework == :jquery
|
12
|
-
['tinymce-jquery', 'jquery/tiny_mce_bridge']
|
13
|
-
else
|
14
|
-
['tinymce', 'prototype/tiny_mce_bridge']
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
class ActiveScaffold::Bridges::TinyMce
|
2
|
-
module Helpers
|
3
|
-
def self.included(base)
|
4
|
-
base.class_eval do
|
5
|
-
include FormColumnHelpers
|
6
|
-
include SearchColumnHelpers
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
module FormColumnHelpers
|
11
|
-
def self.included(base)
|
12
|
-
base.alias_method_chain :onsubmit, :tiny_mce
|
13
|
-
end
|
14
|
-
|
15
|
-
def active_scaffold_input_text_editor(column, options)
|
16
|
-
options[:class] = "#{options[:class]} mceEditor #{column.options[:class]}".strip
|
17
|
-
|
18
|
-
settings = { :theme => 'simple' }.merge(column.options[:tinymce] || {})
|
19
|
-
settings = settings.to_s.gsub(/:(.+?)\=\>/, '\1:')
|
20
|
-
settings = "tinyMCE.settings = #{settings};"
|
21
|
-
|
22
|
-
html = []
|
23
|
-
html << send(override_input(:textarea), column, options)
|
24
|
-
html << javascript_tag(settings + "tinyMCE.execCommand('mceAddControl', false, '#{options[:id]}');") if request.xhr? || params[:iframe]
|
25
|
-
html.join "\n"
|
26
|
-
end
|
27
|
-
|
28
|
-
def onsubmit_with_tiny_mce
|
29
|
-
if ActiveScaffold.js_framework == :jquery
|
30
|
-
submit_js = 'tinyMCE.triggerSave();$(\'textarea.mceEditor\').each(function(index, elem) { tinyMCE.execCommand(\'mceRemoveControl\', false, $(elem).attr(\'id\')); });'
|
31
|
-
else
|
32
|
-
submit_js = 'tinyMCE.triggerSave();this.select(\'textarea.mceEditor\').each(function(elem) { tinyMCE.execCommand(\'mceRemoveControl\', false, elem.id); });'
|
33
|
-
end
|
34
|
-
[onsubmit_without_tiny_mce, submit_js].compact.join ';'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
module SearchColumnHelpers
|
39
|
-
def self.included(base)
|
40
|
-
base.class_eval { alias_method :active_scaffold_search_text_editor, :active_scaffold_search_text }
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
ActionView::Base.class_eval { include ActiveScaffold::Bridges::TinyMce::Helpers }
|
@@ -1,75 +0,0 @@
|
|
1
|
-
module ActiveScaffold::Config
|
2
|
-
class Base
|
3
|
-
include ActiveScaffold::Configurable
|
4
|
-
extend ActiveScaffold::Configurable
|
5
|
-
|
6
|
-
def initialize(core_config)
|
7
|
-
@core = core_config
|
8
|
-
@action_group = self.class.action_group.clone if self.class.action_group
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.inherited(subclass)
|
12
|
-
class << subclass
|
13
|
-
# the crud type of the action. possible values are :create, :read, :update, :delete, and nil.
|
14
|
-
# this is not a setting for the developer. it's self-description for the actions.
|
15
|
-
def crud_type; @crud_type; end
|
16
|
-
|
17
|
-
protected
|
18
|
-
|
19
|
-
def crud_type=(val)
|
20
|
-
raise ArgumentError, "unknown CRUD type #{val}" unless [:create, :read, :update, :delete].include?(val.to_sym)
|
21
|
-
@crud_type = val.to_sym
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# delegate
|
27
|
-
def crud_type; self.class.crud_type end
|
28
|
-
|
29
|
-
def label(model = nil)
|
30
|
-
model ||= @core.label(:count => 1)
|
31
|
-
@label.nil? ? model : as_(@label, :model => model)
|
32
|
-
end
|
33
|
-
|
34
|
-
# the user property gets set to the instantiation of the local UserSettings class during the automatic instantiation of this class.
|
35
|
-
attr_accessor :user
|
36
|
-
|
37
|
-
# define a default action_group for this action
|
38
|
-
# e.g. 'members.crud'
|
39
|
-
class_attribute :action_group
|
40
|
-
|
41
|
-
# action_group this action should belong to
|
42
|
-
attr_accessor :action_group
|
43
|
-
|
44
|
-
class UserSettings
|
45
|
-
def initialize(conf, storage, params)
|
46
|
-
# the session hash relevant to this action
|
47
|
-
@session = storage
|
48
|
-
# all the request params
|
49
|
-
@params = params
|
50
|
-
# the configuration object for this action
|
51
|
-
@conf = conf
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def formats
|
56
|
-
@formats ||= []
|
57
|
-
end
|
58
|
-
|
59
|
-
def formats=(val)
|
60
|
-
@formats=val
|
61
|
-
end
|
62
|
-
|
63
|
-
private
|
64
|
-
|
65
|
-
def columns=(val)
|
66
|
-
@columns.set_values(*val) if @columns
|
67
|
-
@columns ||= ActiveScaffold::DataStructures::ActionColumns.new(*val).tap do |columns|
|
68
|
-
columns.action = self
|
69
|
-
columns.set_columns(@core.columns) if @columns.respond_to?(:set_columns)
|
70
|
-
columns
|
71
|
-
end
|
72
|
-
@columns
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,236 +0,0 @@
|
|
1
|
-
module ActiveScaffold::Config
|
2
|
-
# to fix the ckeditor bridge problem
|
3
|
-
class Core < ActiveScaffold::Config::Base
|
4
|
-
# code commented out (see above)
|
5
|
-
#class Core < Base
|
6
|
-
# global level configuration
|
7
|
-
# --------------------------
|
8
|
-
|
9
|
-
# provides read/write access to the global Actions DataStructure
|
10
|
-
cattr_reader :actions
|
11
|
-
def self.actions=(val)
|
12
|
-
@@actions = ActiveScaffold::DataStructures::Actions.new(*val)
|
13
|
-
end
|
14
|
-
self.actions = [:create, :list, :search, :update, :delete, :show, :nested, :subform]
|
15
|
-
|
16
|
-
# configures where the ActiveScaffold plugin itself is located. there is no instance version of this.
|
17
|
-
cattr_accessor :plugin_directory
|
18
|
-
@@plugin_directory = File.expand_path(__FILE__).match(%{(^.*)/lib/active_scaffold/config/core.rb})[1]
|
19
|
-
|
20
|
-
# lets you specify a global ActiveScaffold frontend.
|
21
|
-
cattr_accessor :frontend
|
22
|
-
@@frontend = :default
|
23
|
-
|
24
|
-
# lets you specify a global ActiveScaffold theme for your frontend.
|
25
|
-
cattr_accessor :theme
|
26
|
-
@@theme = :default
|
27
|
-
|
28
|
-
# lets you disable the DHTML history
|
29
|
-
def self.dhtml_history=(val)
|
30
|
-
@@dhtml_history = val
|
31
|
-
end
|
32
|
-
def self.dhtml_history?
|
33
|
-
@@dhtml_history ? true : false
|
34
|
-
end
|
35
|
-
@@dhtml_history = true
|
36
|
-
|
37
|
-
# action links are used by actions to tie together. you can use them, too! this is a collection of ActiveScaffold::DataStructures::ActionLink objects.
|
38
|
-
cattr_reader :action_links
|
39
|
-
@@action_links = ActiveScaffold::DataStructures::ActionLinks.new
|
40
|
-
|
41
|
-
# access to the permissions configuration.
|
42
|
-
# configuration options include:
|
43
|
-
# * current_user_method - what method on the controller returns the current user. default: :current_user
|
44
|
-
# * default_permission - what the default permission is. default: true
|
45
|
-
def self.security
|
46
|
-
ActiveRecordPermissions
|
47
|
-
end
|
48
|
-
|
49
|
-
# columns that should be ignored for every model. these should be metadata columns like change dates, versions, etc.
|
50
|
-
# values in this array may be symbols or strings.
|
51
|
-
def self.ignore_columns
|
52
|
-
@@ignore_columns
|
53
|
-
end
|
54
|
-
def self.ignore_columns=(val)
|
55
|
-
@@ignore_columns = ActiveScaffold::DataStructures::Set.new(*val)
|
56
|
-
end
|
57
|
-
@@ignore_columns = ActiveScaffold::DataStructures::Set.new
|
58
|
-
|
59
|
-
# lets you specify whether add a create link for each sti child
|
60
|
-
cattr_accessor :sti_create_links
|
61
|
-
@@sti_create_links = true
|
62
|
-
|
63
|
-
# prefix messages with current timestamp, set the format to display (you can use I18n keys) or true and :short will be used
|
64
|
-
cattr_accessor :timestamped_messages
|
65
|
-
@@timestamped_messages = false
|
66
|
-
|
67
|
-
# a hash of string (or array of strings) and highlighter string to highlight words in messages. It will use highlight rails helper
|
68
|
-
cattr_accessor :highlight_messages
|
69
|
-
@@highlight_messages = nil
|
70
|
-
|
71
|
-
# instance-level configuration
|
72
|
-
# ----------------------------
|
73
|
-
|
74
|
-
# provides read/write access to the local Actions DataStructure
|
75
|
-
attr_reader :actions
|
76
|
-
def actions=(args)
|
77
|
-
@actions = ActiveScaffold::DataStructures::Actions.new(*args)
|
78
|
-
end
|
79
|
-
|
80
|
-
# provides read/write access to the local Columns DataStructure
|
81
|
-
attr_reader :columns
|
82
|
-
def columns=(val)
|
83
|
-
@columns._inheritable = val.collect {|c| c.to_sym}
|
84
|
-
# Add virtual columns
|
85
|
-
@columns << val.collect {|c| c.to_sym unless @columns[c.to_sym]}.compact
|
86
|
-
end
|
87
|
-
|
88
|
-
# lets you override the global ActiveScaffold frontend for a specific controller
|
89
|
-
attr_accessor :frontend
|
90
|
-
|
91
|
-
# lets you override the global ActiveScaffold theme for a specific controller
|
92
|
-
attr_accessor :theme
|
93
|
-
|
94
|
-
# lets you specify whether add a create link for each sti child for a specific controller
|
95
|
-
attr_accessor :sti_create_links
|
96
|
-
def add_sti_create_links?
|
97
|
-
self.sti_create_links and not self.sti_children.nil?
|
98
|
-
end
|
99
|
-
|
100
|
-
# action links are used by actions to tie together. they appear as links for each record, or general links for the ActiveScaffold.
|
101
|
-
attr_reader :action_links
|
102
|
-
|
103
|
-
# a generally-applicable name for this ActiveScaffold ... will be used for generating page/section headers
|
104
|
-
attr_writer :label
|
105
|
-
def label(options={})
|
106
|
-
as_(@label, options) || model.model_name.human(options.merge(options[:count].to_i == 1 ? {} : {:default => model.name.pluralize}))
|
107
|
-
end
|
108
|
-
|
109
|
-
# STI children models, use an array of model names
|
110
|
-
attr_accessor :sti_children
|
111
|
-
|
112
|
-
# prefix messages with current timestamp, set the format to display (you can use I18n keys) or true and :short will be used
|
113
|
-
attr_accessor :timestamped_messages
|
114
|
-
|
115
|
-
# a hash of string (or array of strings) and highlighter string to highlight words in messages. It will use highlight rails helper
|
116
|
-
attr_accessor :highlight_messages
|
117
|
-
|
118
|
-
##
|
119
|
-
## internal usage only below this point
|
120
|
-
## ------------------------------------
|
121
|
-
|
122
|
-
def initialize(model_id)
|
123
|
-
# model_id is the only absolutely required configuration value. it is also not publicly accessible.
|
124
|
-
@model_id = model_id
|
125
|
-
|
126
|
-
# inherit the actions list directly from the global level
|
127
|
-
@actions = self.class.actions.clone
|
128
|
-
|
129
|
-
# create a new default columns datastructure, since it doesn't make sense before now
|
130
|
-
attribute_names = self.model.columns.collect{ |c| c.name.to_sym }.sort_by { |c| c.to_s }
|
131
|
-
association_column_names = self.model.reflect_on_all_associations.collect{ |a| a.name.to_sym }.sort_by { |c| c.to_s }
|
132
|
-
@columns = ActiveScaffold::DataStructures::Columns.new(self.model, attribute_names + association_column_names)
|
133
|
-
|
134
|
-
# and then, let's remove some columns from the inheritable set.
|
135
|
-
@columns.exclude(*self.class.ignore_columns)
|
136
|
-
@columns.exclude(*@columns.find_all { |c| c.column and (c.column.primary or c.column.name =~ /(_id|_count)$/) }.collect {|c| c.name})
|
137
|
-
@columns.exclude(*self.model.reflect_on_all_associations.collect{|a| :"#{a.name}_type" if a.options[:polymorphic]}.compact)
|
138
|
-
|
139
|
-
# inherit the global frontend
|
140
|
-
@frontend = self.class.frontend
|
141
|
-
@theme = self.class.theme
|
142
|
-
@sti_create_links = self.class.sti_create_links
|
143
|
-
|
144
|
-
# inherit from the global set of action links
|
145
|
-
@action_links = self.class.action_links.clone
|
146
|
-
@timestamped_messages = self.class.timestamped_messages
|
147
|
-
@highlight_messages = self.class.highlight_messages
|
148
|
-
end
|
149
|
-
|
150
|
-
# To be called after your finished configuration
|
151
|
-
def _load_action_columns
|
152
|
-
#ActiveScaffold::DataStructures::ActionColumns.class_eval {include ActiveScaffold::DataStructures::ActionColumns::AfterConfiguration}
|
153
|
-
|
154
|
-
# then, register the column objects
|
155
|
-
self.actions.each do |action_name|
|
156
|
-
action = self.send(action_name)
|
157
|
-
next unless action.respond_to? :columns
|
158
|
-
action.columns.set_columns(self.columns)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
# To be called after your finished configuration
|
163
|
-
def _configure_sti
|
164
|
-
column = self.model.inheritance_column
|
165
|
-
if sti_create_links
|
166
|
-
self.columns[column].form_ui ||= :hidden
|
167
|
-
else
|
168
|
-
self.columns[column].form_ui ||= :select
|
169
|
-
self.columns[column].options ||= {}
|
170
|
-
self.columns[column].options[:options] = self.sti_children.collect do |model_name|
|
171
|
-
[model_name.to_s.camelize.constantize.model_name.human, model_name.to_s.camelize]
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
# configuration routing.
|
177
|
-
# we want to route calls named like an activated action to that action's global or local Config class.
|
178
|
-
# ---------------------------
|
179
|
-
def method_missing(name, *args)
|
180
|
-
@action_configs ||= {}
|
181
|
-
titled_name = name.to_s.camelcase
|
182
|
-
underscored_name = name.to_s.underscore.to_sym
|
183
|
-
klass = "ActiveScaffold::Config::#{titled_name}".constantize rescue nil
|
184
|
-
if klass
|
185
|
-
if @actions.include? underscored_name
|
186
|
-
return @action_configs[underscored_name] ||= klass.new(self)
|
187
|
-
else
|
188
|
-
raise "#{titled_name} is not enabled. Please enable it or remove any references in your configuration (e.g. config.#{underscored_name}.columns = [...])."
|
189
|
-
end
|
190
|
-
end
|
191
|
-
super
|
192
|
-
end
|
193
|
-
|
194
|
-
def self.method_missing(name, *args)
|
195
|
-
klass = "ActiveScaffold::Config::#{name.to_s.camelcase}".constantize rescue nil
|
196
|
-
if @@actions.include? name.to_s.underscore and klass
|
197
|
-
return eval("ActiveScaffold::Config::#{name.to_s.camelcase}")
|
198
|
-
end
|
199
|
-
super
|
200
|
-
end
|
201
|
-
# some utility methods
|
202
|
-
# --------------------
|
203
|
-
|
204
|
-
def model_id
|
205
|
-
@model_id
|
206
|
-
end
|
207
|
-
|
208
|
-
def model
|
209
|
-
@model ||= @model_id.to_s.camelize.constantize
|
210
|
-
end
|
211
|
-
|
212
|
-
# warning - this won't work as a per-request dynamic attribute in rails 2.0. You'll need to interact with Controller#generic_view_paths
|
213
|
-
def inherited_view_paths
|
214
|
-
@inherited_view_paths||=[]
|
215
|
-
end
|
216
|
-
|
217
|
-
# must be a class method so the layout doesn't depend on a controller that uses active_scaffold
|
218
|
-
# note that this is unaffected by per-controller frontend configuration.
|
219
|
-
def self.asset_path(filename, frontend = self.frontend)
|
220
|
-
"active_scaffold/#{frontend}/#{filename}"
|
221
|
-
end
|
222
|
-
|
223
|
-
# must be a class method so the layout doesn't depend on a controller that uses active_scaffold
|
224
|
-
# note that this is unaffected by per-controller frontend configuration.
|
225
|
-
def self.javascripts(frontend = self.frontend)
|
226
|
-
javascript_dir = File.join(Rails.public_path, "javascripts", asset_path('', frontend))
|
227
|
-
Dir.entries(javascript_dir).reject { |e| !e.match(/\.js$/) or (!self.dhtml_history? and e.match('dhtml_history')) }
|
228
|
-
end
|
229
|
-
|
230
|
-
def self.available_frontends
|
231
|
-
frontends_dir = File.join(Rails.root, "vendor", "plugins", ActiveScaffold::Config::Core.plugin_directory, "frontends")
|
232
|
-
Dir.entries(frontends_dir).reject { |e| e.match(/^\./) } # Get rid of files that start with .
|
233
|
-
end
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module ActiveScaffold::Config
|
2
|
-
class Create < ActiveScaffold::Config::Form
|
3
|
-
self.crud_type = :create
|
4
|
-
def initialize(core_config)
|
5
|
-
super
|
6
|
-
@label = :create_model
|
7
|
-
self.action_after_create = self.class.action_after_create
|
8
|
-
end
|
9
|
-
|
10
|
-
# global level configuration
|
11
|
-
# --------------------------
|
12
|
-
# the ActionLink for this action
|
13
|
-
def self.link
|
14
|
-
@@link
|
15
|
-
end
|
16
|
-
def self.link=(val)
|
17
|
-
@@link = val
|
18
|
-
end
|
19
|
-
@@link = ActiveScaffold::DataStructures::ActionLink.new('new', :label => :create_new, :type => :collection, :security_method => :create_authorized?, :ignore_method => :create_ignore?)
|
20
|
-
|
21
|
-
# whether update form is opened after a create or not
|
22
|
-
cattr_accessor :action_after_create
|
23
|
-
@@action_after_create = nil
|
24
|
-
|
25
|
-
# instance-level configuration
|
26
|
-
# ----------------------------
|
27
|
-
|
28
|
-
# whether the form stays open after a create or not
|
29
|
-
attr_accessor :action_after_create
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module ActiveScaffold::Config
|
2
|
-
class Delete < Base
|
3
|
-
self.crud_type = :delete
|
4
|
-
|
5
|
-
def initialize(core_config)
|
6
|
-
super
|
7
|
-
# start with the ActionLink defined globally
|
8
|
-
@link = self.class.link.clone
|
9
|
-
@refresh_list = self.class.refresh_list
|
10
|
-
end
|
11
|
-
|
12
|
-
# global level configuration
|
13
|
-
# --------------------------
|
14
|
-
|
15
|
-
# the ActionLink for this action
|
16
|
-
cattr_accessor :link
|
17
|
-
@@link = ActiveScaffold::DataStructures::ActionLink.new('destroy', :label => :delete, :type => :member, :confirm => :are_you_sure_to_delete, :method => :delete, :crud_type => :delete, :position => false, :parameters => {:destroy_action => true}, :security_method => :delete_authorized?, :ignore_method => :delete_ignore?)
|
18
|
-
|
19
|
-
# whether we should refresh list after destroy or not
|
20
|
-
cattr_accessor :refresh_list
|
21
|
-
@@refresh_list = false
|
22
|
-
|
23
|
-
# instance-level configuration
|
24
|
-
# ----------------------------
|
25
|
-
|
26
|
-
# the ActionLink for this action
|
27
|
-
attr_accessor :link
|
28
|
-
|
29
|
-
# whether we should refresh list after destroy or not
|
30
|
-
attr_accessor :refresh_list
|
31
|
-
end
|
32
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
module ActiveScaffold::Config
|
2
|
-
class FieldSearch < Base
|
3
|
-
self.crud_type = :read
|
4
|
-
|
5
|
-
def initialize(core_config)
|
6
|
-
super
|
7
|
-
@text_search = self.class.text_search
|
8
|
-
@human_conditions = self.class.human_conditions
|
9
|
-
|
10
|
-
# start with the ActionLink defined globally
|
11
|
-
@link = self.class.link.clone
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
|
-
# global level configuration
|
16
|
-
# --------------------------
|
17
|
-
# the ActionLink for this action
|
18
|
-
cattr_reader :link
|
19
|
-
@@link = ActiveScaffold::DataStructures::ActionLink.new('show_search', :label => :search, :type => :collection, :security_method => :search_authorized?, :ignore_method => :search_ignore?)
|
20
|
-
|
21
|
-
# A flag for how the search should do full-text searching in the database:
|
22
|
-
# * :full: LIKE %?%
|
23
|
-
# * :start: LIKE ?%
|
24
|
-
# * :end: LIKE %?
|
25
|
-
# * false: LIKE ?
|
26
|
-
# Default is :full
|
27
|
-
cattr_accessor :text_search
|
28
|
-
@@text_search = :full
|
29
|
-
|
30
|
-
# human conditions
|
31
|
-
# instead of just filtered you may show the user a humanized search condition statment
|
32
|
-
cattr_accessor :human_conditions
|
33
|
-
@@human_conditions = false
|
34
|
-
|
35
|
-
# instance-level configuration
|
36
|
-
# ----------------------------
|
37
|
-
|
38
|
-
# provides access to the list of columns specifically meant for the Search to use
|
39
|
-
def columns
|
40
|
-
# 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?
|
41
|
-
unless @columns
|
42
|
-
self.columns = @core.columns._inheritable
|
43
|
-
self.columns.exclude @core.columns.active_record_class.locking_column.to_sym
|
44
|
-
end
|
45
|
-
@columns
|
46
|
-
end
|
47
|
-
|
48
|
-
public :columns=
|
49
|
-
|
50
|
-
# A flag for how the search should do full-text searching in the database:
|
51
|
-
# * :full: LIKE %?%
|
52
|
-
# * :start: LIKE ?%
|
53
|
-
# * :end: LIKE %?
|
54
|
-
# * false: LIKE ?
|
55
|
-
# Default is :full
|
56
|
-
attr_accessor :text_search
|
57
|
-
|
58
|
-
# the ActionLink for this action
|
59
|
-
attr_accessor :link
|
60
|
-
|
61
|
-
# rarely searched columns may be placed in a hidden subgroup
|
62
|
-
def optional_columns=(optionals)
|
63
|
-
@optional_columns = Array(optionals)
|
64
|
-
end
|
65
|
-
|
66
|
-
def optional_columns
|
67
|
-
@optional_columns ||= []
|
68
|
-
end
|
69
|
-
|
70
|
-
# default search params
|
71
|
-
# default_params = {:title => {"from"=>"test", "to"=>"", "opt"=>"%?%"}}
|
72
|
-
attr_accessor :default_params
|
73
|
-
|
74
|
-
# human conditions
|
75
|
-
# instead of just filtered you may show the user a humanized search condition statment
|
76
|
-
attr_accessor :human_conditions
|
77
|
-
|
78
|
-
end
|
79
|
-
end
|