trusty-cms 4.2 → 4.3.1

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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/Gemfile.lock +115 -112
  4. data/LICENSE.md +1 -1
  5. data/app/assets/config/trusty-cms/manifest.js +7 -0
  6. data/app/assets/javascripts/admin/custom_file_upload.js +7 -0
  7. data/app/controllers/admin/pages_controller.rb +1 -1
  8. data/app/controllers/admin/preferences_controller.rb +1 -1
  9. data/app/controllers/admin/resource_controller.rb +1 -1
  10. data/app/controllers/admin/users_controller.rb +1 -1
  11. data/app/helpers/admin/node_helper.rb +1 -1
  12. data/app/models/asset.rb +3 -3
  13. data/app/models/page.rb +5 -5
  14. data/app/models/standard_tags.rb +3 -3
  15. data/app/models/user.rb +1 -1
  16. data/app/views/admin/assets/new.html.haml +2 -0
  17. data/config/database.mysql.yml +10 -2
  18. data/config/initializers/assets.rb +0 -4
  19. data/db/migrate/20210331134718_create_active_storage_tables.active_storage.rb +36 -0
  20. data/lib/generators/extension/templates/test_helper.rb +6 -8
  21. data/lib/login_system.rb +1 -1
  22. data/lib/trusty_cms.rb +1 -1
  23. data/lib/trusty_cms/setup.rb +1 -1
  24. data/spec/dummy/config/database.yml +6 -2
  25. data/trusty_cms.gemspec +3 -4
  26. data/vendor/extensions/clipped-extension/lib/asset_tags.rb +4 -4
  27. data/yarn.lock +6 -6
  28. metadata +323 -184
  29. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/base.rb +0 -195
  30. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/check_box.rb +0 -65
  31. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/checkable.rb +0 -18
  32. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_check_boxes.rb +0 -35
  33. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_helpers.rb +0 -118
  34. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_radio_buttons.rb +0 -30
  35. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/collection_select.rb +0 -30
  36. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/color_field.rb +0 -26
  37. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/date_field.rb +0 -14
  38. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/date_select.rb +0 -73
  39. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_field.rb +0 -31
  40. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_local_field.rb +0 -20
  41. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/datetime_select.rb +0 -10
  42. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/email_field.rb +0 -10
  43. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/file_field.rb +0 -10
  44. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/grouped_collection_select.rb +0 -31
  45. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/hidden_field.rb +0 -10
  46. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/label.rb +0 -80
  47. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/month_field.rb +0 -14
  48. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/number_field.rb +0 -20
  49. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/password_field.rb +0 -14
  50. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/placeholderable.rb +0 -24
  51. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/radio_button.rb +0 -32
  52. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/range_field.rb +0 -10
  53. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/search_field.rb +0 -27
  54. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/select.rb +0 -42
  55. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/tel_field.rb +0 -10
  56. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/text_area.rb +0 -24
  57. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/text_field.rb +0 -33
  58. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_field.rb +0 -14
  59. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_select.rb +0 -10
  60. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/time_zone_select.rb +0 -22
  61. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/translator.rb +0 -39
  62. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/url_field.rb +0 -10
  63. data/vendor/bundle/ruby/2.6.0/gems/actionview-6.0.3.4/lib/action_view/helpers/tags/week_field.rb +0 -14
@@ -1,30 +0,0 @@
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
@@ -1,26 +0,0 @@
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
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionView
4
- module Helpers
5
- module Tags # :nodoc:
6
- class DateField < DatetimeField # :nodoc:
7
- private
8
- def format_date(value)
9
- value.try(:strftime, "%Y-%m-%d")
10
- end
11
- end
12
- end
13
- end
14
- end
@@ -1,73 +0,0 @@
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
@@ -1,31 +0,0 @@
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
@@ -1,20 +0,0 @@
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
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionView
4
- module Helpers
5
- module Tags # :nodoc:
6
- class DatetimeSelect < DateSelect # :nodoc:
7
- end
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionView
4
- module Helpers
5
- module Tags # :nodoc:
6
- class EmailField < TextField # :nodoc:
7
- end
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionView
4
- module Helpers
5
- module Tags # :nodoc:
6
- class FileField < TextField # :nodoc:
7
- end
8
- end
9
- end
10
- end
@@ -1,31 +0,0 @@
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
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionView
4
- module Helpers
5
- module Tags # :nodoc:
6
- class HiddenField < TextField # :nodoc:
7
- end
8
- end
9
- end
10
- end
@@ -1,80 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionView
4
- module Helpers
5
- module Tags # :nodoc:
6
- class Label < Base # :nodoc:
7
- class LabelBuilder # :nodoc:
8
- attr_reader :object
9
-
10
- def initialize(template_object, object_name, method_name, object, tag_value)
11
- @template_object = template_object
12
- @object_name = object_name
13
- @method_name = method_name
14
- @object = object
15
- @tag_value = tag_value
16
- end
17
-
18
- def translation
19
- method_and_value = @tag_value.present? ? "#{@method_name}.#{@tag_value}" : @method_name
20
-
21
- content ||= Translator
22
- .new(object, @object_name, method_and_value, scope: "helpers.label")
23
- .translate
24
- content ||= @method_name.humanize
25
-
26
- content
27
- end
28
- end
29
-
30
- def initialize(object_name, method_name, template_object, content_or_options = nil, options = nil)
31
- options ||= {}
32
-
33
- content_is_options = content_or_options.is_a?(Hash)
34
- if content_is_options
35
- options.merge! content_or_options
36
- @content = nil
37
- else
38
- @content = content_or_options
39
- end
40
-
41
- super(object_name, method_name, template_object, options)
42
- end
43
-
44
- def render(&block)
45
- options = @options.stringify_keys
46
- tag_value = options.delete("value")
47
- name_and_id = options.dup
48
-
49
- if name_and_id["for"]
50
- name_and_id["id"] = name_and_id["for"]
51
- else
52
- name_and_id.delete("id")
53
- end
54
-
55
- add_default_name_and_id_for_value(tag_value, name_and_id)
56
- options.delete("index")
57
- options.delete("namespace")
58
- options["for"] = name_and_id["id"] unless options.key?("for")
59
-
60
- builder = LabelBuilder.new(@template_object, @object_name, @method_name, @object, tag_value)
61
-
62
- content = if block_given?
63
- @template_object.capture(builder, &block)
64
- elsif @content.present?
65
- @content.to_s
66
- else
67
- render_component(builder)
68
- end
69
-
70
- label_tag(name_and_id["id"], content, options)
71
- end
72
-
73
- private
74
- def render_component(builder)
75
- builder.translation
76
- end
77
- end
78
- end
79
- end
80
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionView
4
- module Helpers
5
- module Tags # :nodoc:
6
- class MonthField < DatetimeField # :nodoc:
7
- private
8
- def format_date(value)
9
- value.try(:strftime, "%Y-%m")
10
- end
11
- end
12
- end
13
- end
14
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionView
4
- module Helpers
5
- module Tags # :nodoc:
6
- class NumberField < TextField # :nodoc:
7
- def render
8
- options = @options.stringify_keys
9
-
10
- if range = options.delete("in") || options.delete("within")
11
- options.update("min" => range.min, "max" => range.max)
12
- end
13
-
14
- @options = options
15
- super
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionView
4
- module Helpers
5
- module Tags # :nodoc:
6
- class PasswordField < TextField # :nodoc:
7
- def render
8
- @options = { value: nil }.merge!(@options)
9
- super
10
- end
11
- end
12
- end
13
- end
14
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionView
4
- module Helpers
5
- module Tags # :nodoc:
6
- module Placeholderable # :nodoc:
7
- def initialize(*)
8
- super
9
-
10
- if tag_value = @options[:placeholder]
11
- placeholder = tag_value if tag_value.is_a?(String)
12
- method_and_value = tag_value.is_a?(TrueClass) ? @method_name : "#{@method_name}.#{tag_value}"
13
-
14
- placeholder ||= Tags::Translator
15
- .new(object, @object_name, method_and_value, scope: "helpers.placeholder")
16
- .translate
17
- placeholder ||= @method_name.humanize
18
- @options[:placeholder] = placeholder
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end