phlexible 0.6.2 → 0.7.0
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 +4 -4
- data/Gemfile.lock +34 -120
- data/README.md +5 -5
- data/fixtures/rails_helper.rb +1 -0
- data/lib/phlexible/rails/button_to.rb +17 -11
- data/lib/phlexible/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ebbba0bcc30f99c8db48f4c58b0a1206094134083914eef072b7e2e973fca4e9
|
|
4
|
+
data.tar.gz: 1811a856e1c676818f56756bc0230fe5429e83578715d57bb7becbc44eebeeff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c422ce495faed5f85e81d189683ddb8eb332f0268c1701923bea7b2d005eb648e0e9750ce8a6b4091bf5a164dfa0329a26eccfb9c9f123c9e82e319b6e1b0457
|
|
7
|
+
data.tar.gz: 53d11e9fced4091ee9119078e05f26bdcf5629aa0adaf7108e2b4b326a463a1feeacbd0b920c4e549bfc8385224214336a27cfc32d7830689b40a3c66c34b8c5
|
data/Gemfile.lock
CHANGED
|
@@ -1,77 +1,30 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
phlexible (0.
|
|
5
|
-
phlex (
|
|
6
|
-
phlex-rails (
|
|
4
|
+
phlexible (0.7.0)
|
|
5
|
+
phlex (>= 1.8.1)
|
|
6
|
+
phlex-rails (>= 1.0.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
activesupport (= 7.1.
|
|
14
|
-
nio4r (~> 2.0)
|
|
15
|
-
websocket-driver (>= 0.6.1)
|
|
16
|
-
zeitwerk (~> 2.6)
|
|
17
|
-
actionmailbox (7.1.1)
|
|
18
|
-
actionpack (= 7.1.1)
|
|
19
|
-
activejob (= 7.1.1)
|
|
20
|
-
activerecord (= 7.1.1)
|
|
21
|
-
activestorage (= 7.1.1)
|
|
22
|
-
activesupport (= 7.1.1)
|
|
23
|
-
mail (>= 2.7.1)
|
|
24
|
-
net-imap
|
|
25
|
-
net-pop
|
|
26
|
-
net-smtp
|
|
27
|
-
actionmailer (7.1.1)
|
|
28
|
-
actionpack (= 7.1.1)
|
|
29
|
-
actionview (= 7.1.1)
|
|
30
|
-
activejob (= 7.1.1)
|
|
31
|
-
activesupport (= 7.1.1)
|
|
32
|
-
mail (~> 2.5, >= 2.5.4)
|
|
33
|
-
net-imap
|
|
34
|
-
net-pop
|
|
35
|
-
net-smtp
|
|
36
|
-
rails-dom-testing (~> 2.2)
|
|
37
|
-
actionpack (7.1.1)
|
|
38
|
-
actionview (= 7.1.1)
|
|
39
|
-
activesupport (= 7.1.1)
|
|
11
|
+
actionpack (7.1.2)
|
|
12
|
+
actionview (= 7.1.2)
|
|
13
|
+
activesupport (= 7.1.2)
|
|
40
14
|
nokogiri (>= 1.8.5)
|
|
15
|
+
racc
|
|
41
16
|
rack (>= 2.2.4)
|
|
42
17
|
rack-session (>= 1.0.1)
|
|
43
18
|
rack-test (>= 0.6.3)
|
|
44
19
|
rails-dom-testing (~> 2.2)
|
|
45
20
|
rails-html-sanitizer (~> 1.6)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
activerecord (= 7.1.1)
|
|
49
|
-
activestorage (= 7.1.1)
|
|
50
|
-
activesupport (= 7.1.1)
|
|
51
|
-
globalid (>= 0.6.0)
|
|
52
|
-
nokogiri (>= 1.8.5)
|
|
53
|
-
actionview (7.1.1)
|
|
54
|
-
activesupport (= 7.1.1)
|
|
21
|
+
actionview (7.1.2)
|
|
22
|
+
activesupport (= 7.1.2)
|
|
55
23
|
builder (~> 3.1)
|
|
56
24
|
erubi (~> 1.11)
|
|
57
25
|
rails-dom-testing (~> 2.2)
|
|
58
26
|
rails-html-sanitizer (~> 1.6)
|
|
59
|
-
|
|
60
|
-
activesupport (= 7.1.1)
|
|
61
|
-
globalid (>= 0.3.6)
|
|
62
|
-
activemodel (7.1.1)
|
|
63
|
-
activesupport (= 7.1.1)
|
|
64
|
-
activerecord (7.1.1)
|
|
65
|
-
activemodel (= 7.1.1)
|
|
66
|
-
activesupport (= 7.1.1)
|
|
67
|
-
timeout (>= 0.4.0)
|
|
68
|
-
activestorage (7.1.1)
|
|
69
|
-
actionpack (= 7.1.1)
|
|
70
|
-
activejob (= 7.1.1)
|
|
71
|
-
activerecord (= 7.1.1)
|
|
72
|
-
activesupport (= 7.1.1)
|
|
73
|
-
marcel (~> 1.0)
|
|
74
|
-
activesupport (7.1.1)
|
|
27
|
+
activesupport (7.1.2)
|
|
75
28
|
base64
|
|
76
29
|
bigdecimal
|
|
77
30
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
@@ -82,10 +35,10 @@ GEM
|
|
|
82
35
|
mutex_m
|
|
83
36
|
tzinfo (~> 2.0)
|
|
84
37
|
ast (2.4.2)
|
|
85
|
-
base64 (0.
|
|
38
|
+
base64 (0.2.0)
|
|
86
39
|
bigdecimal (3.1.4)
|
|
87
40
|
builder (3.2.4)
|
|
88
|
-
cgi (0.
|
|
41
|
+
cgi (0.4.0)
|
|
89
42
|
combustion (1.3.7)
|
|
90
43
|
activesupport (>= 3.0.0)
|
|
91
44
|
railties (>= 3.0.0)
|
|
@@ -93,68 +46,48 @@ GEM
|
|
|
93
46
|
concurrent-ruby (1.2.2)
|
|
94
47
|
connection_pool (2.4.1)
|
|
95
48
|
crass (1.0.6)
|
|
96
|
-
|
|
97
|
-
drb (2.1.1)
|
|
49
|
+
drb (2.2.0)
|
|
98
50
|
ruby2_keywords
|
|
99
51
|
erb (4.0.3)
|
|
100
52
|
cgi (>= 0.3.3)
|
|
101
53
|
erubi (1.12.0)
|
|
102
|
-
globalid (1.2.1)
|
|
103
|
-
activesupport (>= 6.1)
|
|
104
54
|
i18n (1.14.1)
|
|
105
55
|
concurrent-ruby (~> 1.0)
|
|
106
56
|
io-console (0.6.0)
|
|
107
|
-
irb (1.
|
|
57
|
+
irb (1.9.1)
|
|
108
58
|
rdoc
|
|
109
59
|
reline (>= 0.3.8)
|
|
110
60
|
json (2.6.3)
|
|
111
61
|
language_server-protocol (3.17.0.3)
|
|
112
|
-
loofah (2.
|
|
62
|
+
loofah (2.22.0)
|
|
113
63
|
crass (~> 1.0.2)
|
|
114
64
|
nokogiri (>= 1.12.0)
|
|
115
|
-
mail (2.8.1)
|
|
116
|
-
mini_mime (>= 0.1.1)
|
|
117
|
-
net-imap
|
|
118
|
-
net-pop
|
|
119
|
-
net-smtp
|
|
120
|
-
marcel (1.0.2)
|
|
121
|
-
mini_mime (1.1.5)
|
|
122
65
|
minitest (5.20.0)
|
|
123
|
-
mutex_m (0.
|
|
124
|
-
|
|
125
|
-
date
|
|
126
|
-
net-protocol
|
|
127
|
-
net-pop (0.1.2)
|
|
128
|
-
net-protocol
|
|
129
|
-
net-protocol (0.2.1)
|
|
130
|
-
timeout
|
|
131
|
-
net-smtp (0.4.0)
|
|
132
|
-
net-protocol
|
|
133
|
-
nio4r (2.5.9)
|
|
134
|
-
nokogiri (1.15.4-arm64-darwin)
|
|
66
|
+
mutex_m (0.2.0)
|
|
67
|
+
nokogiri (1.15.5-arm64-darwin)
|
|
135
68
|
racc (~> 1.4)
|
|
136
|
-
nokogiri (1.15.
|
|
69
|
+
nokogiri (1.15.5-x86_64-darwin)
|
|
137
70
|
racc (~> 1.4)
|
|
138
|
-
nokogiri (1.15.
|
|
71
|
+
nokogiri (1.15.5-x86_64-linux)
|
|
139
72
|
racc (~> 1.4)
|
|
140
73
|
parallel (1.23.0)
|
|
141
74
|
parser (3.2.2.4)
|
|
142
75
|
ast (~> 2.4.1)
|
|
143
76
|
racc
|
|
144
|
-
phlex (1.
|
|
77
|
+
phlex (1.9.0)
|
|
145
78
|
concurrent-ruby (~> 1.2)
|
|
146
79
|
erb (>= 4)
|
|
147
80
|
zeitwerk (~> 2.6)
|
|
148
|
-
phlex-rails (1.
|
|
149
|
-
phlex (~> 1.
|
|
150
|
-
|
|
81
|
+
phlex-rails (1.1.0)
|
|
82
|
+
phlex (~> 1.9)
|
|
83
|
+
railties (>= 6.1, < 8)
|
|
151
84
|
zeitwerk (~> 2.6)
|
|
152
85
|
phlex-testing-nokogiri (0.1.0)
|
|
153
86
|
nokogiri (~> 1.13)
|
|
154
87
|
phlex (>= 0.5)
|
|
155
88
|
psych (5.1.1.1)
|
|
156
89
|
stringio
|
|
157
|
-
racc (1.7.
|
|
90
|
+
racc (1.7.3)
|
|
158
91
|
rack (3.0.8)
|
|
159
92
|
rack-session (2.0.0)
|
|
160
93
|
rack (>= 3.0.0)
|
|
@@ -163,20 +96,6 @@ GEM
|
|
|
163
96
|
rackup (2.1.0)
|
|
164
97
|
rack (>= 3)
|
|
165
98
|
webrick (~> 1.8)
|
|
166
|
-
rails (7.1.1)
|
|
167
|
-
actioncable (= 7.1.1)
|
|
168
|
-
actionmailbox (= 7.1.1)
|
|
169
|
-
actionmailer (= 7.1.1)
|
|
170
|
-
actionpack (= 7.1.1)
|
|
171
|
-
actiontext (= 7.1.1)
|
|
172
|
-
actionview (= 7.1.1)
|
|
173
|
-
activejob (= 7.1.1)
|
|
174
|
-
activemodel (= 7.1.1)
|
|
175
|
-
activerecord (= 7.1.1)
|
|
176
|
-
activestorage (= 7.1.1)
|
|
177
|
-
activesupport (= 7.1.1)
|
|
178
|
-
bundler (>= 1.15.0)
|
|
179
|
-
railties (= 7.1.1)
|
|
180
99
|
rails-dom-testing (2.2.0)
|
|
181
100
|
activesupport (>= 5.0.0)
|
|
182
101
|
minitest
|
|
@@ -184,24 +103,23 @@ GEM
|
|
|
184
103
|
rails-html-sanitizer (1.6.0)
|
|
185
104
|
loofah (~> 2.21)
|
|
186
105
|
nokogiri (~> 1.14)
|
|
187
|
-
railties (7.1.
|
|
188
|
-
actionpack (= 7.1.
|
|
189
|
-
activesupport (= 7.1.
|
|
106
|
+
railties (7.1.2)
|
|
107
|
+
actionpack (= 7.1.2)
|
|
108
|
+
activesupport (= 7.1.2)
|
|
190
109
|
irb
|
|
191
110
|
rackup (>= 1.0.0)
|
|
192
111
|
rake (>= 12.2)
|
|
193
112
|
thor (~> 1.0, >= 1.2.2)
|
|
194
113
|
zeitwerk (~> 2.6)
|
|
195
114
|
rainbow (3.1.1)
|
|
196
|
-
rake (13.0
|
|
197
|
-
rdoc (6.
|
|
115
|
+
rake (13.1.0)
|
|
116
|
+
rdoc (6.6.0)
|
|
198
117
|
psych (>= 4.0.0)
|
|
199
118
|
regexp_parser (2.8.2)
|
|
200
|
-
reline (0.
|
|
119
|
+
reline (0.4.0)
|
|
201
120
|
io-console (~> 0.5)
|
|
202
121
|
rexml (3.2.6)
|
|
203
|
-
rubocop (1.57.
|
|
204
|
-
base64 (~> 0.1.1)
|
|
122
|
+
rubocop (1.57.2)
|
|
205
123
|
json (~> 2.3)
|
|
206
124
|
language_server-protocol (>= 3.17.0)
|
|
207
125
|
parallel (~> 1.10)
|
|
@@ -212,21 +130,17 @@ GEM
|
|
|
212
130
|
rubocop-ast (>= 1.28.1, < 2.0)
|
|
213
131
|
ruby-progressbar (~> 1.7)
|
|
214
132
|
unicode-display_width (>= 2.4.0, < 3.0)
|
|
215
|
-
rubocop-ast (1.
|
|
133
|
+
rubocop-ast (1.30.0)
|
|
216
134
|
parser (>= 3.2.1.0)
|
|
217
135
|
ruby-progressbar (1.13.0)
|
|
218
136
|
ruby2_keywords (0.0.5)
|
|
219
|
-
stringio (3.0.
|
|
137
|
+
stringio (3.0.9)
|
|
220
138
|
sus (0.23.0)
|
|
221
|
-
thor (1.
|
|
222
|
-
timeout (0.4.0)
|
|
139
|
+
thor (1.3.0)
|
|
223
140
|
tzinfo (2.0.6)
|
|
224
141
|
concurrent-ruby (~> 1.0)
|
|
225
142
|
unicode-display_width (2.5.0)
|
|
226
143
|
webrick (1.8.1)
|
|
227
|
-
websocket-driver (0.7.6)
|
|
228
|
-
websocket-extensions (>= 0.1.0)
|
|
229
|
-
websocket-extensions (0.1.5)
|
|
230
144
|
zeitwerk (2.6.12)
|
|
231
145
|
|
|
232
146
|
PLATFORMS
|
data/README.md
CHANGED
|
@@ -134,11 +134,11 @@ Phlexible::Rails::ButtonTo.new(:root, method: :patch) { 'My Button' }
|
|
|
134
134
|
|
|
135
135
|
##### Options
|
|
136
136
|
|
|
137
|
-
- `:class`
|
|
138
|
-
- `:
|
|
139
|
-
- `:data`
|
|
140
|
-
- `:params`
|
|
141
|
-
- `:method`
|
|
137
|
+
- `:class` - Specify the HTML class name of the button (not the form).
|
|
138
|
+
- `:form_attributes` - Hash of HTML attributes for the form tag.
|
|
139
|
+
- `:data` - This option can be used to add custom data attributes.
|
|
140
|
+
- `:params` - Hash of parameters to be rendered as hidden fields within the form.
|
|
141
|
+
- `:method` - Symbol of the HTTP verb. Supported verbs are :post (default), :get, :delete, :patch, and :put.
|
|
142
142
|
|
|
143
143
|
### `AliasView`
|
|
144
144
|
|
data/fixtures/rails_helper.rb
CHANGED
|
@@ -7,11 +7,12 @@
|
|
|
7
7
|
# option.
|
|
8
8
|
#
|
|
9
9
|
# Additional arguments are passed through to the button element, with a few exceptions:
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
10
|
+
# - :method - Symbol of HTTP verb. Supported verbs are :post, :get, :delete, :patch, and :put.
|
|
11
|
+
# Default is :post.
|
|
12
|
+
# - :form_attributes - Hash of HTML attributes to be rendered on the form tag.
|
|
13
|
+
# - :form_class - This controls the class of the form within which the submit button will be placed.
|
|
14
|
+
# Default is 'button_to'. @deprecated: use :form_attributes instead if you want to override this.
|
|
15
|
+
# - :params - Hash of parameters to be rendered as hidden fields within the form.
|
|
15
16
|
module Phlexible
|
|
16
17
|
module Rails
|
|
17
18
|
module ButtonToConcerns
|
|
@@ -23,15 +24,14 @@ module Phlexible
|
|
|
23
24
|
@options = options
|
|
24
25
|
end
|
|
25
26
|
|
|
26
|
-
# rubocop:disable Metrics/AbcSize
|
|
27
|
-
def template(&block)
|
|
27
|
+
def template(&block) # rubocop:disable Metrics/AbcSize
|
|
28
28
|
action = helpers.url_for(@url)
|
|
29
29
|
@options = DEFAULT_OPTIONS.merge((@options || {}).symbolize_keys)
|
|
30
30
|
|
|
31
31
|
method = (@options.delete(:method).presence || method_for_options(@options)).to_s
|
|
32
32
|
form_method = method == 'get' ? 'get' : 'post'
|
|
33
33
|
|
|
34
|
-
form action: action,
|
|
34
|
+
form action: action, method: form_method, **form_attributes do
|
|
35
35
|
method_tag method
|
|
36
36
|
form_method == 'post' && token_input(action, method.empty? ? 'post' : method)
|
|
37
37
|
param_inputs
|
|
@@ -39,10 +39,16 @@ module Phlexible
|
|
|
39
39
|
block_given? ? button(**button_attrs, &block) : button(**button_attrs) { @name }
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
|
-
# rubocop:enable Metrics/AbcSize
|
|
43
42
|
|
|
44
43
|
private
|
|
45
44
|
|
|
45
|
+
def form_attributes
|
|
46
|
+
{
|
|
47
|
+
class: @options.delete(:form_class), # @deprecated
|
|
48
|
+
**(@options.delete(:form_attributes) || {})
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
46
52
|
def button_attrs
|
|
47
53
|
{
|
|
48
54
|
type: 'submit',
|
|
@@ -83,8 +89,8 @@ module Phlexible
|
|
|
83
89
|
end
|
|
84
90
|
end
|
|
85
91
|
|
|
86
|
-
# Returns an array of hashes each containing :name and :value keys
|
|
87
|
-
#
|
|
92
|
+
# Returns an array of hashes each containing :name and :value keys suitable for use as the
|
|
93
|
+
# names and values of form input fields:
|
|
88
94
|
#
|
|
89
95
|
# to_form_params(name: 'David', nationality: 'Danish')
|
|
90
96
|
# # => [{name: 'name', value: 'David'}, {name: 'nationality', value: 'Danish'}]
|
data/lib/phlexible/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: phlexible
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.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-
|
|
11
|
+
date: 2023-11-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: phlex
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: 1.8.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
26
|
version: 1.8.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
33
|
version: 1.0.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
40
|
version: 1.0.0
|
|
41
41
|
description: A bunch of helpers and goodies intended to make life with Phlex even
|
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
98
98
|
- !ruby/object:Gem::Version
|
|
99
99
|
version: '0'
|
|
100
100
|
requirements: []
|
|
101
|
-
rubygems_version: 3.4.
|
|
101
|
+
rubygems_version: 3.4.22
|
|
102
102
|
signing_key:
|
|
103
103
|
specification_version: 4
|
|
104
104
|
summary: A bunch of helpers and goodies intended to make life with Phlex even easier!
|