pxs-forms 0.0.19 → 0.0.21
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/lib/pxs/forms/model_form_builder.rb +19 -16
- data/lib/pxs/forms/models_helper.rb +1 -1
- data/lib/pxs/forms/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed122aca21c3e0ffba66cb2c40b2d367b282d2bdd81dc808a02c4180de755be0
|
4
|
+
data.tar.gz: cd9dd4c71b2fa36a0479c04a5a88875d96e2e2ce390642c8899dc00e099a3fbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efbcf39cf0fba58b2273b906d2933bab6352def09ea1d0284efd08f9408eddcc571c4e2c53aecf70c5f2453170c165c363c20ab839341190361fdcd594ab0410
|
7
|
+
data.tar.gz: 07ea4ad16f6ff6076e99f7ac3a804a554f59c202d7a090252bf3c6c07eccaea2aca3cd2c1c51dbdcec03f921f1beb4cfe15c446663ae128ab6b11b9c0d0bdac6
|
@@ -2,6 +2,9 @@ class ModelFormBuilder < ActionView::Helpers::FormBuilder
|
|
2
2
|
|
3
3
|
delegate :tag, :safe_join, to: :@template
|
4
4
|
|
5
|
+
include Pxs::Forms::ModelsHelper
|
6
|
+
include Pxs::Forms::LinksHelper
|
7
|
+
|
5
8
|
attr_reader :input_name_prefix, :input_id_prefix
|
6
9
|
|
7
10
|
def initialize(object_name, object, template, options, input_name_prefix = nil, input_id_prefix = nil)
|
@@ -185,7 +188,7 @@ class ModelFormBuilder < ActionView::Helpers::FormBuilder
|
|
185
188
|
|
186
189
|
safe_join [
|
187
190
|
(field_label(attribute, options[:label]) unless options[:label] == false),
|
188
|
-
|
191
|
+
@template.text_field(base_input_name, attribute, merge_input_options({class: "#{"is-invalid" if has_error?(attribute)}"}, options[:input_html])),
|
189
192
|
]
|
190
193
|
end
|
191
194
|
end
|
@@ -202,7 +205,7 @@ class ModelFormBuilder < ActionView::Helpers::FormBuilder
|
|
202
205
|
field_block(attribute, options) do
|
203
206
|
safe_join [
|
204
207
|
(field_label(attribute, options[:label]) unless options[:label] == false),
|
205
|
-
text_area(base_input_name, attribute, merge_input_options({class: "#{"is-invalid" if has_error?(attribute)}", value: object[attribute]}, options[:input_html])),
|
208
|
+
@template.text_area(base_input_name, attribute, merge_input_options({class: "#{"is-invalid" if has_error?(attribute)}", value: object[attribute]}, options[:input_html])),
|
206
209
|
]
|
207
210
|
end
|
208
211
|
end
|
@@ -211,8 +214,8 @@ class ModelFormBuilder < ActionView::Helpers::FormBuilder
|
|
211
214
|
field_block(attribute, options) do
|
212
215
|
tag.div(class: "checkbox-field") do
|
213
216
|
safe_join [
|
214
|
-
check_box(base_input_name, attribute, merge_input_options({class: "checkbox-input"}, options[:input_html])),
|
215
|
-
label(base_input_name, attribute, options[:label], class: "checkbox-label"),
|
217
|
+
@template.check_box(base_input_name, attribute, merge_input_options({class: "checkbox-input"}, options[:input_html])),
|
218
|
+
@template.label(base_input_name, attribute, options[:label], class: "checkbox-label"),
|
216
219
|
]
|
217
220
|
end
|
218
221
|
end
|
@@ -221,7 +224,7 @@ class ModelFormBuilder < ActionView::Helpers::FormBuilder
|
|
221
224
|
def collection_input(attribute, options, &block)
|
222
225
|
field_block(attribute, options) do
|
223
226
|
safe_join [
|
224
|
-
options[:label] ? nil : label(object.class.to_s.underscore.downcase.to_sym, attribute, options[:label] || object.class.human_attribute_name(attribute)),
|
227
|
+
options[:label] ? nil : @template.label(object.class.to_s.underscore.downcase.to_sym, attribute, options[:label] || object.class.human_attribute_name(attribute)),
|
225
228
|
block.call,
|
226
229
|
]
|
227
230
|
end
|
@@ -241,7 +244,7 @@ class ModelFormBuilder < ActionView::Helpers::FormBuilder
|
|
241
244
|
|
242
245
|
safe_join [
|
243
246
|
collection_input(attribute, options) do
|
244
|
-
collection_select(object.class.model_name.singular.to_sym, attribute, options[:collection], value_method, text_method, {selected: object[attribute]}.merge(options[:select] || {}), merge_input_options({class: "#{"custom-select" unless multiple} #{"is-invalid" if has_error?(attribute)}"}, options[:input_html]))
|
247
|
+
@template.collection_select(object.class.model_name.singular.to_sym, attribute, options[:collection], value_method, text_method, {selected: object[attribute]}.merge(options[:select] || {}), merge_input_options({class: "#{"custom-select" unless multiple} #{"is-invalid" if has_error?(attribute)}"}, options[:input_html]))
|
245
248
|
end
|
246
249
|
]
|
247
250
|
end
|
@@ -258,7 +261,7 @@ class ModelFormBuilder < ActionView::Helpers::FormBuilder
|
|
258
261
|
field_block(attribute, options) do
|
259
262
|
safe_join [
|
260
263
|
(field_label(attribute, options[:label]) unless options[:label] == false),
|
261
|
-
custom_file_field(base_input_name, attribute, options),
|
264
|
+
@template.custom_file_field(base_input_name, attribute, options),
|
262
265
|
]
|
263
266
|
end
|
264
267
|
end
|
@@ -293,7 +296,7 @@ class ModelFormBuilder < ActionView::Helpers::FormBuilder
|
|
293
296
|
case object_type_for_attribute(attribute)
|
294
297
|
when :date then
|
295
298
|
safe_join [
|
296
|
-
date_field(base_input_name, attribute, merge_input_options(options, {data: {datepicker: true}})),
|
299
|
+
@template.date_field(base_input_name, attribute, merge_input_options(options, {data: {datepicker: true}})),
|
297
300
|
tag.div {
|
298
301
|
date_select(attribute, {
|
299
302
|
order: [:year, :month, :day],
|
@@ -302,18 +305,18 @@ class ModelFormBuilder < ActionView::Helpers::FormBuilder
|
|
302
305
|
}, {data: {date_select: true}})
|
303
306
|
},
|
304
307
|
]
|
305
|
-
when :integer then number_field(base_input_name, attribute, options)
|
306
|
-
when :decimal then number_field(base_input_name, attribute, {step: 0.1}.merge(options))
|
308
|
+
when :integer then @template.number_field(base_input_name, attribute, options)
|
309
|
+
when :decimal then @template.number_field(base_input_name, attribute, {step: 0.1}.merge(options))
|
307
310
|
when :string
|
308
311
|
case attribute.to_s
|
309
|
-
when /password/ then password_field(base_input_name, attribute, options)
|
312
|
+
when /password/ then @template.password_field(base_input_name, attribute, options)
|
310
313
|
# when /time_zone/ then :time_zone
|
311
314
|
# when /country/ then :country
|
312
|
-
when /email/ then email_field(base_input_name, attribute, options)
|
313
|
-
when /phone/ then telephone_field(base_input_name, attribute, options)
|
314
|
-
when /url/ then url_field(base_input_name, attribute, options)
|
315
|
+
when /email/ then @template.email_field(base_input_name, attribute, options)
|
316
|
+
when /phone/ then @template.telephone_field(base_input_name, attribute, options)
|
317
|
+
when /url/ then @template.url_field(base_input_name, attribute, options)
|
315
318
|
else
|
316
|
-
text_field(base_input_name, attribute, options)
|
319
|
+
@template.text_field(base_input_name, attribute, options)
|
317
320
|
end
|
318
321
|
end
|
319
322
|
end
|
@@ -329,7 +332,7 @@ class ModelFormBuilder < ActionView::Helpers::FormBuilder
|
|
329
332
|
end
|
330
333
|
|
331
334
|
def field_label(attribute, options = {})
|
332
|
-
label(object.class.model_name.singular_route_key.kebabcase.to_sym, I18n.t("activerecord.attributes.#{object.class.model_name.singular}.#{attribute}", default: attribute), options)
|
335
|
+
@template.label(object.class.model_name.singular_route_key.kebabcase.to_sym, I18n.t("activerecord.attributes.#{object.class.model_name.singular}.#{attribute}", default: attribute), options)
|
333
336
|
end
|
334
337
|
|
335
338
|
def hint_text(text)
|
data/lib/pxs/forms/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pxs-forms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Poubelle
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|