Skip to content

Commit

Permalink
Add template for /books/list action
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipadsmith committed Aug 15, 2011
1 parent 33a2527 commit 268cac8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Catalyst/Default.pm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ __PACKAGE__->config(
name => 'Catalyst::Default',
# Disable deprecated behavior needed by old applications
disable_component_resolution_regex_fallback => 1,
'View::HTML' => {
#Set the location for TT files
INCLUDE_PATH => [
__PACKAGE__->path_to( 'root', 'src' ),
],
},
);

# Start the application
Expand Down
20 changes: 20 additions & 0 deletions root/src/books/list.tt2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[% # This is a TT comment. The '-' at the end "chomps" the newline. You won't -%]
[% # see this "chomping" in your browser because HTML ignores blank lines, but -%]
[% # it WILL eliminate a blank line if you view the HTML source. It's purely -%]
[%- # optional, but both the beginning and the ending TT tags support chomping. -%]

[% # Provide a title -%]
[% META title = 'Book List' -%]

<table>
<tr><th>Title</th><th>Rating</th><th>Author(s)</th></tr>
[% # Display each book in a table row %]
[% FOREACH book IN books -%]
<tr>
<td>[% book.title %]</td>
<td>[% book.rating %]</td>
<td></td>
</tr>
[% END -%]
</table>

0 comments on commit 268cac8

Please sign in to comment.