phlex-rails 1.0.0 → 1.1.1

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: 7b847ffd983ba4161668179eb395ccbfd50ee216892ffb7124bdacaa584a9e0a
4
- data.tar.gz: e34aa3c4e6053b913f09f325ce11e16e6152afed5fecd18857a3ee634a735034
3
+ metadata.gz: c4a2327429781bd723b011ea5fe05007feca4a608214ddd3c461cc2685cf8742
4
+ data.tar.gz: 856d741f12167f40769a271f2a61259f46773c95ab874bce7d169364f34e8d8a
5
5
  SHA512:
6
- metadata.gz: e955615cd2b7ac990742dd35028d524f74f8f05f0799ede53f793435344d1b3c7db6b99c87fb2f3fedef50f016f53d7f3cf32070ab7894be1b86c734b93cca76
7
- data.tar.gz: 675126fe1bc74b22ee7ec284f0048ca4051a4fb3ea863fe916c8c48c745ca1ea431ed84569fda5d6b9ce046a58fd67f3b11f3e78bab25f4496074fc7e55d8e8a
6
+ metadata.gz: c38fba4634834613a6a72e9811361749f63d2d056c8b8b7cd6b8a08c04f2a04dda95146dc5ec013bcfac9453287402da583435a018fd3becf7e14deba29ccf5c
7
+ data.tar.gz: aeb62a44768d06817370f9a169807a7bf7e718f516a866fb017d90b10b9ad3942e51cdcbda3ae3f22b2397b7a925fb1b3507e1603737edf53ade9fbc75e16c1e
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.1
1
+ 3.2.2
data/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
4
 
5
+
6
+ # [1.1.1] 2023-11-27
7
+
8
+ - Fixed a bug where Phlex would try to capture `nil` when rendered from ActionView without a block.
9
+
10
+ ## [1.1.0] 2023-11-24
11
+
12
+ - Dropped dependency on `rails` and now only depends on `railties`
13
+ - Fix an out of order rendering issue when yielding from a partial rendered with a block delegated from a component’s content block
14
+ - Added `flash` helper adapter in `Phlex::Rails::Helpers::Flash`
15
+ - Removed experimental form component
16
+ - Updated `phlex` dependency to `~> 1.9`
17
+
5
18
  ## [1.0.0] 2023-04-19
6
19
 
7
20
  ### Added
@@ -22,4 +35,4 @@ All notable changes to this project will be documented in this file. The format
22
35
 
23
36
  ***
24
37
 
25
- Before this changelog was introduced, changes were logged in the [release notes](https://github.com/phlex-ruby/phlex/releases).
38
+ Before this changelog was introduced, changes were logged in the [release notes](https://github.com/phlex-ruby/phlex-rails/releases).
data/Gemfile CHANGED
@@ -7,10 +7,13 @@ gemspec
7
7
 
8
8
  gem "phlex", github: "phlex-ruby/phlex"
9
9
  gem "phlex-testing-capybara", github: "phlex-ruby/phlex-testing-capybara"
10
- gem "rspec-rails"
11
10
  gem "combustion"
12
11
  gem "rubocop"
13
12
  gem "solargraph"
14
13
  gem "view_component"
15
14
  gem "appraisal", github: "excid3/appraisal", branch: "fix-bundle-env"
16
15
  gem "yard"
16
+
17
+ # Ensure rails is loaded before rspec-rails.
18
+ gem "rails"
19
+ gem "rspec-rails"
@@ -14,6 +14,7 @@ module Phlex::Rails
14
14
  :to_partial_path,
15
15
  :options,
16
16
  :id,
17
+ :is_a?,
17
18
  :field_helpers,
18
19
  :multipart=,
19
20
  :field_name,
@@ -465,6 +465,13 @@ module Phlex::Rails::Helpers
465
465
  define_output_helper :file_field_tag
466
466
  end
467
467
 
468
+ module Flash
469
+ extend Phlex::Rails::HelperMacros
470
+
471
+ # @!method flash(...)
472
+ define_value_helper :flash
473
+ end
474
+
468
475
  module FontPath
469
476
  extend Phlex::Rails::HelperMacros
470
477
 
@@ -23,7 +23,8 @@ module Phlex
23
23
  when Enumerable
24
24
  return super unless renderable.is_a?(ActiveRecord::Relation)
25
25
  else
26
- @_context.target << @_view_context.render(*args, **kwargs, &block)
26
+ captured_block = -> { capture(&block) } if block
27
+ @_context.target << @_view_context.render(*args, **kwargs, &captured_block)
27
28
  end
28
29
 
29
30
  nil
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Phlex
4
4
  module Rails
5
- VERSION = "1.0.0"
5
+ VERSION = "1.1.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Drapper
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-19 00:00:00.000000000 Z
11
+ date: 2023-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phlex
@@ -16,16 +16,16 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: '1.9'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.7'
26
+ version: '1.9'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rails
28
+ name: railties
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -105,7 +105,6 @@ files:
105
105
  - lib/phlex/rails/buffered_label_builder.rb
106
106
  - lib/phlex/rails/buffered_radio_button_builder.rb
107
107
  - lib/phlex/rails/engine.rb
108
- - lib/phlex/rails/form.rb
109
108
  - lib/phlex/rails/helper_macros.rb
110
109
  - lib/phlex/rails/helpers.rb
111
110
  - lib/phlex/rails/helpers/routes.rb
@@ -144,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
143
  - !ruby/object:Gem::Version
145
144
  version: '0'
146
145
  requirements: []
147
- rubygems_version: 3.4.6
146
+ rubygems_version: 3.4.10
148
147
  signing_key:
149
148
  specification_version: 4
150
149
  summary: A Phlex adapter for Rails
@@ -1,68 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Phlex
4
- module Rails
5
- # @api private
6
- class Form < Phlex::HTML
7
- def initialize(model)
8
- @model = model
9
- end
10
-
11
- def self.input_field(method_name, type:)
12
- define_method method_name do |field, value: @model.attributes[field.to_s], **attributes|
13
- input(
14
- name: field_name(field),
15
- type: type,
16
- value: value,
17
- **attributes
18
- )
19
- end
20
- end
21
-
22
- def template(&block)
23
- form action: @url, method: @method do
24
- authenticity_token_field
25
- yield_content(&block)
26
- end
27
- end
28
-
29
- def authenticity_token_field
30
- input(
31
- name: "authenticity_token",
32
- type: "hidden",
33
- value: helpers.form_authenticity_token
34
- )
35
- end
36
-
37
- def submit(value)
38
- input(
39
- name: "commit",
40
- type: "submit",
41
- value: value
42
- )
43
- end
44
-
45
- def url
46
- helpers.url_for(@model)
47
- end
48
-
49
- def field_name(*field)
50
- helpers.field_name(ActiveModel::Naming.param_key(@model.class), *field)
51
- end
52
-
53
- input_field :url_field, type: "url"
54
- input_field :text_field, type: "text"
55
- input_field :date_field, type: "date"
56
- input_field :time_field, type: "time"
57
- input_field :week_field, type: "week"
58
- input_field :month_field, type: "month"
59
- input_field :email_field, type: "email"
60
- input_field :color_field, type: "color"
61
- input_field :hidden_field, type: "hidden"
62
- input_field :search_field, type: "search"
63
- input_field :password_field, type: "password"
64
- input_field :telephone_field, type: "tel"
65
- input_field :datetime_local_field, type: "datetime-local"
66
- end
67
- end
68
- end