trusty-cms 4.1.9 → 4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +70 -67
- data/lib/trusty_cms.rb +1 -1
- data/trusty_cms.gemspec +2 -2
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/base.rb +195 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/check_box.rb +65 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/checkable.rb +18 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_check_boxes.rb +35 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_helpers.rb +118 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_radio_buttons.rb +30 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_select.rb +30 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/color_field.rb +26 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/date_field.rb +14 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/date_select.rb +73 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_field.rb +31 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_local_field.rb +20 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_select.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/email_field.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/file_field.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/grouped_collection_select.rb +31 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/hidden_field.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/label.rb +80 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/month_field.rb +14 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/number_field.rb +20 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/password_field.rb +14 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/placeholderable.rb +24 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/radio_button.rb +32 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/range_field.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/search_field.rb +27 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/select.rb +42 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/tel_field.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/text_area.rb +24 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/text_field.rb +33 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_field.rb +14 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_select.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_zone_select.rb +22 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/translator.rb +39 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/url_field.rb +10 -0
- data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/week_field.rb +14 -0
- metadata +164 -10
data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/checkable.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionView
|
4
|
+
module Helpers
|
5
|
+
module Tags # :nodoc:
|
6
|
+
module Checkable # :nodoc:
|
7
|
+
def input_checked?(options)
|
8
|
+
if options.has_key?("checked")
|
9
|
+
checked = options.delete "checked"
|
10
|
+
checked == true || checked == "checked"
|
11
|
+
else
|
12
|
+
checked?(value)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "action_view/helpers/tags/collection_helpers"
|
4
|
+
|
5
|
+
module ActionView
|
6
|
+
module Helpers
|
7
|
+
module Tags # :nodoc:
|
8
|
+
class CollectionCheckBoxes < Base # :nodoc:
|
9
|
+
include CollectionHelpers
|
10
|
+
|
11
|
+
class CheckBoxBuilder < Builder # :nodoc:
|
12
|
+
def check_box(extra_html_options = {})
|
13
|
+
html_options = extra_html_options.merge(@input_html_options)
|
14
|
+
html_options[:multiple] = true
|
15
|
+
html_options[:skip_default_ids] = false
|
16
|
+
@template_object.check_box(@object_name, @method_name, html_options, @value, nil)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def render(&block)
|
21
|
+
render_collection_for(CheckBoxBuilder, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
def render_component(builder)
|
26
|
+
builder.check_box + builder.label
|
27
|
+
end
|
28
|
+
|
29
|
+
def hidden_field_name
|
30
|
+
"#{super}[]"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionView
|
4
|
+
module Helpers
|
5
|
+
module Tags # :nodoc:
|
6
|
+
module CollectionHelpers # :nodoc:
|
7
|
+
class Builder # :nodoc:
|
8
|
+
attr_reader :object, :text, :value
|
9
|
+
|
10
|
+
def initialize(template_object, object_name, method_name, object,
|
11
|
+
sanitized_attribute_name, text, value, input_html_options)
|
12
|
+
@template_object = template_object
|
13
|
+
@object_name = object_name
|
14
|
+
@method_name = method_name
|
15
|
+
@object = object
|
16
|
+
@sanitized_attribute_name = sanitized_attribute_name
|
17
|
+
@text = text
|
18
|
+
@value = value
|
19
|
+
@input_html_options = input_html_options
|
20
|
+
end
|
21
|
+
|
22
|
+
def label(label_html_options = {}, &block)
|
23
|
+
html_options = @input_html_options.slice(:index, :namespace).merge(label_html_options)
|
24
|
+
html_options[:for] ||= @input_html_options[:id] if @input_html_options[:id]
|
25
|
+
|
26
|
+
@template_object.label(@object_name, @sanitized_attribute_name, @text, html_options, &block)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def initialize(object_name, method_name, template_object, collection, value_method, text_method, options, html_options)
|
31
|
+
@collection = collection
|
32
|
+
@value_method = value_method
|
33
|
+
@text_method = text_method
|
34
|
+
@html_options = html_options
|
35
|
+
|
36
|
+
super(object_name, method_name, template_object, options)
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
def instantiate_builder(builder_class, item, value, text, html_options)
|
41
|
+
builder_class.new(@template_object, @object_name, @method_name, item,
|
42
|
+
sanitize_attribute_name(value), text, value, html_options)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Generate default options for collection helpers, such as :checked and
|
46
|
+
# :disabled.
|
47
|
+
def default_html_options_for_collection(item, value)
|
48
|
+
html_options = @html_options.dup
|
49
|
+
|
50
|
+
[:checked, :selected, :disabled, :readonly].each do |option|
|
51
|
+
current_value = @options[option]
|
52
|
+
next if current_value.nil?
|
53
|
+
|
54
|
+
accept = if current_value.respond_to?(:call)
|
55
|
+
current_value.call(item)
|
56
|
+
else
|
57
|
+
Array(current_value).map(&:to_s).include?(value.to_s)
|
58
|
+
end
|
59
|
+
|
60
|
+
if accept
|
61
|
+
html_options[option] = true
|
62
|
+
elsif option == :checked
|
63
|
+
html_options[option] = false
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
html_options[:object] = @object
|
68
|
+
html_options
|
69
|
+
end
|
70
|
+
|
71
|
+
def sanitize_attribute_name(value)
|
72
|
+
"#{sanitized_method_name}_#{sanitized_value(value)}"
|
73
|
+
end
|
74
|
+
|
75
|
+
def render_collection
|
76
|
+
@collection.map do |item|
|
77
|
+
value = value_for_collection(item, @value_method)
|
78
|
+
text = value_for_collection(item, @text_method)
|
79
|
+
default_html_options = default_html_options_for_collection(item, value)
|
80
|
+
additional_html_options = option_html_attributes(item)
|
81
|
+
|
82
|
+
yield item, value, text, default_html_options.merge(additional_html_options)
|
83
|
+
end.join.html_safe
|
84
|
+
end
|
85
|
+
|
86
|
+
def render_collection_for(builder_class, &block)
|
87
|
+
options = @options.stringify_keys
|
88
|
+
rendered_collection = render_collection do |item, value, text, default_html_options|
|
89
|
+
builder = instantiate_builder(builder_class, item, value, text, default_html_options)
|
90
|
+
|
91
|
+
if block_given?
|
92
|
+
@template_object.capture(builder, &block)
|
93
|
+
else
|
94
|
+
render_component(builder)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Prepend a hidden field to make sure something will be sent back to the
|
99
|
+
# server if all radio buttons are unchecked.
|
100
|
+
if options.fetch("include_hidden", true)
|
101
|
+
hidden_field + rendered_collection
|
102
|
+
else
|
103
|
+
rendered_collection
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def hidden_field
|
108
|
+
hidden_name = @html_options[:name] || hidden_field_name
|
109
|
+
@template_object.hidden_field_tag(hidden_name, "", id: nil)
|
110
|
+
end
|
111
|
+
|
112
|
+
def hidden_field_name
|
113
|
+
"#{tag_name(false, @options[:index])}"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "action_view/helpers/tags/collection_helpers"
|
4
|
+
|
5
|
+
module ActionView
|
6
|
+
module Helpers
|
7
|
+
module Tags # :nodoc:
|
8
|
+
class CollectionRadioButtons < Base # :nodoc:
|
9
|
+
include CollectionHelpers
|
10
|
+
|
11
|
+
class RadioButtonBuilder < Builder # :nodoc:
|
12
|
+
def radio_button(extra_html_options = {})
|
13
|
+
html_options = extra_html_options.merge(@input_html_options)
|
14
|
+
html_options[:skip_default_ids] = false
|
15
|
+
@template_object.radio_button(@object_name, @method_name, @value, html_options)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def render(&block)
|
20
|
+
render_collection_for(RadioButtonBuilder, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
def render_component(builder)
|
25
|
+
builder.radio_button + builder.label
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionView
|
4
|
+
module Helpers
|
5
|
+
module Tags # :nodoc:
|
6
|
+
class CollectionSelect < Base #:nodoc:
|
7
|
+
def initialize(object_name, method_name, template_object, collection, value_method, text_method, options, html_options)
|
8
|
+
@collection = collection
|
9
|
+
@value_method = value_method
|
10
|
+
@text_method = text_method
|
11
|
+
@html_options = html_options
|
12
|
+
|
13
|
+
super(object_name, method_name, template_object, options)
|
14
|
+
end
|
15
|
+
|
16
|
+
def render
|
17
|
+
option_tags_options = {
|
18
|
+
selected: @options.fetch(:selected) { value },
|
19
|
+
disabled: @options[:disabled]
|
20
|
+
}
|
21
|
+
|
22
|
+
select_content_tag(
|
23
|
+
options_from_collection_for_select(@collection, @value_method, @text_method, option_tags_options),
|
24
|
+
@options, @html_options
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/color_field.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionView
|
4
|
+
module Helpers
|
5
|
+
module Tags # :nodoc:
|
6
|
+
class ColorField < TextField # :nodoc:
|
7
|
+
def render
|
8
|
+
options = @options.stringify_keys
|
9
|
+
options["value"] ||= validate_color_string(value)
|
10
|
+
@options = options
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def validate_color_string(string)
|
16
|
+
regex = /#[0-9a-fA-F]{6}/
|
17
|
+
if regex.match?(string)
|
18
|
+
string.downcase
|
19
|
+
else
|
20
|
+
"#000000"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/date_select.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/core_ext/time/calculations"
|
4
|
+
|
5
|
+
module ActionView
|
6
|
+
module Helpers
|
7
|
+
module Tags # :nodoc:
|
8
|
+
class DateSelect < Base # :nodoc:
|
9
|
+
def initialize(object_name, method_name, template_object, options, html_options)
|
10
|
+
@html_options = html_options
|
11
|
+
|
12
|
+
super(object_name, method_name, template_object, options)
|
13
|
+
end
|
14
|
+
|
15
|
+
def render
|
16
|
+
error_wrapping(datetime_selector(@options, @html_options).send("select_#{select_type}").html_safe)
|
17
|
+
end
|
18
|
+
|
19
|
+
class << self
|
20
|
+
def select_type
|
21
|
+
@select_type ||= name.split("::").last.sub("Select", "").downcase
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
def select_type
|
27
|
+
self.class.select_type
|
28
|
+
end
|
29
|
+
|
30
|
+
def datetime_selector(options, html_options)
|
31
|
+
datetime = options.fetch(:selected) { value || default_datetime(options) }
|
32
|
+
@auto_index ||= nil
|
33
|
+
|
34
|
+
options = options.dup
|
35
|
+
options[:field_name] = @method_name
|
36
|
+
options[:include_position] = true
|
37
|
+
options[:prefix] ||= @object_name
|
38
|
+
options[:index] = @auto_index if @auto_index && !options.has_key?(:index)
|
39
|
+
|
40
|
+
DateTimeSelector.new(datetime, options, html_options)
|
41
|
+
end
|
42
|
+
|
43
|
+
def default_datetime(options)
|
44
|
+
return if options[:include_blank] || options[:prompt]
|
45
|
+
|
46
|
+
case options[:default]
|
47
|
+
when nil
|
48
|
+
Time.current
|
49
|
+
when Date, Time
|
50
|
+
options[:default]
|
51
|
+
else
|
52
|
+
default = options[:default].dup
|
53
|
+
|
54
|
+
# Rename :minute and :second to :min and :sec
|
55
|
+
default[:min] ||= default[:minute]
|
56
|
+
default[:sec] ||= default[:second]
|
57
|
+
|
58
|
+
time = Time.current
|
59
|
+
|
60
|
+
[:year, :month, :day, :hour, :min, :sec].each do |key|
|
61
|
+
default[key] ||= time.send(key)
|
62
|
+
end
|
63
|
+
|
64
|
+
Time.utc(
|
65
|
+
default[:year], default[:month], default[:day],
|
66
|
+
default[:hour], default[:min], default[:sec]
|
67
|
+
)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_field.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionView
|
4
|
+
module Helpers
|
5
|
+
module Tags # :nodoc:
|
6
|
+
class DatetimeField < TextField # :nodoc:
|
7
|
+
def render
|
8
|
+
options = @options.stringify_keys
|
9
|
+
options["value"] ||= format_date(value)
|
10
|
+
options["min"] = format_date(datetime_value(options["min"]))
|
11
|
+
options["max"] = format_date(datetime_value(options["max"]))
|
12
|
+
@options = options
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
def format_date(value)
|
18
|
+
raise NotImplementedError
|
19
|
+
end
|
20
|
+
|
21
|
+
def datetime_value(value)
|
22
|
+
if value.is_a? String
|
23
|
+
DateTime.parse(value) rescue nil
|
24
|
+
else
|
25
|
+
value
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionView
|
4
|
+
module Helpers
|
5
|
+
module Tags # :nodoc:
|
6
|
+
class DatetimeLocalField < DatetimeField # :nodoc:
|
7
|
+
class << self
|
8
|
+
def field_type
|
9
|
+
@field_type ||= "datetime-local"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
def format_date(value)
|
15
|
+
value.try(:strftime, "%Y-%m-%dT%T")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionView
|
4
|
+
module Helpers
|
5
|
+
module Tags # :nodoc:
|
6
|
+
class GroupedCollectionSelect < Base # :nodoc:
|
7
|
+
def initialize(object_name, method_name, template_object, collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options)
|
8
|
+
@collection = collection
|
9
|
+
@group_method = group_method
|
10
|
+
@group_label_method = group_label_method
|
11
|
+
@option_key_method = option_key_method
|
12
|
+
@option_value_method = option_value_method
|
13
|
+
@html_options = html_options
|
14
|
+
|
15
|
+
super(object_name, method_name, template_object, options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def render
|
19
|
+
option_tags_options = {
|
20
|
+
selected: @options.fetch(:selected) { value },
|
21
|
+
disabled: @options[:disabled]
|
22
|
+
}
|
23
|
+
|
24
|
+
select_content_tag(
|
25
|
+
option_groups_from_collection_for_select(@collection, @group_method, @group_label_method, @option_key_method, @option_value_method, option_tags_options), @options, @html_options
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|