sdr_view_components 0.1.10 → 0.1.11

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: 296ea41f2742301fbcbfe4e4997327a0a88f9062789f0e987298b023704695b8
4
- data.tar.gz: b763fa492037241155bb55464d27437d3316df043b3c8cafc86e4e72d51f29a8
3
+ metadata.gz: 01f608d9c6fecfed05ce1ff741a7225fc78b1838f3b6e76d59288ae635543cb7
4
+ data.tar.gz: 7bc2e6168f24571747fcf66e178561603c7aacd3814a7f0b5913df093eb113fc
5
5
  SHA512:
6
- metadata.gz: fed14277e8b2afcc9e8a2ba17dcd7b42cf44c1396b7b93aa2b0ef90a6880de1eb43840f87fa308a1eeea3c4431be25e75969bccfd0cb384cef88a488c3912f31
7
- data.tar.gz: f0b094384fa97b827ccd899fe40e3deb03cdf180ff9165ca2cc78dba1b8dd35d60c4a1fd19e71e79b7cc36b8d1f0022eca271b469a0509bb9211268fa638f5c3
6
+ metadata.gz: cba3c38d743396ec1efedb31b03a778a84e4f235c1bab770ddae879331d71df70fbc75ae76122fa2227bf356322f11d301da4f99d55ea92557169d23ebe52387
7
+ data.tar.gz: fcb96d3f1d3e9a94355e25934b550f710b35fc43264dc7af89fe74a480a1bd1923380b2b3c36b29eb7e79413ce14fae7b5df00c8bf2cda819f412cec09ac2ad4
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SdrViewComponents
4
+ module Elements
5
+ # Component for a button that is wrapped in a form
6
+ class ButtonFormComponent < BaseComponent
7
+ def initialize(link:, label: nil, variant: :primary, classes: [], method: :get, confirm: nil, # rubocop:disable Metrics/ParameterLists
8
+ top: true, data: {})
9
+ @link = link
10
+ @label = label
11
+ @variant = variant
12
+ @classes = classes
13
+ @method = method
14
+ @confirm = confirm
15
+ @top = top
16
+ @data = data
17
+ super()
18
+ end
19
+
20
+ attr_reader :link
21
+
22
+ def call
23
+ button_to(link, method: @method,
24
+ class: ComponentSupport::ButtonSupport.classes(variant: @variant, classes:),
25
+ form: { data: }) do
26
+ @label || content
27
+ end
28
+ end
29
+
30
+ def classes
31
+ merge_classes(@classes)
32
+ end
33
+
34
+ def data
35
+ @data.tap do |data|
36
+ data[:turbo_frame] = '_top' if @top
37
+ data[:turbo_confirm] = @confirm if @confirm
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrViewComponents
4
- VERSION = '0.1.10'
4
+ VERSION = '0.1.11'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdr_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Collier
@@ -75,6 +75,7 @@ files:
75
75
  - app/components/sdr_view_components/elements/breadcrumb_nav_component.html.erb
76
76
  - app/components/sdr_view_components/elements/breadcrumb_nav_component.rb
77
77
  - app/components/sdr_view_components/elements/button_component.rb
78
+ - app/components/sdr_view_components/elements/button_form_component.rb
78
79
  - app/components/sdr_view_components/elements/button_link_component.rb
79
80
  - app/components/sdr_view_components/elements/navigation/dropdown_menu_component.html.erb
80
81
  - app/components/sdr_view_components/elements/navigation/dropdown_menu_component.rb