pxs-forms 0.1.4.5 → 0.1.4.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33bf292b7c6408633a350ab9fcb2efe78c31fb2dd060a979862f734c19ac3511
4
- data.tar.gz: e38fbcd56c953fdcdcdb1b4534a46967943af9b5ef4ecff5cd12ba193a064e54
3
+ metadata.gz: 7956ffdc7dc1d10c99adc67c23a15cb7ee8150e24dfc7d1227f28043181ff01d
4
+ data.tar.gz: '0822906496a3ebb5009b6fa23ffd2cedafada5361b9a8fdec611f9b06ec3d70e'
5
5
  SHA512:
6
- metadata.gz: 419b5fcc8ad1c2ef1e3328d847553db33ee1368fcd70a2f35439c234ebf77b939661cea081b3edaeab5ef26bc4fb9baae5c2331620a212762634005be9c9c94a
7
- data.tar.gz: af034fa3f7a8daf08b609edff870f54e200e49513fcb55489b220d616400356be3662a9887bd9ab7d4bd313e249681c6c4bf2ba44ba893bce1f2e04ce9a86618
6
+ metadata.gz: 66e0c3cd7c14b728ff546c59151bd18bc222b17df221ea04bcab5c04d98a3c9d5760bb724d84475399b9e8db80f0911c2e19720e6e9e366c7be8a7b7262baea1
7
+ data.tar.gz: ba261e5ea8096abb5f5ebcfc6561ddc7555895198795f22e9b562831c597af5920057137dc4f30b065cd8a2466dd44be984a72a0ed49092a51b04750895faaa4
data/CHANGELOG.md CHANGED
@@ -2,11 +2,17 @@
2
2
 
3
3
  ## Unofficial Release
4
4
 
5
- ## [0.1.4.3-5] - 2025-04-03
5
+ ## [0.1.4.7] - 2025-04-08
6
+
7
+ - Fix string input not properly invoking string field
8
+ - Fix date field showing a rendundant date select
9
+
10
+ ## [0.1.4.3-6] - 2025-04-03
6
11
 
7
12
  - Fix I18n missing from a I18n.t function call
8
13
  - Fix incorrect field name for association subform
9
14
  - Fix explicit label not displayed in select fields
15
+ - Add :title option for select_or_create association subform
10
16
 
11
17
  ## [0.1.4] - 2025-04-01
12
18
 
@@ -4,6 +4,9 @@ module Pxs
4
4
 
5
5
  def initialize
6
6
  end
7
+
8
+ #todo configuration ideas:
9
+ # use models_helper buttons?
7
10
  end
8
11
  end
9
12
  end
@@ -58,7 +58,7 @@ class ModelFormBuilder < ActionView::Helpers::FormBuilder
58
58
  def association_select_or_create_subform(association, options = {})
59
59
 
60
60
  # assert that the options hash passed contains only valid keys
61
- options.assert_valid_keys(:add, :select, :collection)
61
+ options.assert_valid_keys(:add, :select, :collection, :title)
62
62
  # merge with the default options
63
63
  options = association_select_or_create_subform_options(association).merge(options)
64
64
 
@@ -78,13 +78,13 @@ class ModelFormBuilder < ActionView::Helpers::FormBuilder
78
78
 
79
79
  safe_join [
80
80
  # subform title, acting as the field label
81
- @template.tag.h3(association.to_s.humanize, id: model_html_id(association, :title)),
81
+ @template.tag.h3(options[:title] || association.to_s.humanize, id: model_html_id(association, :title)),
82
82
  # a select input, to choose an existing model
83
- field("#{association.to_s}_id", collection: collection, text_method: options[:select][:text_method], value_method: options[:select][:value_method]),
83
+ field("#{association.to_s}_id", collection: collection, text_method: options[:select][:text_method], value_method: options[:select][:value_method], label: options[:select][:label]),
84
84
  # an empty "client-form" ID div, to be filled with the subform fields once expanded
85
85
  @template.tag.div(id: model_html_id(association, :form)),
86
86
  # an "Add Client" button, to expand the subform when clicked in order to allow the user to create a new submodel alongside the original model
87
- @template.link_to(options[:add][:label], options[:add][:path], class: "button", id: model_button_id(association, :new), data: { turbo_stream: true }),
87
+ @template.link_to(options[:add][:label], options[:add][:path], class: "button#{options[:add][:class] ? " #{options[:add][:class]}" : ""}", id: model_button_id(association, :new), data: { turbo_stream: true }),
88
88
  # A `cancel` button to close the subform, initially hidden
89
89
  cancel_form_button(association)
90
90
  ]
@@ -188,7 +188,7 @@ class ModelFormBuilder < ActionView::Helpers::FormBuilder
188
188
 
189
189
  safe_join [
190
190
  (field_label(attribute, options[:label]) unless options[:label] == false),
191
- @template.text_field(base_input_name, attribute, merge_input_options({class: has_error?(attribute) ? "is-invalid" : nil}, objectify_options(options[:input_html] || {}))),
191
+ string_field(attribute, merge_input_options({class: has_error?(attribute) ? "is-invalid" : nil}, objectify_options(options[:input_html] || {}))),
192
192
  ]
193
193
  end
194
194
  end
@@ -296,16 +296,7 @@ class ModelFormBuilder < ActionView::Helpers::FormBuilder
296
296
  options = { value: object[attribute] }.merge(options)
297
297
  case object_type_for_attribute(attribute)
298
298
  when :date then
299
- safe_join [
300
- @template.date_field(base_input_name, attribute, merge_input_options(options, {data: {datepicker: true}})),
301
- tag.div {
302
- date_select(attribute, {
303
- order: [:year, :month, :day],
304
- start_year: Date.today.year,
305
- end_year: Date.today.year,
306
- }, {data: {date_select: true}})
307
- },
308
- ]
299
+ @template.date_field(base_input_name, attribute, merge_input_options(options, {data: {datepicker: true}}))
309
300
  when :integer then @template.number_field(base_input_name, attribute, options)
310
301
  when :decimal then @template.number_field(base_input_name, attribute, {step: 0.1}.merge(options))
311
302
  when :string
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Pxs
4
4
  module Forms
5
- VERSION = "0.1.4.5"
5
+ VERSION = "0.1.4.7"
6
6
  end
7
7
  end
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.1.4.5
4
+ version: 0.1.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Poubelle
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-04-03 00:00:00.000000000 Z
11
+ date: 2025-04-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: