Permalink
Browse files

Show messages on the Bootstrap enabled pages

  • Loading branch information...
1 parent f1f20f6 commit 69f50947525ca114a8a72670cff48c224dfe72cc @kimrutherford kimrutherford committed Apr 5, 2013
Showing with 88 additions and 75 deletions.
  1. +1 −75 root/autohandler
  2. +4 −0 root/docs/autohandler
  3. +83 −0 root/err_mess_notice.mhtml
View
@@ -25,50 +25,7 @@ $is_admin_user
<& breadcrumbs.mhtml &>
<span id="curs-contact-page-link"><& contact.mhtml, link_text => 'Questions? Contact curators ...' &></span>
-<div id="notice-list">
-% for my $notice (@notices) {
-<div class="notice">
- <strong>
- <% $notice->{title} %>
- </strong>
-% if (exists $notice->{text}) {
- <div>
- <% $notice->{text} %>
- </div>
-% }
-</div>
-% }
-</div>
-
-<div id="error-list">
-% for my $err (@errors) {
-<div class="error">
- <strong>
- <% $err->{title} %>
- </strong>
-% if (exists $err->{text}) {
- <div>
- <% $err->{text} %>
- </div>
-% }
-</div>
-% }
-</div>
-
-<div id="message-list">
-% for my $mess (@messages) {
-<div class="message">
- <strong>
- <% $mess->{title} %>
- </strong>
-% if (exists $mess->{text}) {
- <div>
- <% $mess->{text} %>
- </div>
-% }
-</div>
-% }
-</div>
+<& /err_mess_notice.mhtml, error => $error, message => $message, notice => $notice &>
% if ($show_title) {
<h1 id="<% $page_description_id %>">
@@ -98,37 +55,6 @@ $is_admin_user
<%init>
my $st = $c->stash();
-
-my $tidy = sub {
- my $arg = shift;
-
- if (!defined $arg) {
- return ();
- }
-
- if (ref $arg) {
- if (ref $arg eq 'ARRAY') {
- return @$arg;
- } else {
- if (ref $arg eq 'HASH' && exists $arg->{title}) {
- return $arg;
- } else {
- use Data::Dumper;
- $Data::Dumper::Maxdepth = 5;
- warn "error in stash is not an array, hash or scalar: ", Dumper([$arg]);
-
- return ( { title => 'Internal error',
- text => 'The problem will be investigated' } );
- }
- }
- } else {
- return { title => $arg };
- }
-};
-
-my @errors = $tidy->($error);
-my @messages = $tidy->($message);
-my @notices = $tidy->($notice);
</%init>
<%flags>
View
@@ -2,6 +2,9 @@
$title
$show_title => 1
$sub_title => undef
+$error => undef
+$message => undef
+$notice => undef
</%args>
<!DOCTYPE HTML>
@@ -18,6 +21,7 @@ $sub_title => undef
<div class="container-fluid" id="content">
<span id="curs-contact-page-link"><& contact.mhtml, link_text => 'Questions? Contact curators ...' &></span>
+<& /err_mess_notice.mhtml, error => $error, message => $message, notice => $notice &>
% if ($show_title) {
<div id="canto-title-section">
View
@@ -0,0 +1,83 @@
+<%args>
+$error => undef
+$message => undef
+$notice => undef
+</%args>
+
+<div id="notice-list">
+% for my $notice (@notices) {
+<div class="notice">
+ <strong>
+ <% $notice->{title} %>
+ </strong>
+% if (exists $notice->{text}) {
+ <div>
+ <% $notice->{text} %>
+ </div>
+% }
+</div>
+% }
+</div>
+
+<div id="error-list">
+% for my $err (@errors) {
+<div class="error">
+ <strong>
+ <% $err->{title} %>
+ </strong>
+% if (exists $err->{text}) {
+ <div>
+ <% $err->{text} %>
+ </div>
+% }
+</div>
+% }
+</div>
+
+<div id="message-list">
+% for my $mess (@messages) {
+<div class="message">
+ <strong>
+ <% $mess->{title} %>
+ </strong>
+% if (exists $mess->{text}) {
+ <div>
+ <% $mess->{text} %>
+ </div>
+% }
+</div>
+% }
+</div>
+
+<%init>
+my $tidy = sub {
+ my $arg = shift;
+
+ if (!defined $arg) {
+ return ();
+ }
+
+ if (ref $arg) {
+ if (ref $arg eq 'ARRAY') {
+ return @$arg;
+ } else {
+ if (ref $arg eq 'HASH' && exists $arg->{title}) {
+ return $arg;
+ } else {
+ use Data::Dumper;
+ $Data::Dumper::Maxdepth = 5;
+ warn "error in stash is not an array, hash or scalar: ", Dumper([$arg]);
+
+ return ( { title => 'Internal error',
+ text => 'The problem will be investigated' } );
+ }
+ }
+ } else {
+ return { title => $arg };
+ }
+};
+
+my @errors = $tidy->($error);
+my @messages = $tidy->($message);
+my @notices = $tidy->($notice);
+</%init>

0 comments on commit 69f5094

Please sign in to comment.