cfc / stickies forked from JokerCatz/stickies
- Source
- Commits
- Network (2)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
JokerCatz (author)
Thu Aug 06 06:18:12 -0700 2009
stickies /
README
JellyCatz-merge jQuery & jGrowl & Ruby On Rails Stickies Plug-in
use jQuery framework(jRails) & jquery.jgrowl lib
INSTALL
you need to load lib first
<%= stylesheet_link_tag "stickies" %>
<%= javascript_include_tag "jquery.jgrowl" %>
<%= javascript_include_tag "jquery" %> #add this use jRails default load or by yourself
if you want use anime fixture , you must load jQuery UI lib
<%= javascript_include_tag "jquery-ui" %>
then add the main code in layout or any you want to show
<%= render_stickies %> or <%= render_stickies({hash globel options}) %>
FIXTURE
default :
:remember => true,
:name => :browser_warning,
:seen_in => 24.hours,
addon-jGrowl support :
Globel only , like <%= render_stickies(:closerTemplate => "CloseAll" , :header => "HiHi!!") %>
:closerTemplate => "[ close all ]" This content is used for the close-all link that is added to the bottom of a
jGrowl container when it contains more than one notification.
Sub & Globel setting with stickies , like error_stickie("Your browser sucks" , {:life => "20000" , :corners => "20"})
:header => "" ; Optional header to prefix the message, this is often helpful for associating messages to each other.
:sticky => false ; When set to true a message will stick to the screen until it is intentionally closed by the user.
:glue => "after" ; Designates whether a jGrowl notification should be appended to the container after all
notifications, or whether it should be prepended to the container before all notifications. Options are after or
before.
:position => "top-right" ; Designates a class which is applied to the jGrowl container and controls it's position on
the screen. By Default there are five options available, top-left, top-right, bottom-left, bottom-right, center. This
must be changed in the defaults before the startup method is called.
:theme => "default" ; A CSS class designating custom styling for this particular message.
:corners => "10"px ; If the corners jQuery plugin is include this option specifies the curvature radius to be used
for the notifications as they are created.
:check => "1000" ; The frequency that jGrowl should check for messages to be scrubbed from the screen.
:life => "3000" ; The lifespan of a non-sticky message on the screen.
:speed => "normal" ; The animation speed used to open or close a notification.
:easing => "swing" ; The easing method to be used with the animation for opening and closing a notification.
:closer => true ; Whether or not the close-all button should be used when more then one notification appears on the
screen. Optionally this property can be set to a function which will be used as a callback when the close all button
is clicked.
:closeTemplate => "×" ; This content is used for the individual notification close links that are added to the
corner of a notification.
:log => function(e,m,o) {""} ; Callback to be used before anything is done with the notification. This is intended to
be used if the user would like to have some type of logging mechanism for all notifications passed to jGrowl. This
callback receives the notification's DOM context, the notifications message and it's option object.
:beforeOpen => function(e,m,o) {""} ; Callback to be used before a new notification is opened. This callback receives
the notification's DOM context, the notifications message and it's option object.
:open => function(e,m,o) {""} ; Callback to be used when a new notification is opened. This callback receives the
notification's DOM context, the notifications message and it's option object.
:beforeClose => function(e,m,o) {""} ; Callback to be used before a new notification is closed. This callback
receives the notification's DOM context, the notifications message and it's option object.
:close => function(e,m,o) {""} ; Callback to be used when a new notification is closed. This callback receives the
notification's DOM context, the notifications message and it's option object.
:animateOpen => { "opacity: 'show'" } ; The animation properties to use when opening a new notification (default to
fadeOut).
:animateClose => { "opacity: 'hide'" } ; The animation properties to use when closing a new notification (defaults to
fadeIn).
:debug_mode => false ; debug mode for firebug
handlino-stickies
This is a modified version from http://software.pmade.com/stickies
We use jquery to let it be unobtrusive.
= Stickies
Stickies is a plugin for Ruby on Rails that provides some easy to use yet
powerful features for displaying status messages. It's a replacement for the
traditional use of placing such messages in the flash.
== Examples
The following line goes in your layout, where you normally render messages
that are in the flash:
<%= render_stickies %>
Once that is place, you can use the helper methods from your controllers or
views for adding messages to the message collection:
error_stickie("Your account has been disabled")
warning_stickie("Your account will expire in 3 days")
notice_stickie("Account activated")
debug_stickie("This only works when RAILS_ENV is development")
== Features
* Displayed messages have a close link to remove them from the web page
* Messages default to only being displayed once (they disappear on the next page load)
* Messages can stick around until a user closes them
* You can choose to have a specific message display every so often
To display a warning that a user's browser sucks, no more than once every 24
hours:
warning_stickie("Your browser sucks", {
:remember => true,
:name => :browser_warning,
:seen_in => 24.hours,
})

