Created
April 4, 2012 05:34
-
-
Save sshaw/2298052 to your computer and use it in GitHub Desktop.
Mojolicious Twitter Bootstrap Flash/Stash Alerts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Mojo::ByteStream; | |
app->helper(alerts => sub { | |
my $c = shift; | |
my $html = ''; | |
for my $message (qw|success info error|) { | |
my $css = "alert alert-$message"; | |
if($c->flash($message)) { | |
$html .= $c->tag('div', class => $css, $c->flash($message)); | |
} | |
if($c->stash($message)) { | |
$html .= $c->tag('div', class => $css, $c->stash($message)); | |
} | |
} | |
b($html); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment