Git Product home page Git Product logo

flash-message-conductor's Introduction

Flash Message Conductor

A simple pattern for managing flash messages in your Ruby on Rails application.

Installation

Gem

In environment.rb;

gem 'glennr-flash-message-conductor'

config.gem 'glennr-flash-message-conductor', :lib => 'flash-message-conductor', :source => 'http://gemcutter.org', :version => ">=1.1"

Plugin

script/plugin install git://github.com/glennr/flash-message-conductor.git

Example

Redirect actions

add_info( 'foo' )
redirect_to :action => "show"

is the equivalent of

flash[:info] = 'foo'

Render actions

add_info_now( 'foo' )
render :action => "show"

is the equivalent of

flash[:info] = 'foo'

Controller helpers included:

add_success( message )
add_info( message )
add_warning( message )
add_error( message )
add_message( message ) # alias for add_success
add_notice( message ) #alias for add_info

Plus all the _now methods e.g.

add_success_now( message )

View helpers

<%= render_flash_messages %>

produces:

<div id="flash_messages">
  <div class="info">You have successfully done XYZ...</p>
</div>

or… if you set an error

<div id="flash_messages">
  <p class="error">Oops! Something went bonkers!</p>
</div>

Example CSS and Icons

See examples/

Copyright © 2008 Planet Argon, released under the MIT license

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.