Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add template for /books/list action

  • Loading branch information...
commit 268cac856cdaa1995a15f4f83da3abe2f91d40ab 1 parent 33a2527
@phillipadsmith authored
Showing with 26 additions and 0 deletions.
  1. +6 −0 lib/Catalyst/Default.pm
  2. +20 −0 root/src/books/list.tt2
View
6 lib/Catalyst/Default.pm
@@ -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
View
20 root/src/books/list.tt2
@@ -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>
+
Please sign in to comment.
Something went wrong with that request. Please try again.