respond_for_helper 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +6 -7
- data/lib/respond_for_helper/formats/html.rb +9 -1
- data/lib/respond_for_helper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b368868c63db0e34e6bfefbda55d9cb89a33892b734ea3b7814678a44f36908
|
4
|
+
data.tar.gz: 0f598a1c10ced9cdc5d168519a253a2fff3be3dada6c3aeaf1a16bb01a859799
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5654deb58cdbdffb71cdd82a7d664bbbe0810c7814cb45467ae12d18ff3f539984b8ab4ce6e93d42770b9a421beaa75505c89eb981c53b9f5218d0563992363b
|
7
|
+
data.tar.gz: 7b5f93d32002fd9b8f739dded10273cb7e7968f9fb35a37e1256953ed618d4433a673871086445c23a0f3b29700043e77bc6c19b11bde3ccb05aa46a9c6ad1eb
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -100,16 +100,16 @@ you can use `respond_for_message` as follows:
|
|
100
100
|
```ruby
|
101
101
|
class ItemsController < ActionController::Base
|
102
102
|
def create
|
103
|
-
|
103
|
+
respond_for_message :notice
|
104
104
|
#=> Successfully created (2021-01-01 10:00)
|
105
105
|
|
106
|
-
|
106
|
+
respond_for_message :notice, success_num: 10
|
107
107
|
#=> Successfully created (10 succeeded) (2021-01-01 10:00)
|
108
108
|
|
109
|
-
|
109
|
+
respond_for_message :notice, action_name: :update
|
110
110
|
#=> Successfully updated (2021-01-01 10:00)
|
111
111
|
|
112
|
-
|
112
|
+
respond_for_message :alert
|
113
113
|
#=> Failed to create (2021-01-01 10:00)
|
114
114
|
end
|
115
115
|
end
|
@@ -171,7 +171,7 @@ The way of setting is same as `config.default_behaviours`.
|
|
171
171
|
|
172
172
|
#### Format processors
|
173
173
|
|
174
|
-
|
174
|
+
You can also set your own format processors as you like:
|
175
175
|
|
176
176
|
```ruby
|
177
177
|
RespondForHelper.configure do |config|
|
@@ -185,7 +185,7 @@ end
|
|
185
185
|
|
186
186
|
Format processors should be extended by `RespondForHelper::Formats::Base`.
|
187
187
|
|
188
|
-
|
188
|
+
You can also set your own flash message generators:
|
189
189
|
|
190
190
|
```ruby
|
191
191
|
RespondForHelper.configure do |config|
|
@@ -195,7 +195,6 @@ end
|
|
195
195
|
|
196
196
|
Flash message generators should be extended by `RespondForHelper::Flashes::Base`.
|
197
197
|
|
198
|
-
|
199
198
|
## Contributing
|
200
199
|
|
201
200
|
Bug reports and pull requests are welcome at https://github.com/kanety/respond_for_helper.
|
@@ -30,7 +30,7 @@ module RespondForHelper
|
|
30
30
|
if behaviour[0] == :template
|
31
31
|
message = resolve_flash(type)
|
32
32
|
flash.now[type] = message if message
|
33
|
-
render resolve_template(behaviour[1]), status:
|
33
|
+
render resolve_template(behaviour[1]), status: render_status
|
34
34
|
else
|
35
35
|
message = resolve_flash(type)
|
36
36
|
flash[type] = message if message
|
@@ -38,6 +38,14 @@ module RespondForHelper
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
+
def render_status
|
42
|
+
if succeeded?
|
43
|
+
:ok
|
44
|
+
else
|
45
|
+
:unprocessable_entity
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
41
49
|
def resolve_flash(type)
|
42
50
|
return if request.xhr?
|
43
51
|
@controller.respond_for_message(type, @options)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: respond_for_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshikazu Kaneta
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|