Add top story subtitle to match the spec.

This commit is contained in:
Colin Kuskie 2009-03-19 17:32:48 +00:00
parent 26d87bf607
commit e06d53c122
5 changed files with 18 additions and 2 deletions

View file

@ -168,6 +168,7 @@ sub viewTemplateVariables {
##Note, this could have saved from the loop above, but this looks more clean and encapsulated to me.
my $topStory = WebGUI::Asset->new($session, $topStoryData->{assetId}, $topStoryData->{className}, $topStoryData->{revisionDate});
$var->{topStoryTitle} = $topStory->getTitle;
$var->{topStorySubtitle} = $topStory->get('subtitle');
$var->{topStoryUrl} = $session->url->append($self->getUrl, 'func=viewStory;assetId='.$topStoryData->{assetId}),
$var->{topStoryCreationDate} = $topStory->get('creationDate');
##TODO: Photo variables

View file

@ -28,6 +28,7 @@ our $HELP = {
],
},
{ name => 'topStoryTitle' },
{ name => 'topStorySubtitle' },
{ name => 'topStoryUrl' },
{ name => 'topStoryCreationDate' },
],

View file

@ -93,6 +93,12 @@ our $I18N = {
lastUpdated => 0,
},
'topStorySubtitle' => {
message => q|The subtitle of the top story.|,
context => q|Template variable.|,
lastUpdated => 0,
},
'topStoryCreationDate' => {
message => q|The epoch date when the top story was created, or submitted, to its Story Archive.|,
context => q|Template variable.|,

View file

@ -31,7 +31,7 @@ my $session = WebGUI::Test->session;
#----------------------------------------------------------------------------
# Tests
my $tests = 10;
my $tests = 11;
plan tests => 1 + $tests;
#----------------------------------------------------------------------------
@ -69,6 +69,8 @@ STORY: foreach my $name (@characters) {
$creationDateSth->execute([$now, $namedStory->getId]);
}
$storyHandler->{bogs}->update({subtitle => 'drinking his food through a straw'});
my $topic;
SKIP: {
@ -116,7 +118,8 @@ cmp_deeply(
ok(
! exists $templateVars->{topStoryTitle}
&& ! exists $templateVars->{topStoryUrl}
&& ! exists $templateVars->{topStoryCreationDate},
&& ! exists $templateVars->{topStoryCreationDate}
&& ! exists $templateVars->{topStorySubtitle},
'topStory variables not present unless in standalone mode'
);
ok(! $templateVars->{standAlone}, 'viewTemplateVars: not in standalone mode');
@ -156,6 +159,11 @@ cmp_deeply(
);
is($templateVars->{topStoryTitle}, 'bogs', 'viewTemplateVars in standalone mode, title');
is(
$templateVars->{topStorySubtitle},
'drinking his food through a straw',
'viewTemplateVars in standalone mode, subtitle'
);
is(
$templateVars->{topStoryUrl},
$session->url->append($topic->getUrl, 'func=viewStory;assetId='.$storyHandler->{'bogs'}->getId),