From 303c0a796193848dbb7bf8019ed770b9ac1eb4a4 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Sun, 24 May 2015 17:47:50 -0500 Subject: [PATCH] use document templates to override page templates When a document has a template or layout set, the page will use that instead of the template/layout set by the application. This has revealed a bunch of technical debt around creating and giving template _objects_ to the Page. Since the Page has the Site which has the Theme, we don't need to give it objects. We can just give it arrays/strings and it can figure it out. Fixes #40 --- lib/Statocles/Document.pm | 8 +++++-- lib/Statocles/Page/Document.pm | 32 +++++++++++++++++++++++++++ t/page/document.t | 27 +++++++++++++++++++++- t/share/theme/document/recipe.html.ep | 3 +++ t/share/theme/layout/logo.html.ep | 2 ++ 5 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 t/share/theme/document/recipe.html.ep create mode 100644 t/share/theme/layout/logo.html.ep diff --git a/lib/Statocles/Document.pm b/lib/Statocles/Document.pm index 7739bc1f..b1033ccf 100644 --- a/lib/Statocles/Document.pm +++ b/lib/Statocles/Document.pm @@ -109,7 +109,9 @@ has date => ( =attr template -A template override for this document. +A template override for this document. If set, the L will use this instead of the template provided +by the application. =cut @@ -125,7 +127,9 @@ has template => ( =attr layout -A layout override for this document. +A layout template override for this document. If set, the L will use this instead of the layout provided +by the application. =cut diff --git a/lib/Statocles/Page/Document.pm b/lib/Statocles/Page/Document.pm index f6784ff2..ce6ead9b 100644 --- a/lib/Statocles/Page/Document.pm +++ b/lib/Statocles/Page/Document.pm @@ -131,6 +131,38 @@ sub tags { return @{ $self->_tags }; } +=method template() + +The L for this page. If the document has a template, +it will be used. Otherwise, the L