topStory template variables should be available in standAlone and not standAlone modes. Added template variables for delete and edit icons for the top story. Updated the tests, template and template variable help. Fixes bug #11851.
This commit is contained in:
parent
9991a36c65
commit
ef6e78fc27
6 changed files with 36 additions and 19 deletions
|
|
@ -1,4 +1,5 @@
|
|||
7.10.1
|
||||
- fixed #11851: Story Topic: top story variables should be available all the time
|
||||
|
||||
7.10.0
|
||||
- fixed #11812: Checking www_ajaxSave's response in the cart js, urlencoding post parameters
|
||||
|
|
|
|||
|
|
@ -25,3 +25,15 @@ templates, you will need to apply these changes manually to your copies.
|
|||
}
|
||||
Gallery.DDSorting.url = '<tmpl_var url escape="js">';
|
||||
|
||||
* Story Topic Template
|
||||
Since topStory template variables are available all the time, manually add the topStory into the list of
|
||||
stories when the topic is no viewed standalone. Also note the new template variables for the the delete
|
||||
and edit icons for the top story.
|
||||
|
||||
<ul>
|
||||
<tmpl_unless standAlone>
|
||||
<li><tmpl_var topStoryDeleteIcon><tmpl_var topStoryEditIcon> <a href="<tmpl_var topStoryUrl>"><tmpl_var topStoryTitle></a></li>
|
||||
</tmpl_unless>
|
||||
<tmpl_loop story_loop>
|
||||
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -198,15 +198,17 @@ sub viewTemplateVariables {
|
|||
push @{$var->{story_loop}}, $storyVars;
|
||||
}
|
||||
|
||||
if ($self->{_standAlone} and @$storyIds) {
|
||||
if (@{ $storyIds }) {
|
||||
my $topStoryData = $storyIds->[0];
|
||||
shift @{ $var->{story_loop} };
|
||||
my $topStoryVars = shift @{ $var->{story_loop} };
|
||||
##Note, this could have saved from the loop above, but this looks more clean and encapsulated to me.
|
||||
my $topStory = WebGUI::Asset->newById($session, $topStoryData->{assetId}, $topStoryData->{revisionDate});
|
||||
$var->{topStoryTitle} = $topStory->getTitle;
|
||||
$var->{topStorySubtitle} = $topStory->subtitle;
|
||||
$var->{topStoryUrl} = $session->url->append($self->getUrl, 'func=viewStory;assetId='.$topStoryData->{assetId}),
|
||||
$var->{topStoryCreationDate} = $topStory->creationDate;
|
||||
$var->{topStoryEditIcon} = $topStoryVars->{editIcon};
|
||||
$var->{topStoryDeleteIcon} = $topStoryVars->{deleteIcon};
|
||||
##TODO: Photo variables
|
||||
my $photoData = $topStory->getPhotoData;
|
||||
PHOTO: foreach my $photo (@{ $photoData }) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ our $HELP = {
|
|||
{ name => 'editIcon' },
|
||||
],
|
||||
},
|
||||
{ name => 'topStoryDeleteIcon',
|
||||
description => 'deleteIcon', },
|
||||
{ name => 'topStoryEditIcon'
|
||||
description => 'editIcon', },
|
||||
{ name => 'topStoryTitle' },
|
||||
{ name => 'topStorySubtitle' },
|
||||
{ name => 'topStoryUrl' },
|
||||
|
|
|
|||
|
|
@ -111,11 +111,6 @@ cmp_deeply(
|
|||
cmp_deeply(
|
||||
$templateVars->{story_loop},
|
||||
[
|
||||
{
|
||||
title => 'bogs',
|
||||
url => $session->url->append($topic->getUrl, 'func=viewStory;assetId='.$storyHandler->{'bogs'}->getId),
|
||||
creationDate => $now,
|
||||
},
|
||||
{
|
||||
title => 'red',
|
||||
url => $session->url->append($topic->getUrl, 'func=viewStory;assetId='.$storyHandler->{'red'}->getId),
|
||||
|
|
@ -131,11 +126,11 @@ cmp_deeply(
|
|||
);
|
||||
|
||||
ok(
|
||||
! exists $templateVars->{topStoryTitle}
|
||||
&& ! exists $templateVars->{topStoryUrl}
|
||||
&& ! exists $templateVars->{topStoryCreationDate}
|
||||
&& ! exists $templateVars->{topStorySubtitle},
|
||||
'topStory variables not present unless in standalone mode'
|
||||
exists $templateVars->{topStoryTitle}
|
||||
&& exists $templateVars->{topStoryUrl}
|
||||
&& exists $templateVars->{topStoryCreationDate}
|
||||
&& exists $templateVars->{topStorySubtitle},
|
||||
'topStory variables present in standalone mode'
|
||||
);
|
||||
ok(! $templateVars->{standAlone}, 'viewTemplateVars: not in standalone mode');
|
||||
|
||||
|
|
@ -234,8 +229,9 @@ $topic->update({
|
|||
|
||||
$topic->{_standAlone} = 0;
|
||||
|
||||
$templateVars = $topic->viewTemplateVariables;
|
||||
$templateVars = $topic->viewTemplateVariables;
|
||||
my @topicInmates = map { $_->{title} } @{ $templateVars->{story_loop} };
|
||||
unshift @topicInmates, $templateVars->{topStoryTitle};
|
||||
cmp_deeply(
|
||||
\@topicInmates,
|
||||
[@inmates, 'Yesterday is history'], #extra for pastStory
|
||||
|
|
@ -250,11 +246,6 @@ $templateVars = $topic->viewTemplateVariables;
|
|||
cmp_deeply(
|
||||
$templateVars->{story_loop},
|
||||
[
|
||||
{
|
||||
title => 'bogs',
|
||||
url => $storyHandler->{'bogs'}->getUrl,
|
||||
creationDate => $now,
|
||||
},
|
||||
{
|
||||
title => 'red',
|
||||
url => $storyHandler->{'red'}->getUrl,
|
||||
|
|
@ -336,7 +327,14 @@ $topic->update( { storySortOrder => 'Alphabetically' } );
|
|||
$templateVars = $topic->viewTemplateVariables();
|
||||
|
||||
cmp_deeply(
|
||||
$templateVars->{story_loop},
|
||||
[
|
||||
{
|
||||
title => $templateVars->{topStoryTitle},
|
||||
url => $templateVars->{topStoryUrl},
|
||||
creationDate => $templateVars->{topStoryCreationDate},
|
||||
},
|
||||
@{ $templateVars->{story_loop} },
|
||||
],
|
||||
[
|
||||
{
|
||||
title => "aaaay was history but isn't any more",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue