Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 97 lines (66 sloc) 1.738 kB
19845a2 @eddorre Updated README and renamed it to README.md
eddorre authored
1 # Flash Message Conductor
2
3 A simple pattern for managing flash messages in your Ruby on Rails application.
4
5 ## Installation
6
9c1f51e @eddorre Fixed formatting error in README
eddorre authored
7 ***This branch is only used for Rails 3. Still using Rails 2? Use [https://github.com/planetargon/flash-message-conductor/tree/rails2](https://github.com/planetargon/flash-message-conductor/tree/rails2) instead.***
19845a2 @eddorre Updated README and renamed it to README.md
eddorre authored
8
9 Add this line to your application's Gemfile:
10
c6368d5 @markijbema Added syntax highlighting to readme
markijbema authored
11 ```ruby
12 gem "flash-message-conductor", "~> 2.0.1"
13 ```
19845a2 @eddorre Updated README and renamed it to README.md
eddorre authored
14
15 And then execute:
16
17 $ bundle
18
b0fb37e @eddorre Updating README for new Gem instructions
eddorre authored
19 Or install it yourself as:
20
21 gem install flash-message-conductor
22
19845a2 @eddorre Updated README and renamed it to README.md
eddorre authored
23 ## Usage
24
25 ### Controller helpers
26
c6368d5 @markijbema Added syntax highlighting to readme
markijbema authored
27 ```ruby
19845a2 @eddorre Updated README and renamed it to README.md
eddorre authored
28 add_message('foo')
29 ```
30
31 **Is the equivalent of:**
32
c6368d5 @markijbema Added syntax highlighting to readme
markijbema authored
33 ```ruby
19845a2 @eddorre Updated README and renamed it to README.md
eddorre authored
34 flash[:message] = 'foo'
35 ```
8e8ffdc @eddorre Added support for flash methods, keep, now, and discard. Updated READ…
eddorre authored
36 **Flash methods Keep, discard, and now are also supported**
37
c6368d5 @markijbema Added syntax highlighting to readme
markijbema authored
38 ```ruby
8e8ffdc @eddorre Added support for flash methods, keep, now, and discard. Updated READ…
eddorre authored
39 add_message('foo', :state => :keep)
40 ```
41
42 **Is the equivalent of:**
43
c6368d5 @markijbema Added syntax highlighting to readme
markijbema authored
44 ```ruby
8e8ffdc @eddorre Added support for flash methods, keep, now, and discard. Updated READ…
eddorre authored
45 flash[:message] = 'foo'
46 flash.keep(:message)
47 ```
19845a2 @eddorre Updated README and renamed it to README.md
eddorre authored
48
49 **Rails Controller helpers included:**
50
c6368d5 @markijbema Added syntax highlighting to readme
markijbema authored
51 ```ruby
19845a2 @eddorre Updated README and renamed it to README.md
eddorre authored
52 add_message(message)
53 add_notice(message)
54 add_error(message)
51c22a9 @eddorre Updated README for 2.0.1 release.
eddorre authored
55 add_alert(message)
19845a2 @eddorre Updated README and renamed it to README.md
eddorre authored
56 ```
57
58 ### View helpers
59
c6368d5 @markijbema Added syntax highlighting to readme
markijbema authored
60 ```erb
19845a2 @eddorre Updated README and renamed it to README.md
eddorre authored
61 <%= render_flash_messages %>
62 ```
63
64 **Produces:**
65
c6368d5 @markijbema Added syntax highlighting to readme
markijbema authored
66 ```html
19845a2 @eddorre Updated README and renamed it to README.md
eddorre authored
67 <div id="flash_messages">
68 <p class="message">You have successfully done XYZ...</p>
69 </div>
70 ```
71
72 **Or... if you set an error:**
73
c6368d5 @markijbema Added syntax highlighting to readme
markijbema authored
74 ```html
19845a2 @eddorre Updated README and renamed it to README.md
eddorre authored
75 <div id="flash_messages">
76 <p class="error">Oops! Something went bonkers!<p>
77 </div>
78 ```
79
80 **Or:**
81
c6368d5 @markijbema Added syntax highlighting to readme
markijbema authored
82 ```erb
19845a2 @eddorre Updated README and renamed it to README.md
eddorre authored
83 <% if flash_message_set? -%>
84 # do something
85 <% end -%>
86 ```
87
51c22a9 @eddorre Updated README for 2.0.1 release.
eddorre authored
88 Copyright (c) 2008-2013 Planet Argon, released under the MIT license
19845a2 @eddorre Updated README and renamed it to README.md
eddorre authored
89
90 ### Contributing
91
92 1. Fork it
93 2. Create your feature branch (`git checkout -b my-new-feature`)
94 3. Commit your changes (`git commit -am 'Add some feature'`)
95 4. Push to the branch (`git push origin my-new-feature`)
96 5. Create new Pull Request
Something went wrong with that request. Please try again.