plutonium 0.18.6 → 0.18.8

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: 29c84a287fe81867ece4bbdb809ae3e82f3a2213b219348035f06f86a847b784
4
- data.tar.gz: f71dd45419acf91c4ca42e0e005da7044bc06f94a8e7bee63cf075821b71aea4
3
+ metadata.gz: db09e7efd9881620723c20ca5a7ca66da36abc10f6eaa11cdf35e0b02b2202e4
4
+ data.tar.gz: e03d61dda513fc33bf487179e55bcacfdd1964197c9eb4559ffb68ed1644b28b
5
5
  SHA512:
6
- metadata.gz: 7a94d70626e1b057011ccaaf16603fa23d64f76aaa5f39a2bc3e50bb686331de414b62580de807457762d9f6e793d770647892f5256225a196dac2f491ba281e
7
- data.tar.gz: 551f2ced50e6c65723b50c44465bd25cbff1f8686030ddf9651c0681e936f5bd284b2a50414bc7de773d0c55be4b6de924bc4ba41da6dc153f983dd8698e43e1
6
+ metadata.gz: 8cb1f9b6bc8ad83001cd8a70ce9a56d62d47a20a88fe10c32292866075b24759c402444920f6ec0000b3f12f08e79cb66a39f305d30ebc1e3ba015e2de680643
7
+ data.tar.gz: a04dc1fd9bf280c1574a3c1c71a1da9de2a6474a514f6cc1503c214250d40d5ef2a6350205906ddbac9ee497b73beef84095662d9222f1805b7254e6560205eb
@@ -143,8 +143,10 @@ module Plutonium
143
143
  #
144
144
  # @param value [Numeric, nil] The decimal value to be set.
145
145
  def #{name}=(value)
146
- self.#{cents_name} = if value.present?
147
- (BigDecimal(value.to_s) * #{rate}).to_i
146
+ self.#{cents_name} = begin
147
+ (BigDecimal(value.to_s) * #{rate}).to_i if value.present?
148
+ rescue ArgumentError
149
+ nil
148
150
  end
149
151
  end
150
152
 
@@ -7,6 +7,8 @@ module Plutonium
7
7
  include Plutonium::UI::Component::Behaviour
8
8
 
9
9
  class Builder < Builder
10
+ include Plutonium::UI::Display::Options::InferredTypes
11
+
10
12
  def association_tag(**, &)
11
13
  create_component(Plutonium::UI::Display::Components::Association, :association, **, &)
12
14
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Plutonium
4
+ module UI
5
+ module Display
6
+ module Options
7
+ module InferredTypes
8
+ private
9
+
10
+ def infer_field_component
11
+ case inferred_field_type
12
+ when :attachment
13
+ :attachment
14
+ else
15
+ super
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -32,6 +32,7 @@ module Plutonium
32
32
  create_component(Components::Uppy, :uppy, **, &)
33
33
  end
34
34
  alias_method :file_tag, :uppy_tag
35
+ alias_method :attachment_tag, :uppy_tag
35
36
 
36
37
  def secure_association_tag(**attributes, &)
37
38
  attributes[:data_controller] = tokens(attributes[:data_controller], "slim-select") # TODO: put this behind a config
@@ -1,5 +1,5 @@
1
1
  module Plutonium
2
- VERSION = "0.18.6"
2
+ VERSION = "0.18.8"
3
3
  NEXT_MAJOR_VERSION = VERSION.split(".").tap { |v|
4
4
  v[1] = v[1].to_i + 1
5
5
  v[2] = 0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plutonium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.6
4
+ version: 0.18.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Froelich
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-03 00:00:00.000000000 Z
11
+ date: 2025-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk
@@ -814,6 +814,7 @@ files:
814
814
  - lib/plutonium/ui/display/components/association.rb
815
815
  - lib/plutonium/ui/display/components/attachment.rb
816
816
  - lib/plutonium/ui/display/components/markdown.rb
817
+ - lib/plutonium/ui/display/options/inferred_types.rb
817
818
  - lib/plutonium/ui/display/resource.rb
818
819
  - lib/plutonium/ui/display/theme.rb
819
820
  - lib/plutonium/ui/dyna_frame/content.rb