glow 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- glow (0.0.11)
4
+ glow (0.0.12)
5
5
  jquery-rails
6
6
  rails (>= 3.0.0, < 4.0.0)
7
7
 
data/README.md CHANGED
@@ -35,6 +35,8 @@ responses).
35
35
  <%= javascript_tag "Flash.fire('#{type}', '#{message}')" %>
36
36
  <% end %>
37
37
 
38
+ If you want to skip the glow after_filter just set `flash[:skip_glow]`.
39
+
38
40
  ## Installation
39
41
 
40
42
  In your gemfile add
@@ -9,6 +9,8 @@ module Glow
9
9
 
10
10
  def flash_to_headers
11
11
  return unless flash.any? && request.xhr?
12
+ return if flash[:skip_glow] and flash.delete(:skip_glow)
13
+
12
14
  type, message = flash.first
13
15
  response.headers['X-Message'] = message.to_s.unpack('U*').map{ |i| "&##{i};" }.join
14
16
  response.headers['X-Message-Type'] = type.to_s
@@ -1,3 +1,3 @@
1
1
  module Glow
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -12,6 +12,7 @@ class FlashController < ApplicationController
12
12
  respond_to do |wants|
13
13
  wants.js {
14
14
  flash[params[:type]] = params[:message]
15
+ flash[:skip_glow] = params[:skip_glow].present?
15
16
  head :ok
16
17
  }
17
18
  end
@@ -30,4 +30,9 @@ describe FlashController do
30
30
  @response.headers['X-Message-Type'].should be == 'notice'
31
31
  HTMLEntities.new.decode(@response.headers['X-Message']).should be == 'utf8: ✓'
32
32
  end
33
+
34
+ it "should not display flash message on xhr when skip_glow is set" do
35
+ xhr :get, :ajax, type: :notice, message: 'utf8: ✓', skip_glow: true
36
+ @response.headers.should_not have_key 'X-Message-Type'
37
+ end
33
38
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- glow (0.0.10)
4
+ glow (0.0.11)
5
5
  jquery-rails
6
6
  rails (>= 3.0.0, < 4.0.0)
7
7
 
@@ -12,6 +12,7 @@ class FlashController < ApplicationController
12
12
  respond_to do |wants|
13
13
  wants.js {
14
14
  flash[params[:type].to_sym] = params[:message]
15
+ flash[:skip_glow] = params[:skip_glow].present?
15
16
  head :ok
16
17
  }
17
18
  end
@@ -30,4 +30,9 @@ describe FlashController do
30
30
  @response.headers['X-Message-Type'].should be == 'notice'
31
31
  HTMLEntities.new.decode(@response.headers['X-Message']).should be == 'utf8: ✓'
32
32
  end
33
+
34
+ it "should not display flash message on xhr when skip_glow is set" do
35
+ xhr :get, :ajax, type: :notice, message: 'utf8: ✓', skip_glow: true
36
+ @response.headers.should_not have_key 'X-Message-Type'
37
+ end
33
38
  end
@@ -12,6 +12,7 @@ class FlashController < ApplicationController
12
12
  respond_to do |wants|
13
13
  wants.js {
14
14
  flash[params[:type].to_sym] = params[:message]
15
+ flash[:skip_glow] = params[:skip_glow].present?
15
16
  head :ok
16
17
  }
17
18
  end
@@ -30,4 +30,9 @@ describe FlashController do
30
30
  @response.headers['X-Message-Type'].should be == 'notice'
31
31
  HTMLEntities.new.decode(@response.headers['X-Message']).should be == 'utf8: ✓'
32
32
  end
33
+
34
+ it "should not display flash message on xhr when skip_glow is set" do
35
+ xhr :get, :ajax, type: :notice, message: 'utf8: ✓', skip_glow: true
36
+ @response.headers.should_not have_key 'X-Message-Type'
37
+ end
33
38
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
5
4
  prerelease:
5
+ version: 0.0.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel Kirsch
@@ -10,12 +10,10 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-02 00:00:00.000000000 Z
13
+ date: 2012-12-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: rails
17
- requirement: !ruby/object:Gem::Requirement
18
- none: false
16
+ version_requirements: !ruby/object:Gem::Requirement
19
17
  requirements:
20
18
  - - ! '>='
21
19
  - !ruby/object:Gem::Version
@@ -23,10 +21,10 @@ dependencies:
23
21
  - - <
24
22
  - !ruby/object:Gem::Version
25
23
  version: 4.0.0
26
- type: :runtime
27
- prerelease: false
28
- version_requirements: !ruby/object:Gem::Requirement
29
24
  none: false
25
+ prerelease: false
26
+ name: rails
27
+ requirement: !ruby/object:Gem::Requirement
30
28
  requirements:
31
29
  - - ! '>='
32
30
  - !ruby/object:Gem::Version
@@ -34,22 +32,24 @@ dependencies:
34
32
  - - <
35
33
  - !ruby/object:Gem::Version
36
34
  version: 4.0.0
37
- - !ruby/object:Gem::Dependency
38
- name: jquery-rails
39
- requirement: !ruby/object:Gem::Requirement
40
35
  none: false
36
+ type: :runtime
37
+ - !ruby/object:Gem::Dependency
38
+ version_requirements: !ruby/object:Gem::Requirement
41
39
  requirements:
42
40
  - - ! '>='
43
41
  - !ruby/object:Gem::Version
44
42
  version: '0'
45
- type: :runtime
46
- prerelease: false
47
- version_requirements: !ruby/object:Gem::Requirement
48
43
  none: false
44
+ prerelease: false
45
+ name: jquery-rails
46
+ requirement: !ruby/object:Gem::Requirement
49
47
  requirements:
50
48
  - - ! '>='
51
49
  - !ruby/object:Gem::Version
52
50
  version: '0'
51
+ none: false
52
+ type: :runtime
53
53
  description: ! ' Handles Flash messages in Javascript for Rails xhr-responses.
54
54
  Fires a dom event when flash messages are present.
55
55
 
@@ -204,23 +204,23 @@ rdoc_options:
204
204
  require_paths:
205
205
  - lib
206
206
  required_ruby_version: !ruby/object:Gem::Requirement
207
- none: false
208
207
  requirements:
209
208
  - - ! '>='
210
209
  - !ruby/object:Gem::Version
211
210
  version: '0'
212
211
  segments:
213
212
  - 0
214
- hash: -3927576654263050558
215
- required_rubygems_version: !ruby/object:Gem::Requirement
213
+ hash: 3382820471934454932
216
214
  none: false
215
+ required_rubygems_version: !ruby/object:Gem::Requirement
217
216
  requirements:
218
217
  - - ! '>='
219
218
  - !ruby/object:Gem::Version
220
219
  version: '0'
221
220
  segments:
222
221
  - 0
223
- hash: -3927576654263050558
222
+ hash: 3382820471934454932
223
+ none: false
224
224
  requirements: []
225
225
  rubyforge_project:
226
226
  rubygems_version: 1.8.24