9 <&| info_section.mas, title => 'Search Results',
10 subtitle => '3 matches',
11 empty_message => 'No matching monkeys found',
15 HTML and Mason contents of the info section,
16 as much stuff as you want.
24 Displays a paragraph with a title bar and provides a way to collapse
25 the content. A mason wrapper around
26 CXGN::Page::FormattingHelpers::info_section_html.
34 the title to be displayed in the title bar. Required.
38 a subtitle that goes next to the title. Optional.
42 The message that should appear when $contents is empty.
46 if true, forces this info_section to be drawn in the empty state,
47 content will not be shown.
51 if true, hide the info section completely (do not print anything) if
56 boolean - default false, a true value makes the section collapsible
61 boolean - a true value will draw the section in the collapsed state
65 boolean - a true value will draw the section as a subsection, with
66 slighly altered title bar and text rendering.
70 if set, add a text-align: $align CSS property to the div holding the
77 L<CXGN::Page::FormattingHelpers>
81 Lukas Mueller, based on the Perl code from Rob Buels.
91 $empty_message => "None"
102 % my $sub = $is_subsection ? 'sub_' : '';
104 <a class="info_section_anchor<% $sub ? ' info_subsection_anchor' : '' %>" name="<% anchor_name( $title ) %>"></a>
108 $contents ||= $m->content || '';
110 #if we have been given content, and we aren't told that this section
111 #is supposed to be empty, print a full section
112 if ( $contents =~ /\S/ && !$is_empty ) {
113 $align &&= qq| style="text-align: $align|;
114 $id ||= "sgnc" . int( rand(10000) );
116 <div class="${sub}infosectioncontent" $align>
121 if ( $collapsible ) {
122 ( $title, $contents ) = collapser(
125 hide_state_linktext => $title,
126 content => $contents,
127 collapsed => $collapsed,
133 my $title_bar = <<EOHTML;
134 <table cellspacing="0" cellpadding="0" class="${sub}infosectionhead" summary=""><tr><td class="${sub}infosectiontitle">$title</td><td class="${sub}infosectionsubtitle" role="button" tabindex="0">$subtitle </td></tr></table>
136 print "$title_bar\n$contents\n";
139 #otherwise, if it's actually empty, just print a collapsed section
140 #with the empty message
141 elsif( $hide_if_empty ) {
147 ? qq|<td class="${sub}infosectionsubtitle_empty" role="button" tabindex="0" align="right">$subtitle </td>|
150 <table cellspacing="0" cellpadding="0" class="${sub}infosectionhead_empty" summary=""><tr><td class="${sub}infosectiontitle_empty">$title</td><td class="${sub}infosection_emptymessage">$empty_message</td>$maybe_subtitle</tr></table>
157 use CXGN::Page::Widgets qw/collapser/;
160 no warnings 'redefine';
163 s/<[^>]+>//g; # strip html tags
164 s/\s+/_/g; # whitespace to underscores
165 s/\W//g; # remove any weird chars