view_component-form 0.2.0 → 0.2.3

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: 72d1e925f6501a2af4458ca669c87bd9a947173fc4766ec4e72c466f794c649a
4
- data.tar.gz: 6c8be1d09936f2ba0de85be506419472bbe84d9901628cbcbb4ea3f90c21b21f
3
+ metadata.gz: 46ae76cd3c5205d98673495e26d1c654441054c297bd4d63abe9ca8f1180cc5c
4
+ data.tar.gz: dd2286deed5dce2a7f7198a09977d17b8744c6e4952276e855c1a4d838ad3385
5
5
  SHA512:
6
- metadata.gz: 524c3595df4a9891f036584ab79590a8bf2547c32cf74220fe6276ff3c3b6027e14b148ba558151513592a372e29c6ae0f9562c9ae23715500567a34e73c7b05
7
- data.tar.gz: 20c3af9cacc78f509a3d10371ab117c6ec6e766ffd1fa418efce9fc0ac4eb87b5a751b4ec0d24a6aab4a0f2f0bc741a97b5064956ee34bfa822ab219e3a46964
6
+ metadata.gz: 7b391f6b0196c04a6db7c10c71745747a895ec4f7553c87a0ddcd68126e4897ebb979b70e8e81bb9c772a5c5f9cf0a50a65094ec5967853b6364f785a8676911
7
+ data.tar.gz: 3efda4bbf9ce7e6a08f71d5f1e1025124a163d0d373e62087ba374f7e7d311bf2907dfd43bc33e14e1a821e24d0c42f7244a25a42232e71bd5503e7016204886
data/CHANGELOG.md CHANGED
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
  ## [Unreleased]
8
8
  Nothing yet
9
9
 
10
+ ## [0.2.3] - 2022-03-24
11
+ ### Fixed
12
+ - Declare empty RichTextAreaComponent if ActionText is not installed, to fix Zeitwerk error (#120)
13
+
14
+ ## [0.2.2] - 2022-03-23
15
+ ### Changed
16
+ - Improve conditional ActionText support (#118)
17
+
18
+ ## [0.2.1] - 2022-03-17
19
+ ### Added
20
+ - Conditional ActionText support (#117)
21
+
22
+ ### Fixed
23
+ - Fix broken gem initialization due to missing ViewComponent::Form constant (#114)
24
+ - Initialize empty WeekdaySelectComponent if Rails < 7 to fix Zeitwerk error (#115)
25
+
10
26
  ## [0.2.0] - 2022-03-02
11
27
  ### Added
12
28
  - Test BuilderGenerator with generator\_spec (#64)
@@ -65,7 +81,10 @@ Nothing yet
65
81
  - Add CHANGELOG (#50)
66
82
  - Add CI (#2)
67
83
 
68
- [Unreleased]: https://github.com/pantographe/view_component-form/compare/v0.2.0...HEAD
84
+ [Unreleased]: https://github.com/pantographe/view_component-form/compare/v0.2.3...HEAD
85
+ [0.2.3]: https://github.com/pantographe/view_component-form/compare/v0.2.2...v0.2.3
86
+ [0.2.2]: https://github.com/pantographe/view_component-form/compare/v0.2.1...v0.2.2
87
+ [0.2.1]: https://github.com/pantographe/view_component-form/compare/v0.2.0...v0.2.1
69
88
  [0.2.0]: https://github.com/pantographe/view_component-form/compare/v0.1.3...v0.2.0
70
89
  [0.1.3]: https://github.com/pantographe/view_component-form/compare/v0.1.2...v0.1.3
71
90
  [0.1.2]: https://github.com/pantographe/view_component-form/compare/v0.1.1...v0.1.2
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  ## Compatibility
8
8
 
9
9
  This gem is tested on:
10
- - Rails 6.0+
10
+ - Rails 6.0+ (with or without ActionText)
11
11
  - Ruby 2.7+
12
12
 
13
13
  ## Installation
@@ -3,7 +3,9 @@
3
3
  module ViewComponent
4
4
  module Form
5
5
  class RichTextAreaComponent < FieldComponent
6
- self.tag_klass = ActionView::Helpers::Tags::ActionText
6
+ if defined?(ActionView::Helpers::Tags::ActionText) # rubocop:disable Style/IfUnlessModifier
7
+ self.tag_klass = ActionView::Helpers::Tags::ActionText
8
+ end
7
9
  end
8
10
  end
9
11
  end
@@ -1,20 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- if Rails::VERSION::MAJOR >= 7
4
- module ViewComponent
5
- module Form
6
- class WeekdaySelectComponent < FieldComponent
7
- attr_reader :html_options
3
+ module ViewComponent
4
+ module Form
5
+ class WeekdaySelectComponent < FieldComponent
6
+ attr_reader :html_options
8
7
 
9
- def initialize(form, object_name, method_name, options = {}, html_options = {})
10
- @html_options = html_options
8
+ def initialize(form, object_name, method_name, options = {}, html_options = {})
9
+ @html_options = html_options
11
10
 
12
- super(form, object_name, method_name, options)
11
+ super(form, object_name, method_name, options)
13
12
 
14
- set_html_options!
15
- end
13
+ set_html_options!
14
+ end
16
15
 
17
- def call
16
+ def call # rubocop:disable Metrics/MethodLength
17
+ if Rails::VERSION::MAJOR >= 7 # rubocop:disable Style/GuardClause
18
18
  ActionView::Helpers::Tags::WeekdaySelect.new(
19
19
  object_name,
20
20
  method_name,
@@ -22,14 +22,16 @@ if Rails::VERSION::MAJOR >= 7
22
22
  options,
23
23
  html_options
24
24
  ).render
25
+ else
26
+ raise NotImplementedError, "#{self.class} is only available in Rails >= 7"
25
27
  end
28
+ end
26
29
 
27
- protected
30
+ protected
28
31
 
29
- def set_html_options!
30
- @html_options[:class] = class_names(html_options[:class], html_class)
31
- @html_options.delete(:class) if @html_options[:class].blank?
32
- end
32
+ def set_html_options!
33
+ @html_options[:class] = class_names(html_options[:class], html_class)
34
+ @html_options.delete(:class) if @html_options[:class].blank?
33
35
  end
34
36
  end
35
37
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ViewComponent
4
4
  module Form
5
- VERSION = "0.2.0"
5
+ VERSION = "0.2.3"
6
6
  end
7
7
  end
@@ -3,6 +3,11 @@
3
3
  require "view_component"
4
4
  require "zeitwerk"
5
5
 
6
+ module ViewComponent
7
+ module Form
8
+ end
9
+ end
10
+
6
11
  loader = Zeitwerk::Loader.for_gem
7
12
  form = "#{__dir__}/form.rb"
8
13
  loader.ignore(form)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: view_component-form
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pantographe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-02 00:00:00.000000000 Z
11
+ date: 2022-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview