active_scaffold 4.1.6 → 4.2.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +27 -0
- data/README.md +6 -5
- data/app/assets/javascripts/jquery/active_scaffold.js +98 -47
- data/app/assets/javascripts/jquery/tiny_mce_bridge.js +15 -2
- data/app/assets/stylesheets/active_scaffold_images.scss +6 -0
- data/app/assets/stylesheets/{active_scaffold_layout.css → active_scaffold_layout.scss} +104 -4
- data/app/assets/stylesheets/tiny_mce_bridge.scss +11 -0
- data/app/views/active_scaffold_overrides/_base_form.html.erb +3 -2
- data/app/views/active_scaffold_overrides/_field_search.html.erb +2 -2
- data/app/views/active_scaffold_overrides/_form.html.erb +14 -4
- data/app/views/active_scaffold_overrides/_form_association.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_form_association_record.html.erb +5 -11
- data/app/views/active_scaffold_overrides/_horizontal_subform.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_horizontal_subform_header.html.erb +1 -3
- data/app/views/active_scaffold_overrides/_new_record.js.erb +3 -1
- data/app/views/active_scaffold_overrides/_refresh_list.js.erb +1 -1
- data/app/views/active_scaffold_overrides/_render_field.js.erb +67 -36
- data/app/views/active_scaffold_overrides/_update_field_on_create.js.erb +41 -6
- data/app/views/active_scaffold_overrides/action_links_menu.js.erb +1 -0
- data/config/locales/de.yml +9 -0
- data/config/locales/en.yml +11 -0
- data/config/locales/es.yml +8 -0
- data/config/locales/fr.yml +8 -0
- data/config/locales/hu.yml +8 -0
- data/config/locales/ja.yml +8 -0
- data/config/locales/ru.yml +8 -0
- data/lib/active_scaffold/actions/common_search.rb +2 -0
- data/lib/active_scaffold/actions/core.rb +47 -23
- data/lib/active_scaffold/actions/create.rb +2 -0
- data/lib/active_scaffold/actions/delete.rb +6 -0
- data/lib/active_scaffold/actions/field_search.rb +36 -11
- data/lib/active_scaffold/actions/list.rb +26 -8
- data/lib/active_scaffold/actions/mark.rb +6 -0
- data/lib/active_scaffold/actions/nested.rb +2 -0
- data/lib/active_scaffold/actions/search.rb +7 -0
- data/lib/active_scaffold/actions/show.rb +6 -0
- data/lib/active_scaffold/actions/subform.rb +2 -0
- data/lib/active_scaffold/actions/update.rb +8 -1
- data/lib/active_scaffold/active_record_permissions.rb +3 -3
- data/lib/active_scaffold/attribute_params.rb +35 -17
- data/lib/active_scaffold/bridges/active_storage/active_storage_bridge.rb +2 -0
- data/lib/active_scaffold/bridges/active_storage/active_storage_helpers.rb +10 -9
- data/lib/active_scaffold/bridges/active_storage/form_ui.rb +10 -3
- data/lib/active_scaffold/bridges/active_storage/list_ui.rb +2 -0
- data/lib/active_scaffold/bridges/active_storage.rb +2 -0
- data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +2 -0
- data/lib/active_scaffold/bridges/ancestry.rb +2 -0
- data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +2 -0
- data/lib/active_scaffold/bridges/bitfields/list_ui.rb +2 -0
- data/lib/active_scaffold/bridges/bitfields.rb +2 -0
- data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +9 -6
- data/lib/active_scaffold/bridges/cancan.rb +2 -0
- data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +2 -0
- data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge_helpers.rb +2 -0
- data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +3 -1
- data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +2 -0
- data/lib/active_scaffold/bridges/carrierwave.rb +2 -0
- data/lib/active_scaffold/bridges/chosen/helpers.rb +13 -4
- data/lib/active_scaffold/bridges/chosen.rb +2 -0
- data/lib/active_scaffold/bridges/country_select/country_select_bridge_helper.rb +2 -0
- data/lib/active_scaffold/bridges/country_select.rb +2 -0
- data/lib/active_scaffold/bridges/date_picker/ext.rb +6 -0
- data/lib/active_scaffold/bridges/date_picker/helper.rb +7 -3
- data/lib/active_scaffold/bridges/date_picker.rb +2 -0
- data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +2 -0
- data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge_helpers.rb +2 -0
- data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +3 -1
- data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +2 -0
- data/lib/active_scaffold/bridges/dragonfly.rb +2 -0
- data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +2 -0
- data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +10 -9
- data/lib/active_scaffold/bridges/file_column/form_ui.rb +2 -0
- data/lib/active_scaffold/bridges/file_column/list_ui.rb +2 -0
- data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +2 -0
- data/lib/active_scaffold/bridges/file_column/test/mock_model.rb +2 -0
- data/lib/active_scaffold/bridges/file_column.rb +2 -0
- data/lib/active_scaffold/bridges/logical_query_parser/tokens_grammar.rb +65 -0
- data/lib/active_scaffold/bridges/logical_query_parser/tokens_grammar.treetop +31 -0
- data/lib/active_scaffold/bridges/logical_query_parser.rb +9 -0
- data/lib/active_scaffold/bridges/paper_trail/actions.rb +2 -0
- data/lib/active_scaffold/bridges/paper_trail/config.rb +2 -0
- data/lib/active_scaffold/bridges/paper_trail/helper.rb +2 -0
- data/lib/active_scaffold/bridges/paper_trail/paper_trail_bridge.rb +2 -0
- data/lib/active_scaffold/bridges/paper_trail.rb +2 -0
- data/lib/active_scaffold/bridges/paperclip/form_ui.rb +3 -1
- data/lib/active_scaffold/bridges/paperclip/list_ui.rb +2 -0
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +2 -0
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +12 -12
- data/lib/active_scaffold/bridges/paperclip.rb +2 -0
- data/lib/active_scaffold/bridges/record_select/helpers.rb +19 -11
- data/lib/active_scaffold/bridges/record_select.rb +2 -0
- data/lib/active_scaffold/bridges/semantic_attributes/column.rb +2 -0
- data/lib/active_scaffold/bridges/semantic_attributes.rb +2 -0
- data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +3 -1
- data/lib/active_scaffold/bridges/tiny_mce.rb +6 -0
- data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +2 -0
- data/lib/active_scaffold/bridges/usa_state_select.rb +2 -0
- data/lib/active_scaffold/bridges.rb +2 -0
- data/lib/active_scaffold/config/base.rb +12 -7
- data/lib/active_scaffold/config/core.rb +26 -23
- data/lib/active_scaffold/config/create.rb +2 -0
- data/lib/active_scaffold/config/delete.rb +2 -0
- data/lib/active_scaffold/config/field_search.rb +2 -0
- data/lib/active_scaffold/config/form.rb +11 -1
- data/lib/active_scaffold/config/list.rb +7 -7
- data/lib/active_scaffold/config/mark.rb +2 -0
- data/lib/active_scaffold/config/nested.rb +28 -0
- data/lib/active_scaffold/config/search.rb +2 -0
- data/lib/active_scaffold/config/show.rb +2 -0
- data/lib/active_scaffold/config/subform.rb +2 -0
- data/lib/active_scaffold/config/update.rb +3 -1
- data/lib/active_scaffold/configurable.rb +4 -2
- data/lib/active_scaffold/constraints.rb +2 -0
- data/lib/active_scaffold/core.rb +14 -4
- data/lib/active_scaffold/data_structures/action_columns.rb +3 -1
- data/lib/active_scaffold/data_structures/action_link.rb +10 -0
- data/lib/active_scaffold/data_structures/action_link_separator.rb +2 -0
- data/lib/active_scaffold/data_structures/action_links.rb +32 -21
- data/lib/active_scaffold/data_structures/actions.rb +4 -2
- data/lib/active_scaffold/data_structures/association/abstract.rb +4 -2
- data/lib/active_scaffold/data_structures/association/active_mongoid.rb +4 -2
- data/lib/active_scaffold/data_structures/association/active_record.rb +3 -9
- data/lib/active_scaffold/data_structures/association/mongoid.rb +4 -2
- data/lib/active_scaffold/data_structures/association.rb +2 -0
- data/lib/active_scaffold/data_structures/bridge.rb +3 -1
- data/lib/active_scaffold/data_structures/column.rb +37 -3
- data/lib/active_scaffold/data_structures/columns.rb +4 -2
- data/lib/active_scaffold/data_structures/filter.rb +3 -3
- data/lib/active_scaffold/data_structures/filter_option.rb +2 -0
- data/lib/active_scaffold/data_structures/filters.rb +3 -3
- data/lib/active_scaffold/data_structures/nested_info.rb +4 -2
- data/lib/active_scaffold/data_structures/set.rb +8 -10
- data/lib/active_scaffold/data_structures/sorting.rb +5 -7
- data/lib/active_scaffold/engine.rb +3 -4
- data/lib/active_scaffold/extensions/action_controller_rendering.rb +2 -0
- data/lib/active_scaffold/extensions/action_controller_rescueing.rb +2 -0
- data/lib/active_scaffold/extensions/action_view_rendering.rb +2 -0
- data/lib/active_scaffold/extensions/connection_adapter.rb +2 -0
- data/lib/active_scaffold/extensions/ice_nine.rb +2 -0
- data/lib/active_scaffold/extensions/localize.rb +2 -0
- data/lib/active_scaffold/extensions/name_option_for_datetime.rb +2 -0
- data/lib/active_scaffold/extensions/paginator_extensions.rb +3 -1
- data/lib/active_scaffold/extensions/routing_mapper.rb +2 -0
- data/lib/active_scaffold/extensions/to_label.rb +2 -0
- data/lib/active_scaffold/extensions/unsaved_associated.rb +10 -8
- data/lib/active_scaffold/extensions/unsaved_record.rb +2 -0
- data/lib/active_scaffold/finder.rb +57 -18
- data/lib/active_scaffold/helpers/action_link_helpers.rb +112 -37
- data/lib/active_scaffold/helpers/association_helpers.rb +4 -2
- data/lib/active_scaffold/helpers/controller_helpers.rb +2 -0
- data/lib/active_scaffold/helpers/filter_helpers.rb +11 -3
- data/lib/active_scaffold/helpers/form_column_helpers.rb +98 -71
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +2 -0
- data/lib/active_scaffold/helpers/id_helpers.rb +2 -0
- data/lib/active_scaffold/helpers/list_column_helpers.rb +9 -5
- data/lib/active_scaffold/helpers/pagination_helpers.rb +3 -1
- data/lib/active_scaffold/helpers/search_column_helpers.rb +19 -9
- data/lib/active_scaffold/helpers/show_column_helpers.rb +4 -2
- data/lib/active_scaffold/helpers/tabs_helpers.rb +5 -3
- data/lib/active_scaffold/helpers/view_helpers.rb +3 -3
- data/lib/active_scaffold/marked_model.rb +6 -5
- data/lib/active_scaffold/orm_checks.rb +2 -0
- data/lib/active_scaffold/paginator.rb +4 -1
- data/lib/active_scaffold/registry.rb +2 -0
- data/lib/active_scaffold/responds_to_parent.rb +2 -0
- data/lib/active_scaffold/tableless.rb +23 -13
- data/lib/active_scaffold/version.rb +4 -2
- data/lib/active_scaffold.rb +10 -2
- data/lib/generators/active_scaffold/controller/USAGE +19 -0
- data/lib/generators/active_scaffold/controller/controller_generator.rb +29 -0
- data/lib/generators/active_scaffold/install/USAGE +2 -0
- data/lib/generators/active_scaffold/{install_generator.rb → install/install_generator.rb} +10 -6
- data/lib/generators/active_scaffold/resource/USAGE +29 -0
- data/lib/generators/active_scaffold/resource/resource_generator.rb +30 -0
- data/lib/tasks/brakeman.rake +2 -0
- data/shoulda_macros/macros.rb +2 -0
- metadata +19 -11
- data/lib/generators/active_scaffold/controller_generator.rb +0 -49
- data/lib/generators/active_scaffold/resource_generator.rb +0 -56
- /data/lib/generators/{templates → active_scaffold/controller/templates}/controller.rb +0 -0
- /data/lib/generators/{templates → active_scaffold/controller/templates}/helper.rb +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
class ActiveScaffold::Bridges::DatePicker
|
|
2
4
|
module DatePickerBridge
|
|
3
5
|
def initialize(model_id)
|
|
@@ -72,18 +74,22 @@ ActionView::Base.class_eval do
|
|
|
72
74
|
alias_method :active_scaffold_human_condition_date_picker, :active_scaffold_human_condition_datetime
|
|
73
75
|
alias_method :active_scaffold_human_condition_datetime_picker, :active_scaffold_human_condition_datetime
|
|
74
76
|
include ActiveScaffold::Bridges::DatePicker::Helper::SearchColumnHelpers
|
|
77
|
+
|
|
75
78
|
alias_method :active_scaffold_search_datetime_picker_field, :active_scaffold_search_date_picker_field
|
|
76
79
|
include ActiveScaffold::Bridges::DatePicker::Helper::FormColumnHelpers
|
|
80
|
+
|
|
77
81
|
alias_method :active_scaffold_input_datetime_picker, :active_scaffold_input_date_picker
|
|
78
82
|
include ActiveScaffold::Bridges::DatePicker::Helper::DatepickerColumnHelpers
|
|
79
83
|
end
|
|
80
84
|
ActiveScaffold::Finder::ClassMethods.module_eval do
|
|
81
85
|
prepend ActiveScaffold::Bridges::DatePicker::Finder
|
|
86
|
+
|
|
82
87
|
alias_method :condition_for_date_picker_type, :condition_for_datetime
|
|
83
88
|
alias_method :condition_for_datetime_picker_type, :condition_for_datetime
|
|
84
89
|
end
|
|
85
90
|
ActiveScaffold::AttributeParams.module_eval do
|
|
86
91
|
prepend ActiveScaffold::Bridges::DatePicker::AttributeParams
|
|
92
|
+
|
|
87
93
|
alias_method :column_value_for_date_picker_type, :column_value_for_datetime_type
|
|
88
94
|
alias_method :column_value_for_datetime_picker_type, :column_value_for_datetime_type
|
|
89
95
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module ActiveScaffold::Bridges
|
|
2
4
|
class DatePicker
|
|
3
5
|
module Helper
|
|
@@ -69,7 +71,9 @@ module ActiveScaffold::Bridges
|
|
|
69
71
|
ampm: false,
|
|
70
72
|
hourText: I18n.translate!('datetime.prompts.hour', locale: locale),
|
|
71
73
|
minuteText: I18n.translate!('datetime.prompts.minute', locale: locale),
|
|
72
|
-
secondText: I18n.translate!('datetime.prompts.second', locale: locale)
|
|
74
|
+
secondText: I18n.translate!('datetime.prompts.second', locale: locale),
|
|
75
|
+
millisecText: I18n.translate!('datetime.prompts.millisec', locale: locale),
|
|
76
|
+
microsecText: I18n.translate!('datetime.prompts.microsec', locale: locale)
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
as_datetime_picker_options = I18n.translate! :datetime_picker_options, scope: :active_scaffold, locale: locale, default: ''
|
|
@@ -94,7 +98,7 @@ module ActiveScaffold::Bridges
|
|
|
94
98
|
)
|
|
95
99
|
end
|
|
96
100
|
js_format = rails_format.dup
|
|
97
|
-
js_format.gsub!(/(
|
|
101
|
+
js_format.gsub!(/( |^)([^% ]\S*)/, " '\\2'")
|
|
98
102
|
DATE_FORMAT_CONVERSION.each do |key, value|
|
|
99
103
|
js_format.gsub!(key, value)
|
|
100
104
|
end
|
|
@@ -128,7 +132,7 @@ module ActiveScaffold::Bridges
|
|
|
128
132
|
end
|
|
129
133
|
|
|
130
134
|
module DatepickerColumnHelpers
|
|
131
|
-
def to_datepicker_format(rails_format)
|
|
135
|
+
def to_datepicker_format(rails_format) # rubocop:disable Rails/Delegate
|
|
132
136
|
ActiveScaffold::Bridges::DatePicker::Helper.to_datepicker_format(rails_format)
|
|
133
137
|
end
|
|
134
138
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module ActiveScaffold
|
|
2
4
|
module Helpers
|
|
3
5
|
module FormColumnHelpers
|
|
@@ -5,7 +7,7 @@ module ActiveScaffold
|
|
|
5
7
|
record = options[:object]
|
|
6
8
|
dragonfly = record.send(column.name.to_s)
|
|
7
9
|
content = active_scaffold_column_dragonfly(record, column, ui_options: ui_options) if dragonfly.present?
|
|
8
|
-
|
|
10
|
+
active_scaffold_file_with_content(column, options, content, 'remove_', 'dragonfly_controls', ui_options: ui_options)
|
|
9
11
|
end
|
|
10
12
|
end
|
|
11
13
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module ActiveScaffold
|
|
2
4
|
module Bridges
|
|
3
5
|
class FileColumn
|
|
@@ -9,17 +11,16 @@ module ActiveScaffold
|
|
|
9
11
|
|
|
10
12
|
def generate_delete_helpers(klass)
|
|
11
13
|
file_column_fields(klass).each do |field|
|
|
12
|
-
|
|
13
|
-
attr_reader :delete_#{field}
|
|
14
|
+
next if klass.method_defined?(:"#{field}_with_delete=")
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
klass.attr_reader :"delete_#{field}"
|
|
17
|
+
klass.define_method "delete_#{field}=" do |value|
|
|
18
|
+
value = (value == 'true') if value.is_a?(String)
|
|
19
|
+
return unless value
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
CODE
|
|
21
|
+
# passing nil to the file column causes the file to be deleted. Don't delete if we just uploaded a file!
|
|
22
|
+
send("#{field}=", nil) unless send("#{field}_just_uploaded?")
|
|
23
|
+
end
|
|
23
24
|
end
|
|
24
25
|
end
|
|
25
26
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Treetop.load File.expand_path('tokens_grammar.treetop', __dir__)
|
|
4
|
+
|
|
5
|
+
class ActiveScaffold::Bridges::LogicalQueryParser
|
|
6
|
+
module TokensGrammar
|
|
7
|
+
class Parser
|
|
8
|
+
def initialize(operator = 'AND')
|
|
9
|
+
@operator = operator
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def parse(*, **)
|
|
13
|
+
super.tap do |node|
|
|
14
|
+
node.instance_variable_set(:@literal_operator, @operator)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
module ExpNode
|
|
20
|
+
def to_sql(params = {})
|
|
21
|
+
params[:_sql] ||= +''
|
|
22
|
+
params[:literal_operator] ||= @literal_operator || 'AND'
|
|
23
|
+
exp.to_sql(params)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
module LiteralExpNode
|
|
28
|
+
def to_sql(params)
|
|
29
|
+
word.to_sql(params)
|
|
30
|
+
params[:_sql] << " #{params[:literal_operator]} "
|
|
31
|
+
exp.to_sql(params)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
module WordNode
|
|
36
|
+
def to_sql(params)
|
|
37
|
+
text = LogicalQueryParser.unquote(word.text_value)
|
|
38
|
+
|
|
39
|
+
sql = build_arel(params, :matches, text).reduce(:or).to_sql
|
|
40
|
+
sql = "(#{sql})" if sql[0] != '(' && sql[-1] != ')'
|
|
41
|
+
params[:_sql] << sql
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def build_arel(params, operator, text)
|
|
47
|
+
if params[:columns].is_a?(Hash)
|
|
48
|
+
build_arel_from_hash(params[:model], params[:columns], operator, text)
|
|
49
|
+
else
|
|
50
|
+
build_arel_from_columns(params[:model], params[:columns], operator, text)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def build_arel_from_columns(klass, columns, operator, text)
|
|
55
|
+
columns.map { |column| klass.arel_table[column].send(operator, Arel.sql(klass.connection.quote("%#{text}%"))) }
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def build_arel_from_hash(klass, hash, operator, text)
|
|
59
|
+
hash.flat_map do |assoc_klass, columns|
|
|
60
|
+
build_arel_from_columns(assoc_klass, columns, operator, text)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
class ActiveScaffold::Bridges::LogicalQueryParser
|
|
2
|
+
grammar TokensGrammar
|
|
3
|
+
rule exp
|
|
4
|
+
sp* exp:(literal_exp / word) sp* <ExpNode>
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
rule literal_exp
|
|
8
|
+
word sp+ exp <LiteralExpNode>
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
rule word
|
|
12
|
+
word:(quoted_word / unquoted_word) <WordNode>
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
rule quoted_word
|
|
16
|
+
'"' ('\"' / !'"' .)* '"'
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
rule unquoted_word
|
|
20
|
+
atom+
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
rule sp
|
|
24
|
+
' ' / ' '
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
rule atom
|
|
28
|
+
!sp .
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class ActiveScaffold::Bridges::LogicalQueryParser < ActiveScaffold::DataStructures::Bridge
|
|
4
|
+
def self.install
|
|
5
|
+
require File.join(File.dirname(__FILE__), 'logical_query_parser/tokens_grammar')
|
|
6
|
+
ActiveScaffold::Finder.send(:remove_const, :LOGICAL_COMPARATORS)
|
|
7
|
+
ActiveScaffold::Finder.const_set :LOGICAL_COMPARATORS, %w[all_tokens any_token logical].freeze
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module ActiveScaffold
|
|
2
4
|
module Helpers
|
|
3
5
|
module FormColumnHelpers
|
|
@@ -5,7 +7,7 @@ module ActiveScaffold
|
|
|
5
7
|
record = options[:object]
|
|
6
8
|
paperclip = record.send(column.name.to_s)
|
|
7
9
|
content = active_scaffold_column_paperclip(record, column, ui_options: ui_options) if paperclip.file?
|
|
8
|
-
|
|
10
|
+
active_scaffold_file_with_content(column, options, content, 'delete_', 'paperclip_controls', ui_options: ui_options)
|
|
9
11
|
end
|
|
10
12
|
end
|
|
11
13
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module ActiveScaffold
|
|
2
4
|
module Bridges
|
|
3
5
|
class Paperclip
|
|
@@ -6,18 +8,16 @@ module ActiveScaffold
|
|
|
6
8
|
self.thumbnail_style = :thumbnail
|
|
7
9
|
|
|
8
10
|
def self.generate_delete_helper(klass, field)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
end # end
|
|
20
|
-
CODE
|
|
11
|
+
return if klass.method_defined?(:"delete_#{field}=")
|
|
12
|
+
|
|
13
|
+
klass.attr_reader :"delete_#{field}"
|
|
14
|
+
klass.define_method "delete_#{field}=" do |value|
|
|
15
|
+
value = (value == 'true') if value.is_a?(String)
|
|
16
|
+
return unless value
|
|
17
|
+
|
|
18
|
+
# passing nil to the file column causes the file to be deleted. Don't delete if we just uploaded a file!
|
|
19
|
+
send("#{field}=", nil) unless send(field).dirty?
|
|
20
|
+
end
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
end
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'active_support/concern'
|
|
2
4
|
|
|
3
5
|
class ActiveScaffold::Bridges::RecordSelect
|
|
4
6
|
module Helpers
|
|
5
7
|
extend ActiveSupport::Concern
|
|
8
|
+
|
|
6
9
|
included do
|
|
7
10
|
include FormColumnHelpers
|
|
8
11
|
include SearchColumnHelpers
|
|
@@ -12,16 +15,20 @@ class ActiveScaffold::Bridges::RecordSelect
|
|
|
12
15
|
# requires RecordSelect plugin to be installed and configured.
|
|
13
16
|
def active_scaffold_input_record_select(column, options, ui_options: column.options)
|
|
14
17
|
record = options.delete(:object)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
html =
|
|
19
|
+
if column.association&.singular?
|
|
20
|
+
multiple = ui_options.dig(:html_options, :multiple)
|
|
21
|
+
active_scaffold_record_select(record, column, options, record.send(column.name), multiple, ui_options: ui_options.except(:add_new))
|
|
22
|
+
elsif column.association&.collection?
|
|
23
|
+
active_scaffold_record_select(record, column, options, record.send(column.name), true, ui_options: ui_options.except(:add_new))
|
|
24
|
+
else
|
|
25
|
+
active_scaffold_record_select_autocomplete(record, column, options, ui_options: ui_options)
|
|
26
|
+
end
|
|
27
|
+
if column.association && ui_options[:add_new]
|
|
28
|
+
html = content_tag(:div, html, class: 'select-field') <<
|
|
29
|
+
active_scaffold_add_new(column, record, options, ui_options: ui_options)
|
|
24
30
|
end
|
|
31
|
+
html
|
|
25
32
|
end
|
|
26
33
|
|
|
27
34
|
def active_scaffold_record_select(record, column, options, value, multiple, ui_options: column.options)
|
|
@@ -78,8 +85,9 @@ class ActiveScaffold::Bridges::RecordSelect
|
|
|
78
85
|
column.association.klass.find(value.to_i)
|
|
79
86
|
end
|
|
80
87
|
rescue StandardError => e
|
|
81
|
-
|
|
82
|
-
|
|
88
|
+
message = "Sorry, we are not that smart yet. Attempted to restore search values to search fields :#{column.name} in #{controller.class}"
|
|
89
|
+
Rails.logger.error "#{e.class.name}: #{e.message} -- #{message}"
|
|
90
|
+
raise e.class, "#{e.message} -- #{message}", e.backtrace
|
|
83
91
|
end
|
|
84
92
|
end
|
|
85
93
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
class ActiveScaffold::Bridges::TinyMce
|
|
2
4
|
module Helpers
|
|
3
5
|
def self.included(base)
|
|
@@ -18,7 +20,7 @@ class ActiveScaffold::Bridges::TinyMce
|
|
|
18
20
|
options[:class] = "#{options[:class]} mceEditor #{ui_options[:class]}".strip
|
|
19
21
|
|
|
20
22
|
settings = tinymce_configuration(ui_options[:tinymce_config] || :default)
|
|
21
|
-
.options.except('selector').merge(ui_options[:tinymce] || {})
|
|
23
|
+
.options.except('selector').merge(ui_options[:tinymce]&.stringify_keys || {})
|
|
22
24
|
options['data-tinymce'] = settings.to_json
|
|
23
25
|
|
|
24
26
|
html = []
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
class ActiveScaffold::Bridges::TinyMce < ActiveScaffold::DataStructures::Bridge
|
|
2
4
|
autoload :Helpers, 'active_scaffold/bridges/tiny_mce/helpers.rb'
|
|
3
5
|
def self.install
|
|
@@ -11,4 +13,8 @@ class ActiveScaffold::Bridges::TinyMce < ActiveScaffold::DataStructures::Bridge
|
|
|
11
13
|
def self.javascripts
|
|
12
14
|
['tinymce', 'jquery/tiny_mce_bridge']
|
|
13
15
|
end
|
|
16
|
+
|
|
17
|
+
def self.stylesheets
|
|
18
|
+
['tiny_mce_bridge']
|
|
19
|
+
end
|
|
14
20
|
end
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module ActiveScaffold::Config
|
|
2
4
|
class Base
|
|
3
5
|
include ActiveScaffold::Configurable
|
|
4
6
|
extend ActiveScaffold::Configurable
|
|
7
|
+
|
|
5
8
|
NO_FORMATS = [].freeze
|
|
6
9
|
|
|
7
10
|
def initialize(core_config)
|
|
@@ -20,12 +23,10 @@ module ActiveScaffold::Config
|
|
|
20
23
|
attr_reader :core, :user_settings_key
|
|
21
24
|
|
|
22
25
|
# delegate
|
|
23
|
-
|
|
24
|
-
self.class.crud_type
|
|
25
|
-
end
|
|
26
|
+
delegate :crud_type, to: :class
|
|
26
27
|
|
|
27
|
-
def label(model = nil)
|
|
28
|
-
model ||=
|
|
28
|
+
def label(model = nil, core: @core)
|
|
29
|
+
model ||= core.label(count: 1)
|
|
29
30
|
@label.nil? ? model : as_(@label, model: model)
|
|
30
31
|
end
|
|
31
32
|
|
|
@@ -99,6 +100,10 @@ module ActiveScaffold::Config
|
|
|
99
100
|
@conf.core.user
|
|
100
101
|
end
|
|
101
102
|
|
|
103
|
+
def label(model = nil)
|
|
104
|
+
@conf.label(model, core: core)
|
|
105
|
+
end
|
|
106
|
+
|
|
102
107
|
def [](key)
|
|
103
108
|
@storage[@action][key.to_s] if @action && @storage[@action]
|
|
104
109
|
end
|
|
@@ -117,8 +122,8 @@ module ActiveScaffold::Config
|
|
|
117
122
|
@storage[@action].key? key.to_s if @action && @storage[@action]
|
|
118
123
|
end
|
|
119
124
|
|
|
120
|
-
def method_missing(name, *
|
|
121
|
-
proxy_to_conf?(name, true) ? @conf.send(name, *
|
|
125
|
+
def method_missing(name, *)
|
|
126
|
+
proxy_to_conf?(name, true) ? @conf.send(name, *) : super
|
|
122
127
|
end
|
|
123
128
|
|
|
124
129
|
def respond_to_missing?(name, include_all = false)
|