phlexible 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de2a41c9efa577146733f7e842f503818c594d726995a8f62fd39f5e87749b61
4
- data.tar.gz: 89306b9e9ca8b83ed58a4b598197cabe3c745c554645c0555b684c8dc653ac39
3
+ metadata.gz: 1d6d20a51dd488d65ba2a2ca84ffd702e5cff5505dce12595cdd1d2ca3f0c8b6
4
+ data.tar.gz: 12bdc3b31f359f5e974ba21d7cb154145c3e0444604c6a20cf706d94eb6a07f8
5
5
  SHA512:
6
- metadata.gz: 87c4b0ece2ba0ce51a1b8d865a48fe09dfcd41cec04ee9f862fb05c8e82140946ebabf71056fb863fd38364bf1a80e836d2024a2dd6d80893a50c4f637231e7a
7
- data.tar.gz: 2fdfd0d7c354df97d8d932bc4eb695876bb87a6434a54b16ce0de729050225acbdbb564e04feb7b6315dc2bde0ee5987456ba67ed684bbfc660c7fae04723356
6
+ metadata.gz: '09db42fc189ffefa64ca54bdedf9e171d0bf9d3084b4bc89a1c18953141f4fbad978e1a10b0d9d81a522df5ddf633ddca6f34aff214f2e69542f5ca197f232fa'
7
+ data.tar.gz: 0bb3d5026764d1366fe31f1b57f05e8c0ec8eeb24947c73c85448ecb4e9f7f9fcf6a0fd425e3150548e34525405c483a86c0725df8f03690d5df0fff225f1768
data/Gemfile CHANGED
@@ -9,4 +9,4 @@ gem 'combustion'
9
9
  gem 'phlex-testing-nokogiri'
10
10
  gem 'rake', '~> 13.0'
11
11
  gem 'rubocop', '~> 1.21'
12
- gem 'sus', '~> 0.16.0'
12
+ gem 'sus', '~> 0.20.0'
data/Gemfile.lock CHANGED
@@ -1,89 +1,92 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- phlexible (0.1.0)
5
- phlex (~> 1.0)
6
- phlex-rails (~> 0.4)
4
+ phlexible (0.2.0)
5
+ phlex (~> 1.5.1)
6
+ phlex-rails (~> 0.8.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (7.0.4)
12
- actionpack (= 7.0.4)
13
- activesupport (= 7.0.4)
11
+ actioncable (7.0.4.2)
12
+ actionpack (= 7.0.4.2)
13
+ activesupport (= 7.0.4.2)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailbox (7.0.4)
17
- actionpack (= 7.0.4)
18
- activejob (= 7.0.4)
19
- activerecord (= 7.0.4)
20
- activestorage (= 7.0.4)
21
- activesupport (= 7.0.4)
16
+ actionmailbox (7.0.4.2)
17
+ actionpack (= 7.0.4.2)
18
+ activejob (= 7.0.4.2)
19
+ activerecord (= 7.0.4.2)
20
+ activestorage (= 7.0.4.2)
21
+ activesupport (= 7.0.4.2)
22
22
  mail (>= 2.7.1)
23
23
  net-imap
24
24
  net-pop
25
25
  net-smtp
26
- actionmailer (7.0.4)
27
- actionpack (= 7.0.4)
28
- actionview (= 7.0.4)
29
- activejob (= 7.0.4)
30
- activesupport (= 7.0.4)
26
+ actionmailer (7.0.4.2)
27
+ actionpack (= 7.0.4.2)
28
+ actionview (= 7.0.4.2)
29
+ activejob (= 7.0.4.2)
30
+ activesupport (= 7.0.4.2)
31
31
  mail (~> 2.5, >= 2.5.4)
32
32
  net-imap
33
33
  net-pop
34
34
  net-smtp
35
35
  rails-dom-testing (~> 2.0)
36
- actionpack (7.0.4)
37
- actionview (= 7.0.4)
38
- activesupport (= 7.0.4)
36
+ actionpack (7.0.4.2)
37
+ actionview (= 7.0.4.2)
38
+ activesupport (= 7.0.4.2)
39
39
  rack (~> 2.0, >= 2.2.0)
40
40
  rack-test (>= 0.6.3)
41
41
  rails-dom-testing (~> 2.0)
42
42
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
43
- actiontext (7.0.4)
44
- actionpack (= 7.0.4)
45
- activerecord (= 7.0.4)
46
- activestorage (= 7.0.4)
47
- activesupport (= 7.0.4)
43
+ actiontext (7.0.4.2)
44
+ actionpack (= 7.0.4.2)
45
+ activerecord (= 7.0.4.2)
46
+ activestorage (= 7.0.4.2)
47
+ activesupport (= 7.0.4.2)
48
48
  globalid (>= 0.6.0)
49
49
  nokogiri (>= 1.8.5)
50
- actionview (7.0.4)
51
- activesupport (= 7.0.4)
50
+ actionview (7.0.4.2)
51
+ activesupport (= 7.0.4.2)
52
52
  builder (~> 3.1)
53
53
  erubi (~> 1.4)
54
54
  rails-dom-testing (~> 2.0)
55
55
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
56
- activejob (7.0.4)
57
- activesupport (= 7.0.4)
56
+ activejob (7.0.4.2)
57
+ activesupport (= 7.0.4.2)
58
58
  globalid (>= 0.3.6)
59
- activemodel (7.0.4)
60
- activesupport (= 7.0.4)
61
- activerecord (7.0.4)
62
- activemodel (= 7.0.4)
63
- activesupport (= 7.0.4)
64
- activestorage (7.0.4)
65
- actionpack (= 7.0.4)
66
- activejob (= 7.0.4)
67
- activerecord (= 7.0.4)
68
- activesupport (= 7.0.4)
59
+ activemodel (7.0.4.2)
60
+ activesupport (= 7.0.4.2)
61
+ activerecord (7.0.4.2)
62
+ activemodel (= 7.0.4.2)
63
+ activesupport (= 7.0.4.2)
64
+ activestorage (7.0.4.2)
65
+ actionpack (= 7.0.4.2)
66
+ activejob (= 7.0.4.2)
67
+ activerecord (= 7.0.4.2)
68
+ activesupport (= 7.0.4.2)
69
69
  marcel (~> 1.0)
70
70
  mini_mime (>= 1.1.0)
71
- activesupport (7.0.4)
71
+ activesupport (7.0.4.2)
72
72
  concurrent-ruby (~> 1.0, >= 1.0.2)
73
73
  i18n (>= 1.6, < 2)
74
74
  minitest (>= 5.1)
75
75
  tzinfo (~> 2.0)
76
76
  ast (2.4.2)
77
77
  builder (3.2.4)
78
+ cgi (0.3.6)
78
79
  combustion (1.3.7)
79
80
  activesupport (>= 3.0.0)
80
81
  railties (>= 3.0.0)
81
82
  thor (>= 0.14.6)
82
- concurrent-ruby (1.1.10)
83
+ concurrent-ruby (1.2.2)
83
84
  crass (1.0.6)
84
85
  date (3.3.3)
86
+ erb (4.0.2)
87
+ cgi (>= 0.3.3)
85
88
  erubi (1.12.0)
86
- globalid (1.0.0)
89
+ globalid (1.1.0)
87
90
  activesupport (>= 5.0)
88
91
  i18n (1.12.0)
89
92
  concurrent-ruby (~> 1.0)
@@ -91,7 +94,7 @@ GEM
91
94
  loofah (2.19.1)
92
95
  crass (~> 1.0.2)
93
96
  nokogiri (>= 1.5.9)
94
- mail (2.8.0)
97
+ mail (2.8.1)
95
98
  mini_mime (>= 0.1.1)
96
99
  net-imap
97
100
  net-pop
@@ -99,8 +102,7 @@ GEM
99
102
  marcel (1.0.2)
100
103
  method_source (1.0.0)
101
104
  mini_mime (1.1.2)
102
- mini_portile2 (2.8.1)
103
- minitest (5.17.0)
105
+ minitest (5.18.0)
104
106
  net-imap (0.3.4)
105
107
  date
106
108
  net-protocol
@@ -111,78 +113,83 @@ GEM
111
113
  net-smtp (0.3.3)
112
114
  net-protocol
113
115
  nio4r (2.5.8)
114
- nokogiri (1.13.10)
115
- mini_portile2 (~> 2.8.0)
116
+ nokogiri (1.14.2-arm64-darwin)
117
+ racc (~> 1.4)
118
+ nokogiri (1.14.2-x86_64-darwin)
119
+ racc (~> 1.4)
120
+ nokogiri (1.14.2-x86_64-linux)
116
121
  racc (~> 1.4)
117
122
  parallel (1.22.1)
118
- parser (3.2.0.0)
123
+ parser (3.2.1.0)
119
124
  ast (~> 2.4.1)
120
- phlex (1.1.0)
125
+ phlex (1.5.1)
126
+ concurrent-ruby (~> 1.2)
127
+ erb (>= 4)
121
128
  zeitwerk (~> 2.6)
122
- phlex-rails (0.4.2)
123
- phlex (>= 1, < 2)
129
+ phlex-rails (0.8.0)
130
+ phlex (~> 1.5)
124
131
  rails (>= 6.1, < 8)
125
- zeitwerk (~> 2)
132
+ zeitwerk (~> 2.6)
126
133
  phlex-testing-nokogiri (0.1.0)
127
134
  nokogiri (~> 1.13)
128
135
  phlex (>= 0.5)
129
136
  racc (1.6.2)
130
- rack (2.2.5)
137
+ rack (2.2.6.3)
131
138
  rack-test (2.0.2)
132
139
  rack (>= 1.3)
133
- rails (7.0.4)
134
- actioncable (= 7.0.4)
135
- actionmailbox (= 7.0.4)
136
- actionmailer (= 7.0.4)
137
- actionpack (= 7.0.4)
138
- actiontext (= 7.0.4)
139
- actionview (= 7.0.4)
140
- activejob (= 7.0.4)
141
- activemodel (= 7.0.4)
142
- activerecord (= 7.0.4)
143
- activestorage (= 7.0.4)
144
- activesupport (= 7.0.4)
140
+ rails (7.0.4.2)
141
+ actioncable (= 7.0.4.2)
142
+ actionmailbox (= 7.0.4.2)
143
+ actionmailer (= 7.0.4.2)
144
+ actionpack (= 7.0.4.2)
145
+ actiontext (= 7.0.4.2)
146
+ actionview (= 7.0.4.2)
147
+ activejob (= 7.0.4.2)
148
+ activemodel (= 7.0.4.2)
149
+ activerecord (= 7.0.4.2)
150
+ activestorage (= 7.0.4.2)
151
+ activesupport (= 7.0.4.2)
145
152
  bundler (>= 1.15.0)
146
- railties (= 7.0.4)
153
+ railties (= 7.0.4.2)
147
154
  rails-dom-testing (2.0.3)
148
155
  activesupport (>= 4.2.0)
149
156
  nokogiri (>= 1.6)
150
- rails-html-sanitizer (1.4.4)
157
+ rails-html-sanitizer (1.5.0)
151
158
  loofah (~> 2.19, >= 2.19.1)
152
- railties (7.0.4)
153
- actionpack (= 7.0.4)
154
- activesupport (= 7.0.4)
159
+ railties (7.0.4.2)
160
+ actionpack (= 7.0.4.2)
161
+ activesupport (= 7.0.4.2)
155
162
  method_source
156
163
  rake (>= 12.2)
157
164
  thor (~> 1.0)
158
165
  zeitwerk (~> 2.5)
159
166
  rainbow (3.1.1)
160
167
  rake (13.0.6)
161
- regexp_parser (2.6.1)
168
+ regexp_parser (2.7.0)
162
169
  rexml (3.2.5)
163
- rubocop (1.43.0)
170
+ rubocop (1.48.0)
164
171
  json (~> 2.3)
165
172
  parallel (~> 1.10)
166
173
  parser (>= 3.2.0.0)
167
174
  rainbow (>= 2.2.2, < 4.0)
168
175
  regexp_parser (>= 1.8, < 3.0)
169
176
  rexml (>= 3.2.5, < 4.0)
170
- rubocop-ast (>= 1.24.1, < 2.0)
177
+ rubocop-ast (>= 1.26.0, < 2.0)
171
178
  ruby-progressbar (~> 1.7)
172
179
  unicode-display_width (>= 2.4.0, < 3.0)
173
- rubocop-ast (1.24.1)
174
- parser (>= 3.1.1.0)
175
- ruby-progressbar (1.11.0)
176
- sus (0.16.0)
180
+ rubocop-ast (1.27.0)
181
+ parser (>= 3.2.1.0)
182
+ ruby-progressbar (1.13.0)
183
+ sus (0.20.3)
177
184
  thor (1.2.1)
178
- timeout (0.3.1)
179
- tzinfo (2.0.5)
185
+ timeout (0.3.2)
186
+ tzinfo (2.0.6)
180
187
  concurrent-ruby (~> 1.0)
181
188
  unicode-display_width (2.4.2)
182
189
  websocket-driver (0.7.5)
183
190
  websocket-extensions (>= 0.1.0)
184
191
  websocket-extensions (0.1.5)
185
- zeitwerk (2.6.6)
192
+ zeitwerk (2.6.7)
186
193
 
187
194
  PLATFORMS
188
195
  arm64-darwin-22
@@ -195,7 +202,7 @@ DEPENDENCIES
195
202
  phlexible!
196
203
  rake (~> 13.0)
197
204
  rubocop (~> 1.21)
198
- sus (~> 0.16.0)
205
+ sus (~> 0.20.0)
199
206
 
200
207
  BUNDLED WITH
201
208
  2.4.1
data/README.md CHANGED
@@ -46,6 +46,7 @@ Just include it in your ApplicationResponder:
46
46
 
47
47
  ```ruby
48
48
  class ApplicationResponder < ActionController::Responder
49
+ include Phlexible::Rails::ActionController::ImplicitRender
49
50
  include Phlexible::Rails::Responder
50
51
  end
51
52
  ```
@@ -57,6 +58,25 @@ class UsersController < ApplicationController
57
58
  def new
58
59
  respond_with User.new
59
60
  end
61
+
62
+ def index
63
+ respond_with User.all
64
+ end
65
+ end
66
+ ```
67
+
68
+ As Phlex views expect explicit arguments, you can pass these in the `:view_options` keyword
69
+ argument:
70
+
71
+ ```ruby
72
+ class UsersController < ApplicationController
73
+ def index
74
+ respond_with User.all, view_options: { page: 1 }
75
+ end
76
+ end
77
+
78
+ class Views::Users::Index < Phlex::HTML
79
+ def initialize(users, page:); end
60
80
  end
61
81
  ```
62
82
 
@@ -4,9 +4,10 @@ module Phlexible
4
4
  #
5
5
  # Helper to assist in defining page titles within Phlex views. Also includes support for nested
6
6
  # views, where each desendent view class will have its title prepended to the page title. Simply
7
- # assign the title to the `page_title` class variable:
7
+ # include the module and assign the title to the `page_title` class variable:
8
8
  #
9
9
  # class MyView
10
+ # include Phlexible::PageTitle
10
11
  # self.page_title = 'My Title'
11
12
  # end
12
13
  #
@@ -23,11 +23,20 @@ module Phlexible
23
23
  render_view_class || super
24
24
  end
25
25
 
26
+ # Renders the Phlex view.
26
27
  def render_view_class(view_options = NUFFIN, render_options = {})
27
28
  klass = render_options&.key?(:action) ? phlex_view(render_options[:action]) : phlex_view
28
29
  return unless klass
29
30
 
30
- render view_options == NUFFIN ? klass.new : klass.new(view_options), render_options
31
+ if view_options == NUFFIN
32
+ view_options = render_options.delete(:view_options) { {} }
33
+ render klass.new(**view_options), render_options
34
+ else
35
+ kwargs = {}
36
+ kwargs = render_options.delete(:view_options) if render_options.key?(:view_options)
37
+
38
+ render klass.new(view_options, **kwargs), render_options
39
+ end
31
40
  end
32
41
 
33
42
  private
@@ -14,8 +14,9 @@ module Phlexible
14
14
  end
15
15
  end
16
16
 
17
- # Render the Phlex view with the current resource. Falls back to default controller rendering if
18
- # no Phlex view exists.
17
+ # Render the Phlex view with the current resource. Falls back to default controller rendering
18
+ # if no Phlex view exists. If a `view_options` keyword argument is given, this will be passed
19
+ # as the keyword arguments of the view initializer.
19
20
  #
20
21
  # @see Phlexible::Rails::ActionController::ImplicitRender#render_view_class
21
22
  def render_phlex_view(options)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Phlexible
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlexible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Moss
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-07 00:00:00.000000000 Z
11
+ date: 2023-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: phlex
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: 1.5.1
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.0'
26
+ version: 1.5.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: phlex-rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.4'
33
+ version: 0.8.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.4'
40
+ version: 0.8.0
41
41
  description: A bunch of helpers and goodies intended to make life with Phlex even
42
42
  easier!
43
43
  email:
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  requirements: []
100
- rubygems_version: 3.4.1
100
+ rubygems_version: 3.4.6
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: A bunch of helpers and goodies intended to make life with Phlex even easier!