super 0.20.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +36 -48
  3. data/app/assets/javascripts/super/application.js +1201 -2092
  4. data/app/assets/stylesheets/super/application.css +54 -6569
  5. data/app/controllers/super/application_controller.rb +52 -47
  6. data/app/controllers/super/foundation_controller.rb +30 -0
  7. data/app/controllers/super/sitewide_controller.rb +36 -0
  8. data/app/controllers/super/substructure_controller.rb +40 -92
  9. data/app/controllers/super/view_controller.rb +59 -0
  10. data/app/views/layouts/super/application.html.erb +3 -3
  11. data/app/views/super/application/_batch_checkbox.csv.erb +1 -1
  12. data/app/views/super/application/_batch_checkbox.html.erb +1 -1
  13. data/app/views/super/application/_collection_header.html.erb +1 -1
  14. data/app/views/super/application/_csv_button.html.erb +1 -1
  15. data/app/views/super/application/_display_actions.html.erb +1 -1
  16. data/app/views/super/application/_display_index.html.erb +8 -2
  17. data/app/views/super/application/_display_rich_text.html.erb +1 -1
  18. data/app/views/super/application/_display_show.html.erb +10 -2
  19. data/app/views/super/application/_filter.html.erb +63 -59
  20. data/app/views/super/application/_form.html.erb +1 -1
  21. data/app/views/super/application/_form_fieldset.html.erb +1 -1
  22. data/app/views/super/application/_form_has_many.html.erb +2 -2
  23. data/app/views/super/application/_form_has_one.html.erb +1 -1
  24. data/app/views/super/application/_layout.html.erb +6 -8
  25. data/app/views/super/application/_link.html.erb +1 -6
  26. data/app/views/super/application/_member_header.html.erb +1 -1
  27. data/app/views/super/application/_panel.html.erb +1 -1
  28. data/app/views/super/application/_query.html.erb +13 -12
  29. data/app/views/super/application/_site_header.html.erb +2 -2
  30. data/app/views/super/application/_sort.html.erb +18 -14
  31. data/app/views/super/application/_sort_expression.html.erb +1 -1
  32. data/app/views/super/application/_view_chain.html.erb +1 -5
  33. data/app/views/super/application/edit.html.erb +1 -1
  34. data/app/views/super/application/index.html.erb +1 -1
  35. data/app/views/super/application/new.html.erb +1 -1
  36. data/app/views/super/application/show.html.erb +1 -1
  37. data/config/locales/en.yml +3 -0
  38. data/frontend/super-frontend/dist/application.css +54 -6569
  39. data/frontend/super-frontend/dist/application.js +1201 -2092
  40. data/lib/super/action_inquirer.rb +28 -8
  41. data/lib/super/assets.rb +2 -2
  42. data/lib/super/badge.rb +8 -23
  43. data/lib/super/cheat.rb +11 -5
  44. data/lib/super/client_error.rb +4 -0
  45. data/lib/super/compatibility.rb +4 -0
  46. data/lib/super/configuration.rb +3 -0
  47. data/lib/super/display/schema_types.rb +50 -71
  48. data/lib/super/display.rb +16 -15
  49. data/lib/super/error.rb +16 -2
  50. data/lib/super/filter/form_object.rb +2 -2
  51. data/lib/super/filter/operator.rb +1 -1
  52. data/lib/super/filter/schema_types.rb +1 -1
  53. data/lib/super/form/field_transcript.rb +4 -0
  54. data/lib/super/form/schema_types.rb +2 -2
  55. data/lib/super/form/strong_params.rb +1 -1
  56. data/lib/super/form_builder/base_methods.rb +3 -9
  57. data/lib/super/form_builder/flatpickr_methods.rb +3 -3
  58. data/lib/super/form_builder.rb +19 -21
  59. data/{app/helpers → lib}/super/form_builder_helper.rb +13 -2
  60. data/lib/super/link.rb +15 -6
  61. data/lib/super/link_builder.rb +4 -4
  62. data/lib/super/navigation.rb +49 -45
  63. data/lib/super/partial.rb +0 -12
  64. data/lib/super/plugin.rb +2 -2
  65. data/lib/super/query.rb +61 -0
  66. data/lib/super/{engine.rb → railtie.rb} +8 -1
  67. data/lib/super/render_helper.rb +31 -0
  68. data/lib/super/reset.rb +7 -5
  69. data/lib/super/schema/guesser.rb +5 -5
  70. data/lib/super/schema.rb +10 -4
  71. data/lib/super/sort.rb +2 -4
  72. data/lib/super/useful/deprecations.rb +16 -0
  73. data/lib/super/useful/enum.rb +1 -1
  74. data/lib/super/useful/i19.rb +1 -1
  75. data/lib/super/version.rb +1 -1
  76. data/lib/super/view_chain.rb +33 -4
  77. data/lib/super.rb +9 -2
  78. metadata +11 -49
  79. data/config/routes.rb +0 -4
  80. data/lib/super/query/form_object.rb +0 -48
@@ -24,24 +24,44 @@ module Super
24
24
  "delete" => %w[destroy],
25
25
 
26
26
  "collection" => %w[index new create],
27
- "member" => %w[show edit update destroy],
27
+ "member" => %w[show edit update destroy]
28
28
  }
29
29
  end
30
30
 
31
31
  # @return [ActionInquirer]
32
- def self.index!; new(default_for_resources, "index"); end
32
+ def self.index!
33
+ new(default_for_resources, "index")
34
+ end
35
+
33
36
  # @return [ActionInquirer]
34
- def self.show!; new(default_for_resources, "show"); end
37
+ def self.show!
38
+ new(default_for_resources, "show")
39
+ end
40
+
35
41
  # @return [ActionInquirer]
36
- def self.new!; new(default_for_resources, "new"); end
42
+ def self.new!
43
+ new(default_for_resources, "new")
44
+ end
45
+
37
46
  # @return [ActionInquirer]
38
- def self.edit!; new(default_for_resources, "edit"); end
47
+ def self.edit!
48
+ new(default_for_resources, "edit")
49
+ end
50
+
39
51
  # @return [ActionInquirer]
40
- def self.create!; new(default_for_resources, "create"); end
52
+ def self.create!
53
+ new(default_for_resources, "create")
54
+ end
55
+
41
56
  # @return [ActionInquirer]
42
- def self.update!; new(default_for_resources, "update"); end
57
+ def self.update!
58
+ new(default_for_resources, "update")
59
+ end
60
+
43
61
  # @return [ActionInquirer]
44
- def self.destroy!; new(default_for_resources, "destroy"); end
62
+ def self.destroy!
63
+ new(default_for_resources, "destroy")
64
+ end
45
65
 
46
66
  def initialize(categories_and_their_actions, action)
47
67
  @categories = categories_and_their_actions.keys.map(&:to_s)
data/lib/super/assets.rb CHANGED
@@ -16,7 +16,7 @@ module Super
16
16
  end
17
17
 
18
18
  def self.use_webpacker(assets, grep: nil)
19
- assets = [assets] if !assets.kind_of?(Array)
19
+ assets = [assets] if !assets.is_a?(Array)
20
20
 
21
21
  assets.map do |asset|
22
22
  grep_matches = grep && asset === grep
@@ -29,7 +29,7 @@ module Super
29
29
  end
30
30
 
31
31
  def self.use_sprockets(assets, grep: nil)
32
- assets = [assets] if !assets.kind_of?(Array)
32
+ assets = [assets] if !assets.is_a?(Array)
33
33
 
34
34
  assets.map do |asset|
35
35
  grep_matches = grep && asset === grep
data/lib/super/badge.rb CHANGED
@@ -9,37 +9,22 @@ module Super
9
9
  yellow: "bg-yellow-400 text-black",
10
10
  green: "bg-green-700 text-white",
11
11
  blue: "bg-blue-700 text-white",
12
- purple: "bg-purple-800 text-white",
12
+ purple: "bg-purple-800 text-white"
13
13
  }
14
14
 
15
- def initialize(text, styles: nil)
15
+ def initialize(text, style:)
16
+ if !STYLES.key?(style)
17
+ raise Super::Error::Initialization, "`style:` must be one of #{STYLES.keys.inspect}"
18
+ end
19
+
16
20
  @text = text
17
- @requested_styles = Array(styles.presence).flatten
21
+ @style = style
18
22
  end
19
23
 
20
24
  def styles
21
25
  return @styles if instance_variable_defined?(:@styles)
22
- @styles =
23
- if requested_styles.delete(:reset)
24
- []
25
- else
26
- COMMON_STYLES
27
- end
28
-
29
- if requested_styles.empty?
30
- @styles += [STYLES[:light]]
31
- else
32
- requested_styles.each do |style|
33
- @styles +=
34
- if STYLES.key?(style)
35
- [STYLES[style]]
36
- else
37
- [style]
38
- end
39
- end
40
- end
41
26
 
42
- @styles
27
+ @styles = COMMON_STYLES + [STYLES.fetch(@style)]
43
28
  end
44
29
 
45
30
  def to_s
data/lib/super/cheat.rb CHANGED
@@ -3,13 +3,19 @@
3
3
  module Super
4
4
  class Cheat
5
5
  def controller
6
- paths = %w[../../app/controllers/super/substructure_controller.rb]
6
+ paths = %w[
7
+ ../../app/controllers/super/application_controller.rb
8
+ ../../app/controllers/super/view_controller.rb
9
+ ../../app/controllers/super/sitewide_controller.rb
10
+ ../../app/controllers/super/substructure_controller.rb
11
+ ../../app/controllers/super/foundation_controller.rb
12
+ ]
7
13
  methods =
8
14
  paths
9
- .map { |f| File.read(File.expand_path(f, __dir__)) }
10
- .flat_map { |content| content.scan(/^\s+(?:helper_method )?def .*$/) }
11
- .reject { |method| method =~ /\bdef self\./ }
12
- .map { |method| method.strip.sub(/^(?:helper_method )?def /, "#") }
15
+ .map { |f| File.read(File.expand_path(f, __dir__)) }
16
+ .flat_map { |content| content.scan(/^\s+(?:helper_method )?def .*$/) }
17
+ .reject { |method| method =~ /\bdef self\./ }
18
+ .map { |method| method.strip.sub(/^(?:helper_method )?def /, "#") }
13
19
 
14
20
  puts "== Super::ApplicationController"
15
21
  puts methods.join("\n")
@@ -6,9 +6,13 @@ module Super
6
6
  # See also `Super::Error`
7
7
  class ClientError < StandardError
8
8
  class BadRequest < ClientError; end
9
+
9
10
  class Unauthorized < ClientError; end
11
+
10
12
  class Forbidden < ClientError; end
13
+
11
14
  class NotFound < ClientError; end
15
+
12
16
  class UnprocessableEntity < ClientError; end
13
17
 
14
18
  module Handling
@@ -34,6 +34,10 @@ module Super
34
34
  def method_missing(method_name)
35
35
  Rails.application.routes.url_helpers.public_send(method_name)
36
36
  end
37
+
38
+ def respond_to_missing?(*args, **kwargs)
39
+ Rails.application.routes.url_helpers.respond_to?(*args, **kwargs)
40
+ end
37
41
  end
38
42
 
39
43
  klass.new
@@ -24,6 +24,9 @@ module Super
24
24
  include ActiveSupport::Configurable
25
25
 
26
26
  config_accessor(:title) { "Super Admin" }
27
+
28
+ # @!attribute [rw] index_records_per_page
29
+ # @return [Integer]
27
30
  config_accessor(:index_records_per_page) { 100 }
28
31
  config_accessor(:javascripts) do
29
32
  [Super::Assets.auto("super/application")]
@@ -3,7 +3,7 @@
3
3
  module Super
4
4
  class Display
5
5
  class SchemaTypes
6
- TYPES = Useful::Enum.new(:column, :record, :none)
6
+ TYPES = Useful::Enum.new(:attribute, :record, :none)
7
7
 
8
8
  class Builder
9
9
  extend Useful::Builder
@@ -12,40 +12,61 @@ module Super
12
12
  @transform_block = block
13
13
  end
14
14
 
15
- builder def real; @real = true; end
16
- builder def computed; @real = false; end
15
+ builder def real
16
+ @real = true
17
+ end
18
+ builder def computed
19
+ @real = false
20
+ end
17
21
 
18
- builder def column; @type = :column; end
19
- builder def record; @type = :record; end
20
- builder def none; @type = :none; end
22
+ builder def attribute
23
+ @type = :attribute
24
+ end
25
+ builder def record
26
+ @type = :record
27
+ end
28
+ builder def none
29
+ @type = :none
30
+ end
21
31
 
22
- builder def ignore_nil; @ignore_nil = true; end
32
+ builder def ignore_nil
33
+ @ignore_nil = true
34
+ end
35
+
36
+ builder def attribute_name(name) # standard:disable Style/TrivialAccessors
37
+ @attribute_name = name
38
+ end
23
39
 
24
40
  def build
25
41
  Built.new(
26
42
  real: @real,
27
43
  type: @type,
28
44
  ignore_nil: !!@ignore_nil,
45
+ attribute_name: @attribute_name,
29
46
  &@transform_block
30
47
  )
31
48
  end
32
49
  end
33
50
 
34
51
  class Built
35
- def initialize(real:, type:, ignore_nil:, &transform_block)
52
+ def initialize(real:, type:, ignore_nil:, attribute_name:, &transform_block)
36
53
  @real = real
37
54
  @type = type
38
55
  @ignore_nil = ignore_nil
56
+ @attribute_name = attribute_name
39
57
  @transform_block = transform_block
40
58
  end
41
59
 
42
- def real?; @real; end
60
+ def real?
61
+ @real
62
+ end
43
63
  attr_reader :type
64
+ attr_reader :attribute_name
44
65
 
45
66
  def present(attribute_name, value = nil)
46
67
  if @transform_block.nil?
47
68
  if attribute_name
48
- raise Error::ArgumentError, "Transformation block is not set for column: #{attribute_name}"
69
+ raise Error::ArgumentError, "Transformation block is not set for attribute: #{attribute_name}"
49
70
  else
50
71
  raise Error::ArgumentError, "Transformation block is not set!"
51
72
  end
@@ -61,97 +82,55 @@ module Super
61
82
  end
62
83
  end
63
84
 
64
- class Badge
65
- extend Useful::Builder
66
-
67
- def initialize(builder)
68
- @builder = builder
69
- @whens = {}
70
- format_for_lookup(&:itself)
71
- format_for_display(&:itself)
72
- end
73
-
74
- builder_with_block def when(*patterns, &block)
75
- patterns.each do |pattern|
76
- @whens[pattern] = block
77
- end
78
- end
79
-
80
- builder_with_block def else(&block)
81
- @else = block
82
- end
83
-
84
- builder_with_block def format_for_lookup(&block)
85
- @format_for_lookup = block
86
- end
87
-
88
- builder_with_block def format_for_display(&block)
89
- @format_for_display = block
90
- end
91
-
92
- def build
93
- @builder.transform do |value|
94
- lookup_value = @format_for_lookup.call(value)
95
- block = @whens[lookup_value] || @else
96
- Super::Badge.new(
97
- @format_for_display.call(value),
98
- styles: block&.call
99
- )
100
- end
101
- @builder.build
102
- end
103
- end
104
-
105
85
  def initialize(fields:)
106
86
  @actions_called = false
107
87
  @fields = fields
108
88
  end
109
89
 
110
- def real(type = :column, &transform_block)
90
+ def real(type = :attribute, &transform_block)
111
91
  TYPES
112
92
  .case(type)
113
- .when(:column) { Builder.new.real.ignore_nil.column.transform(&transform_block) }
93
+ .when(:attribute) { Builder.new.real.ignore_nil.attribute.transform(&transform_block) }
114
94
  .when(:record) { Builder.new.real.ignore_nil.record.transform(&transform_block) }
115
- .when(:none) { Builder.new.real.ignore_nil.none.transform(&transform_block) }
95
+ .when(:none) { Builder.new.real.ignore_nil.none.transform(&transform_block) }
116
96
  .result
117
97
  end
118
98
 
119
- def computed(type = :column, &transform_block)
99
+ def computed(type = :attribute, &transform_block)
120
100
  TYPES
121
101
  .case(type)
122
- .when(:column) { Builder.new.computed.ignore_nil.column.transform(&transform_block) }
102
+ .when(:attribute) { Builder.new.computed.ignore_nil.attribute.transform(&transform_block) }
123
103
  .when(:record) { Builder.new.computed.ignore_nil.record.transform(&transform_block) }
124
- .when(:none) { Builder.new.computed.ignore_nil.none.transform(&transform_block) }
104
+ .when(:none) { Builder.new.computed.ignore_nil.none.transform(&transform_block) }
125
105
  .result
126
106
  end
127
107
 
128
108
  def manual(&transform_block)
129
- real(:column, &transform_block)
109
+ real(:attribute, &transform_block)
130
110
  end
131
111
 
132
112
  def batch
133
113
  real do |value|
134
- Partial.new("batch_checkbox", locals: { value: value })
114
+ Partial.new("batch_checkbox", locals: {value: value})
135
115
  end
136
116
  end
137
117
 
138
- def string; real(&:to_s); end
118
+ def string
119
+ real(&:to_s)
120
+ end
139
121
 
140
- def timestamp; real(&:to_s); end
141
- def time; real { |value| value.strftime("%H:%M:%S") }; end
122
+ def timestamp
123
+ real(&:to_s)
124
+ end
142
125
 
143
- def rich_text
144
- computed do |value|
145
- Partial.new("display_rich_text", locals: { rich_text: value })
146
- end
126
+ def time
127
+ real { |value| value.strftime("%H:%M:%S") }
147
128
  end
148
129
 
149
- def badge(*builder_methods)
150
- builder_methods = %i[real ignore_nil column] if builder_methods.empty?
151
- builder = builder_methods.each_with_object(Builder.new) do |builder_method, builder|
152
- builder.public_send(builder_method)
130
+ def rich_text
131
+ computed do |value|
132
+ Partial.new("display_rich_text", locals: {rich_text: value})
153
133
  end
154
- Badge.new(builder)
155
134
  end
156
135
 
157
136
  def actions
data/lib/super/display.rb CHANGED
@@ -26,7 +26,9 @@ module Super
26
26
  include Schema::Common
27
27
 
28
28
  def initialize
29
- @fields = Super::Schema::Fields.new
29
+ @fields = Super::Schema::Fields.new(
30
+ transform_value_on_set: ->(val) { val.respond_to?(:build) ? val.build : val }
31
+ )
30
32
  @schema_types = SchemaTypes.new(fields: @fields)
31
33
 
32
34
  yield(@fields, @schema_types)
@@ -43,7 +45,7 @@ module Super
43
45
 
44
46
  def to_partial_path
45
47
  if @action_inquirer.nil?
46
- raise Super::Error::Initalization,
48
+ raise Super::Error::Initialization,
47
49
  "You must call the `#apply` method after instantiating Super::Display"
48
50
  elsif @action_inquirer.index?
49
51
  "display_index"
@@ -57,22 +59,21 @@ module Super
57
59
  # @private
58
60
  def render_attribute(template:, record:, column:)
59
61
  formatter = @fields[column]
60
- formatter = formatter.build if formatter.respond_to?(:build)
61
62
 
62
63
  formatted =
63
64
  SchemaTypes::TYPES
64
- .case(formatter.type)
65
- .when(:record) do
66
- formatter.present(column, record)
67
- end
68
- .when(:column) do
69
- value = record.public_send(column)
70
- formatter.present(column, value)
71
- end
72
- .when(:none) do
73
- formatter.present(column)
74
- end
75
- .result
65
+ .case(formatter.type)
66
+ .when(:record) do
67
+ formatter.present(column, record)
68
+ end
69
+ .when(:attribute) do
70
+ value = record.public_send(column)
71
+ formatter.present(column, value)
72
+ end
73
+ .when(:none) do
74
+ formatter.present(column)
75
+ end
76
+ .result
76
77
 
77
78
  if formatted.respond_to?(:to_partial_path)
78
79
  if formatted.respond_to?(:locals)
data/lib/super/error.rb CHANGED
@@ -7,14 +7,19 @@ module Super
7
7
  class Error < StandardError
8
8
  # Error raised when some configuration is not set
9
9
  class UnconfiguredConfiguration < Error; end
10
+
10
11
  # Error raised when a configuration is set to a invalid value
11
12
  class InvalidConfiguration < Error; end
13
+
12
14
  # Error raised on problematic plugins, see `Super::Plugin`
13
15
  class InvalidPluginArgument < Error; end
16
+
14
17
  # Error raised on problematic ActionInquirer settings, see `Super::ActionInquirer`
15
18
  class ActionInquirerError < Error; end
19
+
16
20
  # Error raised when a `Super::Link` couldn't be found
17
21
  class LinkNotRegistered < Error; end
22
+
18
23
  # Error raised when rendering if `@view` wasn't set by the controller
19
24
  class NothingToRender < Error
20
25
  def initialize(basename)
@@ -24,23 +29,32 @@ module Super
24
29
  )
25
30
  end
26
31
  end
27
- # Error raised when something wasn't initalized correctly, and if there isn't
32
+
33
+ # Error raised when something wasn't initialized correctly, and if there isn't
28
34
  # a more specific error
29
- class Initalization < Error; end
35
+ class Initialization < Error; end
36
+
30
37
  class ArgumentError < Error; end
38
+
31
39
  class AlreadyRegistered < Error; end
40
+
32
41
  class AlreadyTranscribed < Error; end
42
+
33
43
  class NotImplementedError < Error; end
44
+
34
45
  class IncompleteBuilder < Error; end
35
46
 
36
47
  class Enum < Error
37
48
  class ImpossibleValue < Enum; end
49
+
38
50
  class ArgumentError < Enum; end
51
+
39
52
  class UndefinedCase < Enum; end
40
53
  end
41
54
 
42
55
  class ReorderableHash < Error
43
56
  class DuplicateKey < ReorderableHash; end
57
+
44
58
  class KeyError < ReorderableHash; end
45
59
  end
46
60
 
@@ -44,8 +44,8 @@ module Super
44
44
  query_parameter_keys = [NULLARY] if query_parameter_keys.empty?
45
45
  @specified_values =
46
46
  query_parameter_keys
47
- .map { |key| [key, @params[key].presence&.strip] }
48
- .to_h
47
+ .map { |key| [key, @params[key].presence&.strip] }
48
+ .to_h
49
49
 
50
50
  @specified_values.each do |key, value|
51
51
  define_singleton_method(key) { value }
@@ -57,7 +57,7 @@ module Super
57
57
  attr_reader :humanized_operator_name
58
58
 
59
59
  def behavior(&block)
60
- self.behavior = block if block_given?
60
+ self.behavior = block if block
61
61
  @behavior
62
62
  end
63
63
 
@@ -28,7 +28,7 @@ module Super
28
28
  nil
29
29
  end
30
30
 
31
- alias add push
31
+ alias_method :add, :push
32
32
 
33
33
  def each
34
34
  return enum_for(:each) if !block_given?
@@ -38,6 +38,10 @@ module Super
38
38
  @kwargs = kwargs
39
39
  @method_name
40
40
  end
41
+
42
+ def respond_to_missing?(*, **)
43
+ true
44
+ end
41
45
  end
42
46
  end
43
47
  end
@@ -79,7 +79,7 @@ module Super
79
79
  end
80
80
 
81
81
  if @extras.key?(:reader)
82
- return @extras[:reader].to_s.singularize.humanize
82
+ @extras[:reader].to_s.singularize.humanize
83
83
  end
84
84
  end
85
85
 
@@ -142,7 +142,7 @@ module Super
142
142
  end
143
143
 
144
144
  def self.define_schema_type_for(method_name)
145
- class_eval(<<~RUBY)
145
+ class_eval(<<~RUBY, __FILE__, __LINE__ + 1)
146
146
  def #{method_name}(*args, **kwargs)
147
147
  Direct.new(super_builder: true, method_name: :#{method_name}!, args: args, kwargs: kwargs)
148
148
  end
@@ -20,7 +20,7 @@ module Super
20
20
  def unfurl(responds_to_each_attribute)
21
21
  responds_to_each_attribute.each_attribute.map do |name, type|
22
22
  if type.nested_fields&.any?
23
- { name => [:id, *unfurl(type)] }
23
+ {name => [:id, *unfurl(type)]}
24
24
  else
25
25
  name
26
26
  end
@@ -3,7 +3,7 @@
3
3
  module Super
4
4
  class FormBuilder
5
5
  class Wrappers
6
- skipped_field_helpers = [:label, :check_box, :radio_button, :fields_for, :fields, :hidden_field, :file_field]
6
+ skipped_field_helpers = [:label, :check_box, :radio_button, :fields_for, :fields, :hidden_field]
7
7
  (ActionView::Helpers::FormBuilder.field_helpers - skipped_field_helpers).each do |builder_method_name|
8
8
  class_eval(<<~RUBY, __FILE__, __LINE__ + 1)
9
9
  def #{builder_method_name}(attribute, options = {})
@@ -30,26 +30,20 @@ module Super
30
30
 
31
31
  def check_box!(attribute, checked_value: "1", unchecked_value: "0", label_text: nil, label: {}, field: {}, show_errors: true)
32
32
  label[:super] ||= {}
33
- label[:super] = { class: "select-none ml-1" }.merge(label[:super])
33
+ label[:super] = {class: "select-none ml-1"}.merge(label[:super])
34
34
  container do
35
35
  compact_join([
36
36
  "<div>".html_safe,
37
37
  public_send(:check_box, attribute, field, checked_value, unchecked_value),
38
38
  public_send(:label, attribute, label_text, label),
39
39
  "</div>".html_safe,
40
- show_errors && inline_errors(attribute),
40
+ show_errors && inline_errors(attribute)
41
41
  ])
42
42
  end
43
43
  end
44
44
 
45
45
  ::Super::Form::SchemaTypes.define_schema_type_for(:check_box)
46
46
 
47
- # def file_field(attribute, options = {})
48
- # end
49
-
50
- # def file_field!(attribute, label_text: nil, label: {}, field: {}, show_errors: true)
51
- # end
52
-
53
47
  def hidden_field(attribute, options = {})
54
48
  @builder.hidden_field(attribute, options)
55
49
  end
@@ -10,7 +10,7 @@ module Super
10
10
  data: {
11
11
  controller: "flatpickr",
12
12
  flatpickr_options_value: {
13
- dateFormat: "Y-m-d",
13
+ dateFormat: "Y-m-d"
14
14
  }
15
15
  }
16
16
  )
@@ -33,7 +33,7 @@ module Super
33
33
  flatpickr_options_value: {
34
34
  enableSeconds: true,
35
35
  enableTime: true,
36
- dateFormat: "Z",
36
+ dateFormat: "Z"
37
37
  }
38
38
  }
39
39
  )
@@ -57,7 +57,7 @@ module Super
57
57
  enableSeconds: true,
58
58
  enableTime: true,
59
59
  noCalendar: true,
60
- dateFormat: "H:i:S",
60
+ dateFormat: "H:i:S"
61
61
  }
62
62
  }
63
63
  )