diff --git a/lib/WebGUI/Asset/Wobject/StoryTopic.pm b/lib/WebGUI/Asset/Wobject/StoryTopic.pm index de46ab5c0..b6e856440 100644 --- a/lib/WebGUI/Asset/Wobject/StoryTopic.pm +++ b/lib/WebGUI/Asset/Wobject/StoryTopic.pm @@ -172,6 +172,7 @@ sub viewTemplateVariables { $var->{topStoryCreationDate} = $topStory->get('creationDate'); ##TODO: Photo variables } + $var->{standAlone} = $self->{_standAlone}; return $var; } diff --git a/lib/WebGUI/Help/Asset_StoryTopic.pm b/lib/WebGUI/Help/Asset_StoryTopic.pm index 31fbc2aa5..e5418a4b0 100644 --- a/lib/WebGUI/Help/Asset_StoryTopic.pm +++ b/lib/WebGUI/Help/Asset_StoryTopic.pm @@ -19,6 +19,7 @@ our $HELP = { ], fields => [], variables => [ + { name => 'standAlone' }, { name => 'story_loop', variables => [ { name => 'url' }, diff --git a/lib/WebGUI/i18n/English/Asset_StoryTopic.pm b/lib/WebGUI/i18n/English/Asset_StoryTopic.pm index 426d64fd2..574e24037 100644 --- a/lib/WebGUI/i18n/English/Asset_StoryTopic.pm +++ b/lib/WebGUI/i18n/English/Asset_StoryTopic.pm @@ -99,6 +99,12 @@ our $I18N = { lastUpdated => 0, }, + 'standAlone' => { + message => q|This variable will be true if the Story Topic is being viewed directly, by its URL. Otherwise, if it is viewed as part of a Page Layout or other Container, it will be false.|, + context => q|Template variable.|, + lastUpdated => 0, + }, + 'view template' => { message => q|View Story Topic Template|, context => q|Template variable.|, diff --git a/t/Asset/Wobject/StoryTopic.t b/t/Asset/Wobject/StoryTopic.t index abea7f516..d7e3c093e 100644 --- a/t/Asset/Wobject/StoryTopic.t +++ b/t/Asset/Wobject/StoryTopic.t @@ -31,7 +31,7 @@ my $session = WebGUI::Test->session; #---------------------------------------------------------------------------- # Tests -my $tests = 8; +my $tests = 10; plan tests => 1 + $tests; #---------------------------------------------------------------------------- @@ -119,6 +119,7 @@ ok( && ! exists $templateVars->{topStoryCreationDate}, 'topStory variables not present unless in standalone mode' ); +ok(! $templateVars->{standAlone}, 'viewTemplateVars: not in standalone mode'); $topic->{_standAlone} = 1; $templateVars = $topic->viewTemplateVariables(); @@ -161,6 +162,7 @@ is( 'viewTemplateVars in standalone mode, url' ); is($templateVars->{topStoryCreationDate}, $now, 'viewTemplateVars in standalone mode, title'); +ok($templateVars->{standAlone}, 'viewTemplateVars: in standalone mode'); $topic->update({ storiesShort => 20,