flash-message-conductor 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +7 -2
- data/VERSION.yml +2 -2
- data/lib/flash_message_conductor.rb +14 -6
- metadata +17 -5
data/README
CHANGED
@@ -17,7 +17,7 @@ flash[:message] = 'foo'
|
|
17
17
|
|
18
18
|
Controller helpers included:
|
19
19
|
|
20
|
-
add_message( message )
|
20
|
+
add_message( message )
|
21
21
|
add_notice( message )
|
22
22
|
add_error( message )
|
23
23
|
|
@@ -37,6 +37,11 @@ produces:
|
|
37
37
|
<p class="error">Oops! Something went bonkers!</p>
|
38
38
|
</div>
|
39
39
|
|
40
|
+
# or...
|
40
41
|
|
42
|
+
<% if flash_message_set? -%>
|
43
|
+
# do something
|
44
|
+
<% end -%>
|
41
45
|
|
42
|
-
|
46
|
+
|
47
|
+
Copyright (c) 2011 Planet Argon, released under the MIT license
|
data/VERSION.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# ArgonHelpers
|
2
2
|
|
3
|
-
module PlanetArgon
|
3
|
+
module PlanetArgon
|
4
4
|
module FlashMessageConductor
|
5
5
|
FLASH_MESSAGE_TYPES = [ :error, :notice, :message ]
|
6
|
-
|
6
|
+
|
7
7
|
module ControllerHelpers
|
8
8
|
def add_error(msg)
|
9
9
|
flash[:error] = msg
|
@@ -16,14 +16,22 @@ module PlanetArgon
|
|
16
16
|
def add_message(msg)
|
17
17
|
flash[:message] = msg
|
18
18
|
end
|
19
|
+
|
20
|
+
def flash_message_set?
|
21
|
+
flash_set = false
|
22
|
+
FLASH_MESSAGE_TYPES.each do |key|
|
23
|
+
flash_set = true unless flash[key].blank?
|
24
|
+
end
|
25
|
+
return flash_set
|
26
|
+
end
|
19
27
|
end
|
20
|
-
|
28
|
+
|
21
29
|
module ViewHelpers
|
22
|
-
def render_flash_message( css_class, message = "" )
|
30
|
+
def render_flash_message( css_class, message = "" )
|
23
31
|
return "" if message.nil? or message.blank?
|
24
32
|
content_tag( "p", message, :class => "#{css_class}" )
|
25
33
|
end
|
26
|
-
|
34
|
+
|
27
35
|
def render_flash_messages( div_id = "flash_messages", div_class = "" )
|
28
36
|
div_content = ''
|
29
37
|
FLASH_MESSAGE_TYPES.each do |key|
|
@@ -35,7 +43,7 @@ module PlanetArgon
|
|
35
43
|
return content_tag( 'div', div_content, :id => div_id, :class => div_class )
|
36
44
|
end
|
37
45
|
end
|
38
|
-
|
46
|
+
|
39
47
|
def flash_message_set?
|
40
48
|
flash_set = false
|
41
49
|
FLASH_MESSAGE_TYPES.each do |key|
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flash-message-conductor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 21
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Robby Russell
|
@@ -9,7 +15,7 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2009-10-12 00:00:00
|
18
|
+
date: 2009-10-12 00:00:00 +02:00
|
13
19
|
default_executable:
|
14
20
|
dependencies: []
|
15
21
|
|
@@ -38,21 +44,27 @@ rdoc_options:
|
|
38
44
|
require_paths:
|
39
45
|
- lib
|
40
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
41
48
|
requirements:
|
42
49
|
- - ">="
|
43
50
|
- !ruby/object:Gem::Version
|
51
|
+
hash: 3
|
52
|
+
segments:
|
53
|
+
- 0
|
44
54
|
version: "0"
|
45
|
-
version:
|
46
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
47
57
|
requirements:
|
48
58
|
- - ">="
|
49
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
50
63
|
version: "0"
|
51
|
-
version:
|
52
64
|
requirements: []
|
53
65
|
|
54
66
|
rubyforge_project:
|
55
|
-
rubygems_version: 1.
|
67
|
+
rubygems_version: 1.6.2
|
56
68
|
signing_key:
|
57
69
|
specification_version: 3
|
58
70
|
summary: Conduct your Flash Messages in Rails
|