super 0.0.10 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +0 -9
- data/README.md +40 -52
- data/app/assets/javascripts/super/application.js +5672 -3671
- data/app/assets/stylesheets/super/application.css +114681 -71486
- data/app/controllers/super/application_controller.rb +31 -21
- data/app/helpers/super/form_builder_helper.rb +2 -0
- data/app/views/layouts/super/application.html.erb +15 -14
- data/app/views/super/application/{_super_schema_display_actions.html.erb → _display_actions.html.erb} +0 -0
- data/app/views/super/application/{_super_schema_display_index.html.erb → _display_index.html.erb} +4 -4
- data/app/views/super/application/_display_show.html.erb +8 -0
- data/app/views/super/application/_filter.html.erb +5 -13
- data/app/views/super/application/_filter_type_select.html.erb +5 -2
- data/app/views/super/application/_filter_type_text.html.erb +6 -4
- data/app/views/super/application/_filter_type_timestamp.html.erb +6 -5
- data/app/views/super/application/{_super_schema_form.html.erb → _form.html.erb} +2 -2
- data/app/views/super/application/_form_field.html.erb +5 -0
- data/app/views/super/application/{_super_layout.html.erb → _layout.html.erb} +8 -8
- data/app/views/super/application/{_super_pagination.html.erb → _pagination.html.erb} +1 -1
- data/app/views/super/application/{_super_panel.html.erb → _panel.html.erb} +2 -2
- data/app/views/super/application/_query.html.erb +18 -0
- data/app/views/super/application/_sort.html.erb +18 -0
- data/app/views/super/application/_sort_expression.html.erb +25 -0
- data/app/views/super/feather/README.md +1 -1
- data/app/views/super/feather/_x.html +15 -0
- data/config/routes.rb +2 -0
- data/frontend/super-frontend/dist/application.css +114681 -71486
- data/frontend/super-frontend/dist/application.js +5672 -3671
- data/lib/generators/super/action_text/action_text_generator.rb +2 -0
- data/lib/generators/super/install/install_generator.rb +18 -23
- data/lib/generators/super/install/templates/base_controller.rb.tt +9 -1
- data/lib/generators/super/install/templates/initializer.rb.tt +9 -2
- data/lib/generators/super/resource/resource_generator.rb +107 -30
- data/lib/generators/super/resource/templates/resources_controller.rb.tt +3 -9
- data/lib/generators/super/webpacker/webpacker_generator.rb +11 -5
- data/lib/super.rb +10 -2
- data/lib/super/action_inquirer.rb +13 -3
- data/lib/super/assets.rb +46 -23
- data/lib/super/badge.rb +61 -0
- data/lib/super/cheat.rb +17 -0
- data/lib/super/client_error.rb +2 -0
- data/lib/super/compatibility.rb +21 -0
- data/lib/super/configuration.rb +16 -24
- data/lib/super/controls.rb +11 -2
- data/lib/super/controls/optional.rb +44 -1
- data/lib/super/controls/steps.rb +53 -34
- data/lib/super/controls/view.rb +55 -0
- data/lib/super/display.rb +29 -13
- data/lib/super/display/guesser.rb +4 -0
- data/lib/super/display/schema_types.rb +118 -29
- data/lib/super/engine.rb +2 -0
- data/lib/super/error.rb +12 -0
- data/lib/super/filter.rb +2 -0
- data/lib/super/filter/form_object.rb +5 -8
- data/lib/super/filter/guesser.rb +2 -0
- data/lib/super/filter/operator.rb +2 -0
- data/lib/super/filter/schema_types.rb +2 -0
- data/lib/super/form.rb +3 -1
- data/lib/super/form/builder.rb +109 -27
- data/lib/super/form/guesser.rb +12 -1
- data/lib/super/form/inline_errors.rb +2 -0
- data/lib/super/form/schema_types.rb +75 -7
- data/lib/super/form/strong_params.rb +2 -0
- data/lib/super/layout.rb +3 -1
- data/lib/super/link.rb +44 -31
- data/lib/super/link_builder.rb +58 -0
- data/lib/super/navigation.rb +164 -0
- data/lib/super/pagination.rb +3 -43
- data/lib/super/panel.rb +3 -1
- data/lib/super/partial.rb +2 -0
- data/lib/super/partial/resolving.rb +2 -0
- data/lib/super/plugin.rb +2 -0
- data/lib/super/query/form_object.rb +48 -0
- data/lib/super/reset.rb +17 -0
- data/lib/super/schema.rb +2 -0
- data/lib/super/schema/common.rb +2 -0
- data/lib/super/schema/guesser.rb +2 -0
- data/lib/super/sort.rb +110 -0
- data/lib/super/useful/builder.rb +25 -0
- data/lib/super/useful/enum.rb +63 -0
- data/lib/super/version.rb +3 -1
- data/lib/super/view_helper.rb +2 -0
- data/lib/tasks/super/cheat.rake +9 -0
- metadata +45 -28
- data/CONTRIBUTING.md +0 -56
- data/Rakefile +0 -34
- data/STABILITY.md +0 -50
- data/app/views/super/application/_form_field_checkbox.html.erb +0 -1
- data/app/views/super/application/_form_field_rich_text_area.html.erb +0 -1
- data/app/views/super/application/_form_field_text.html.erb +0 -1
- data/app/views/super/application/_super_schema_display_show.html.erb +0 -8
- data/app/views/super/feather/_chevron_down.html +0 -1
- data/docs/README.md +0 -8
- data/docs/action_text.md +0 -48
- data/docs/cheat.md +0 -41
- data/docs/faq.md +0 -44
- data/docs/installation.md +0 -21
- data/docs/quick_start.md +0 -30
- data/docs/webpacker.md +0 -25
- data/docs/yard_customizations.rb +0 -41
- data/lib/super/controls/required.rb +0 -13
- data/lib/super/filter/plugin.rb +0 -47
- data/lib/super/navigation/automatic.rb +0 -71
@@ -1,35 +1,104 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Super
|
2
4
|
class Display
|
3
5
|
class SchemaTypes
|
4
|
-
|
5
|
-
|
6
|
-
|
6
|
+
TYPES = Useful::Enum.new(:column, :record, :none)
|
7
|
+
|
8
|
+
class Builder
|
9
|
+
extend Useful::Builder
|
10
|
+
|
11
|
+
builder_with_block def transform(&block)
|
12
|
+
@transform_block = block
|
13
|
+
end
|
14
|
+
|
15
|
+
builder def real; @real = true; end
|
16
|
+
builder def computed; @real = false; end
|
17
|
+
|
18
|
+
builder def column; @type = :column; end
|
19
|
+
builder def record; @type = :record; end
|
20
|
+
builder def none; @type = :none; end
|
21
|
+
|
22
|
+
builder def ignore_nil; @ignore_nil = true; end
|
23
|
+
|
24
|
+
def build
|
25
|
+
Built.new(
|
26
|
+
real: @real,
|
27
|
+
type: @type,
|
28
|
+
ignore_nil: !!@ignore_nil,
|
29
|
+
&@transform_block
|
30
|
+
)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class Built
|
35
|
+
def initialize(real:, type:, ignore_nil:, &transform_block)
|
36
|
+
@real = real
|
37
|
+
@type = type
|
7
38
|
@ignore_nil = ignore_nil
|
39
|
+
@transform_block = transform_block
|
8
40
|
end
|
9
41
|
|
10
|
-
def
|
42
|
+
def real?; @real; end
|
43
|
+
attr_reader :type
|
44
|
+
|
45
|
+
def present(attribute_name, value = nil)
|
46
|
+
if @transform_block.nil?
|
47
|
+
if attribute_name
|
48
|
+
raise Error::ArgumentError, "Transformation block is not set for column: #{attribute_name}"
|
49
|
+
else
|
50
|
+
raise Error::ArgumentError, "Transformation block is not set!"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
11
54
|
return nil if value.nil? && @ignore_nil
|
12
55
|
|
13
|
-
@
|
56
|
+
if @type == :none
|
57
|
+
@transform_block.call
|
58
|
+
else
|
59
|
+
@transform_block.call(value)
|
60
|
+
end
|
14
61
|
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class Badge
|
65
|
+
extend Useful::Builder
|
15
66
|
|
16
|
-
def
|
17
|
-
|
67
|
+
def initialize(builder)
|
68
|
+
@builder = builder
|
69
|
+
@whens = {}
|
70
|
+
format_for_lookup(&:itself)
|
71
|
+
format_for_display(&:itself)
|
18
72
|
end
|
19
|
-
end
|
20
73
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
74
|
+
builder_with_block def when(*patterns, &block)
|
75
|
+
patterns.each do |pattern|
|
76
|
+
@whens[pattern] = block
|
77
|
+
end
|
25
78
|
end
|
26
79
|
|
27
|
-
def
|
28
|
-
|
80
|
+
builder_with_block def else(&block)
|
81
|
+
@else = block
|
29
82
|
end
|
30
83
|
|
31
|
-
def
|
32
|
-
@
|
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
|
33
102
|
end
|
34
103
|
end
|
35
104
|
|
@@ -38,33 +107,53 @@ module Super
|
|
38
107
|
@fields = fields
|
39
108
|
end
|
40
109
|
|
41
|
-
def
|
42
|
-
|
110
|
+
def real(type = :column, &transform_block)
|
111
|
+
TYPES
|
112
|
+
.case(type)
|
113
|
+
.when(:column) { Builder.new.real.ignore_nil.column.transform(&transform_block) }
|
114
|
+
.when(:record) { Builder.new.real.ignore_nil.record.transform(&transform_block) }
|
115
|
+
.when(:none) { Builder.new.real.ignore_nil.none.transform(&transform_block) }
|
116
|
+
.result
|
43
117
|
end
|
44
118
|
|
45
|
-
|
119
|
+
def computed(type = :column, &transform_block)
|
120
|
+
TYPES
|
121
|
+
.case(type)
|
122
|
+
.when(:column) { Builder.new.computed.ignore_nil.column.transform(&transform_block) }
|
123
|
+
.when(:record) { Builder.new.computed.ignore_nil.record.transform(&transform_block) }
|
124
|
+
.when(:none) { Builder.new.computed.ignore_nil.none.transform(&transform_block) }
|
125
|
+
.result
|
126
|
+
end
|
46
127
|
|
47
|
-
def
|
48
|
-
|
128
|
+
def manual(&transform_block)
|
129
|
+
real(:column, &transform_block)
|
49
130
|
end
|
50
131
|
|
132
|
+
def string; real(&:to_s); end
|
133
|
+
alias text string
|
134
|
+
|
135
|
+
def timestamp; real(&:to_s); end
|
136
|
+
def time; real { |value| value.strftime("%H:%M:%S") }; end
|
137
|
+
|
51
138
|
def rich_text
|
52
|
-
|
139
|
+
computed do |value|
|
53
140
|
Partial.new("display_rich_text", locals: { rich_text: value })
|
54
141
|
end
|
55
142
|
end
|
56
143
|
|
57
|
-
def
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
144
|
+
def badge(*builder_methods)
|
145
|
+
builder_methods = %i[real ignore_nil column] if builder_methods.empty?
|
146
|
+
builder = builder_methods.each_with_object(Builder.new) do |builder_method, builder|
|
147
|
+
builder.public_send(builder_method)
|
148
|
+
end
|
149
|
+
Badge.new(builder)
|
63
150
|
end
|
64
151
|
|
65
152
|
def actions
|
66
153
|
@actions_called = true
|
67
|
-
|
154
|
+
Builder.new.computed.none.transform do
|
155
|
+
Partial.new("display_actions")
|
156
|
+
end
|
68
157
|
end
|
69
158
|
|
70
159
|
# @private
|
data/lib/super/engine.rb
CHANGED
data/lib/super/error.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Super
|
2
4
|
# A container class for all internal errors thrown by this library
|
3
5
|
#
|
@@ -22,5 +24,15 @@ module Super
|
|
22
24
|
)
|
23
25
|
end
|
24
26
|
end
|
27
|
+
# Error raised when something wasn't initalized correctly, and if there isn't
|
28
|
+
# a more specific error
|
29
|
+
class Initalization < Error; end
|
30
|
+
class ArgumentError < Error; end
|
31
|
+
|
32
|
+
class Enum < Error
|
33
|
+
class ImpossibleValue < Enum; end
|
34
|
+
class ArgumentError < Enum; end
|
35
|
+
class UndefinedCase < Enum; end
|
36
|
+
end
|
25
37
|
end
|
26
38
|
end
|
data/lib/super/filter.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Super
|
2
4
|
class Filter
|
3
5
|
class FormObject
|
@@ -42,11 +44,10 @@ module Super
|
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
45
|
-
def initialize(model:,
|
47
|
+
def initialize(model:, params:, schema:)
|
46
48
|
@model = model
|
47
|
-
@url = url
|
48
|
-
@schema = schema
|
49
49
|
@params = params
|
50
|
+
@schema = schema
|
50
51
|
|
51
52
|
@form_fields = {}
|
52
53
|
end
|
@@ -57,15 +58,11 @@ module Super
|
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
60
|
-
def url
|
61
|
-
@url
|
62
|
-
end
|
63
|
-
|
64
61
|
def to_partial_path
|
65
62
|
"filter"
|
66
63
|
end
|
67
64
|
|
68
|
-
def
|
65
|
+
def apply_changes(relation)
|
69
66
|
each_field do |form_field|
|
70
67
|
next if form_field.specified_values.values.map(&:to_s).map(&:strip).all? { |specified_value| specified_value == "" }
|
71
68
|
next if !Super::Filter::Operator.registry.key?(form_field.op)
|
data/lib/super/filter/guesser.rb
CHANGED
data/lib/super/form.rb
CHANGED
data/lib/super/form/builder.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Super
|
2
4
|
class Form
|
3
5
|
# Example
|
@@ -56,6 +58,65 @@ module Super
|
|
56
58
|
@builder.check_box(attribute, options, checked_value, unchecked_value)
|
57
59
|
end
|
58
60
|
|
61
|
+
def date_flatpickr(attribute, options = {})
|
62
|
+
options, defaults = split_defaults(
|
63
|
+
options,
|
64
|
+
class: "super-input w-full",
|
65
|
+
data: {
|
66
|
+
controller: "flatpickr",
|
67
|
+
flatpickr_options_value: {
|
68
|
+
dateFormat: "Y-m-d",
|
69
|
+
}
|
70
|
+
}
|
71
|
+
)
|
72
|
+
options[:class] = join_classes(defaults[:class], options[:class])
|
73
|
+
options[:data] = defaults[:data].deep_merge(options[:data] || {})
|
74
|
+
options[:value] = @builder.object.public_send(attribute).presence&.iso8601
|
75
|
+
|
76
|
+
@builder.text_field(attribute, options)
|
77
|
+
end
|
78
|
+
|
79
|
+
def datetime_flatpickr(attribute, options = {})
|
80
|
+
options, defaults = split_defaults(
|
81
|
+
options,
|
82
|
+
class: "super-input w-full",
|
83
|
+
data: {
|
84
|
+
controller: "flatpickr",
|
85
|
+
flatpickr_options_value: {
|
86
|
+
enableSeconds: true,
|
87
|
+
enableTime: true,
|
88
|
+
dateFormat: "Z",
|
89
|
+
}
|
90
|
+
}
|
91
|
+
)
|
92
|
+
options[:class] = join_classes(defaults[:class], options[:class])
|
93
|
+
options[:data] = defaults[:data].deep_merge(options[:data] || {})
|
94
|
+
options[:value] = @builder.object.public_send(attribute).presence&.iso8601
|
95
|
+
|
96
|
+
@builder.text_field(attribute, options)
|
97
|
+
end
|
98
|
+
|
99
|
+
def time_flatpickr(attribute, options = {})
|
100
|
+
options, defaults = split_defaults(
|
101
|
+
options,
|
102
|
+
class: "super-input w-full",
|
103
|
+
data: {
|
104
|
+
controller: "flatpickr",
|
105
|
+
flatpickr_options_value: {
|
106
|
+
enableSeconds: true,
|
107
|
+
enableTime: true,
|
108
|
+
noCalendar: true,
|
109
|
+
dateFormat: "H:i:S",
|
110
|
+
}
|
111
|
+
}
|
112
|
+
)
|
113
|
+
options[:class] = join_classes(defaults[:class], options[:class])
|
114
|
+
options[:data] = defaults[:data].deep_merge(options[:data] || {})
|
115
|
+
options[:value] = @builder.object.public_send(attribute).presence&.strftime("%H:%M:%S")
|
116
|
+
|
117
|
+
@builder.text_field(attribute, options)
|
118
|
+
end
|
119
|
+
|
59
120
|
def password_field(attribute, options = {})
|
60
121
|
options, defaults = split_defaults(options, class: "super-input w-full")
|
61
122
|
options[:class] = join_classes(defaults[:class], options[:class])
|
@@ -73,25 +134,10 @@ module Super
|
|
73
134
|
def select(attribute, choices, options = {}, html_options = {}, &block)
|
74
135
|
options, defaults = split_defaults(options, include_blank: true)
|
75
136
|
options = defaults.merge(options)
|
76
|
-
html_options, html_defaults = split_defaults(html_options, class: "super-input super-input-select
|
137
|
+
html_options, html_defaults = split_defaults(html_options, class: "super-input super-input-select")
|
77
138
|
html_options[:class] = join_classes(html_defaults[:class], html_options[:class])
|
78
139
|
|
79
|
-
|
80
|
-
%(<div class="super-input-select">).html_safe,
|
81
|
-
@builder.select(attribute, choices, options, html_options, &block),
|
82
|
-
<<~HTML.html_safe,
|
83
|
-
<div class="super-input-select-icon text-blue-700">
|
84
|
-
<span class="h-4 w-4">
|
85
|
-
HTML
|
86
|
-
@template.render("super/feather/chevron_down"),
|
87
|
-
<<~HTML.html_safe,
|
88
|
-
</span>
|
89
|
-
</div>
|
90
|
-
HTML
|
91
|
-
%(</div>).html_safe,
|
92
|
-
]
|
93
|
-
|
94
|
-
@template.safe_join(parts)
|
140
|
+
@builder.select(attribute, choices, options, html_options, &block)
|
95
141
|
end
|
96
142
|
|
97
143
|
def submit(value = nil, options = {})
|
@@ -113,24 +159,60 @@ module Super
|
|
113
159
|
@template.content_tag(:div, class: "super-field-group", &block)
|
114
160
|
end
|
115
161
|
|
116
|
-
def check_box!(attribute, checked_value
|
162
|
+
def check_box!(attribute, checked_value: "1", unchecked_value: "0", label_text: nil, label: {}, field: {}, show_errors: true)
|
117
163
|
label[:super] ||= {}
|
118
164
|
label[:super] = { class: "select-none ml-1" }.merge(label[:super])
|
119
165
|
container do
|
120
166
|
compact_join([
|
121
167
|
"<div>".html_safe,
|
122
168
|
public_send(:check_box, attribute, field, checked_value, unchecked_value),
|
123
|
-
public_send(:label, attribute,
|
169
|
+
public_send(:label, attribute, label_text, label),
|
124
170
|
"</div>".html_safe,
|
125
171
|
show_errors && inline_errors(attribute),
|
126
172
|
])
|
127
173
|
end
|
128
174
|
end
|
129
175
|
|
130
|
-
def
|
176
|
+
def date_flatpickr!(attribute, label_text: nil, label: {}, field: {}, show_errors: true)
|
177
|
+
container do
|
178
|
+
compact_join([
|
179
|
+
public_send(:label, attribute, label_text, label),
|
180
|
+
%(<div class="mt-1">).html_safe,
|
181
|
+
public_send(:date_flatpickr, attribute, field),
|
182
|
+
show_errors && inline_errors(attribute),
|
183
|
+
%(</div>).html_safe,
|
184
|
+
])
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def datetime_flatpickr!(attribute, label_text: nil, label: {}, field: {}, show_errors: true)
|
189
|
+
container do
|
190
|
+
compact_join([
|
191
|
+
public_send(:label, attribute, label_text, label),
|
192
|
+
%(<div class="mt-1">).html_safe,
|
193
|
+
public_send(:datetime_flatpickr, attribute, field),
|
194
|
+
show_errors && inline_errors(attribute),
|
195
|
+
%(</div>).html_safe,
|
196
|
+
])
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def time_flatpickr!(attribute, label_text: nil, label: {}, field: {}, show_errors: true)
|
201
|
+
container do
|
202
|
+
compact_join([
|
203
|
+
public_send(:label, attribute, label_text, label),
|
204
|
+
%(<div class="mt-1">).html_safe,
|
205
|
+
public_send(:time_flatpickr, attribute, field),
|
206
|
+
show_errors && inline_errors(attribute),
|
207
|
+
%(</div>).html_safe,
|
208
|
+
])
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def password_field!(attribute, label_text: nil, label: {}, field: {}, show_errors: true)
|
131
213
|
container do
|
132
214
|
compact_join([
|
133
|
-
public_send(:label, attribute, label),
|
215
|
+
public_send(:label, attribute, label_text, label),
|
134
216
|
%(<div class="mt-1">).html_safe,
|
135
217
|
public_send(:password_field, attribute, field),
|
136
218
|
show_errors && inline_errors(attribute),
|
@@ -139,10 +221,10 @@ module Super
|
|
139
221
|
end
|
140
222
|
end
|
141
223
|
|
142
|
-
def rich_text_area!(attribute, label: {}, field: {}, show_errors: true)
|
224
|
+
def rich_text_area!(attribute, label_text: nil, label: {}, field: {}, show_errors: true)
|
143
225
|
container do
|
144
226
|
compact_join([
|
145
|
-
public_send(:label, attribute, label),
|
227
|
+
public_send(:label, attribute, label_text, label),
|
146
228
|
%(<div class="mt-1">).html_safe,
|
147
229
|
public_send(:rich_text_area, attribute, field),
|
148
230
|
show_errors && inline_errors(attribute),
|
@@ -151,10 +233,10 @@ module Super
|
|
151
233
|
end
|
152
234
|
end
|
153
235
|
|
154
|
-
def select!(attribute, collection, label: {}, field: {}, show_errors: true)
|
236
|
+
def select!(attribute, collection, label_text: nil, label: {}, field: {}, show_errors: true)
|
155
237
|
container do
|
156
238
|
compact_join([
|
157
|
-
public_send(:label, attribute, label),
|
239
|
+
public_send(:label, attribute, label_text, label),
|
158
240
|
%(<div class="mt-1">).html_safe,
|
159
241
|
public_send(:select, attribute, collection, field),
|
160
242
|
show_errors && inline_errors(attribute),
|
@@ -163,10 +245,10 @@ module Super
|
|
163
245
|
end
|
164
246
|
end
|
165
247
|
|
166
|
-
def text_field!(attribute, label: {}, field: {}, show_errors: true)
|
248
|
+
def text_field!(attribute, label_text: nil, label: {}, field: {}, show_errors: true)
|
167
249
|
container do
|
168
250
|
compact_join([
|
169
|
-
public_send(:label, attribute, label),
|
251
|
+
public_send(:label, attribute, label_text, label),
|
170
252
|
%(<div class="mt-1">).html_safe,
|
171
253
|
public_send(:text_field, attribute, field),
|
172
254
|
show_errors && inline_errors(attribute),
|