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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7f17979b8269d9fad0e710e0f593e6688477368e32a8d229f4ca8aeda7058e9
4
- data.tar.gz: 7995b1e3ae788d7332f4cf3885a78946ad1980731e89cb7a2658e88608aba35c
3
+ metadata.gz: 3b368868c63db0e34e6bfefbda55d9cb89a33892b734ea3b7814678a44f36908
4
+ data.tar.gz: 0f598a1c10ced9cdc5d168519a253a2fff3be3dada6c3aeaf1a16bb01a859799
5
5
  SHA512:
6
- metadata.gz: d87eb932d5b4b2e7f9cbe8a5d9630a7633c40827bd6596b907e5094d801f685ed86d43b895be7564702547edb10b4f87ea91e9a4a509ee6b174be0bb45244c12
7
- data.tar.gz: 33a6df7945b5d6acd9cf5da7bb50b3376533eb3746c669f4a4e2f31ee25a8dbfde5fa04cb5b92ee269d840e622e24fd8de817c48897a3431d8fdaa58ba6241dd
6
+ metadata.gz: 5654deb58cdbdffb71cdd82a7d664bbbe0810c7814cb45467ae12d18ff3f539984b8ab4ce6e93d42770b9a421beaa75505c89eb981c53b9f5218d0563992363b
7
+ data.tar.gz: 7b5f93d32002fd9b8f739dded10273cb7e7968f9fb35a37e1256953ed618d4433a673871086445c23a0f3b29700043e77bc6c19b11bde3ccb05aa46a9c6ad1eb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.0.1
4
+
5
+ * Fix render status.
6
+
3
7
  ## 1.0.0
4
8
 
5
9
  * First release.
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
- respond_for_mesasge :notice
103
+ respond_for_message :notice
104
104
  #=> Successfully created (2021-01-01 10:00)
105
105
 
106
- respond_for_mesasge :notice, success_num: 10
106
+ respond_for_message :notice, success_num: 10
107
107
  #=> Successfully created (10 succeeded) (2021-01-01 10:00)
108
108
 
109
- respond_for_mesasge :notice, action_name: :update
109
+ respond_for_message :notice, action_name: :update
110
110
  #=> Successfully updated (2021-01-01 10:00)
111
111
 
112
- respond_for_mesasge :alert
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
- you can also set your own format processors as you like:
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
- you can also set your own flash message generators:
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: :unprocessable_entity
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RespondForHelper
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
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.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-09-21 00:00:00.000000000 Z
11
+ date: 2021-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails