From c9fa63bdb7cc7627de37f26901cd6638a891d9e3 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 23 Jul 2009 21:17:25 +0000 Subject: [PATCH] Give StoryArchive sub-folders the same style as their parent. Fix to hide them better upcoming. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Wobject/StoryArchive.pm | 11 ++++---- t/Asset/Wobject/StoryArchive.t | 34 +++++++++++++++--------- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index c4f1f820c..f34f7fd68 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -29,6 +29,7 @@ - fixed #10651: Dashboard Content positions - fixed #10695: Adding a new article creates a new version tag - fixed #10693: double titels in help for Story Archive view template + - fixed Story Archive sub-folders should not use the failsafe style. 7.7.15 - fixed #10629: WebGUI::ProfileField create new field bug diff --git a/lib/WebGUI/Asset/Wobject/StoryArchive.pm b/lib/WebGUI/Asset/Wobject/StoryArchive.pm index e6c9a8bea..e251045a2 100644 --- a/lib/WebGUI/Asset/Wobject/StoryArchive.pm +++ b/lib/WebGUI/Asset/Wobject/StoryArchive.pm @@ -322,11 +322,12 @@ sub getFolder { ##Call SUPER because my addChild calls getFolder $folder = $self->SUPER::addChild({ - className => 'WebGUI::Asset::Wobject::Folder', - title => $folderName, - menuTitle => $folderName, - url => $folderUrl, - isHidden => 1, + className => 'WebGUI::Asset::Wobject::Folder', + title => $folderName, + menuTitle => $folderName, + url => $folderUrl, + isHidden => 1, + styleTemplateId => $self->get('styleTemplateId'), }); $newVersionTag->commit(); ##Restore the old one, if it exists diff --git a/t/Asset/Wobject/StoryArchive.t b/t/Asset/Wobject/StoryArchive.t index f6ed25953..5a5d0b7e7 100644 --- a/t/Asset/Wobject/StoryArchive.t +++ b/t/Asset/Wobject/StoryArchive.t @@ -63,7 +63,7 @@ $canPostMaker->prepare({ fail => [1, $reader ], }); -my $tests = 45 +my $tests = 46 + $canPostMaker->plan ; plan tests => 1 @@ -83,8 +83,14 @@ my $creationDateSth = $session->db->prepare('update asset set creationDate=? whe SKIP: { skip "Unable to load module $class", $tests unless $loaded; +my $home = WebGUI::Asset->getDefault($session); -$archive = WebGUI::Asset->getDefault($session)->addChild({className => $class, title => 'My Stories', url => '/home/mystories'}); +$archive = $home->addChild({ + className => $class, + title => 'My Stories', + url => '/home/mystories', + styleTemplateId => $home->get('styleTemplateId'), + }); $versionTag = WebGUI::VersionTag->getWorking($session); $versionTag->commit; @@ -118,16 +124,17 @@ $canPostMaker->run(); my $now = time(); my $todayFolder = $archive->getFolder($now); isa_ok($todayFolder, 'WebGUI::Asset::Wobject::Folder', 'getFolder created a Folder'); -is($archive->getChildCount, 1, 'getFolder created a child'); +is($archive->getChildCount, 1, '... created a child'); my $dt = DateTime->from_epoch(epoch => $now, time_zone => $session->datetime->getTimeZone); my $folderName = $dt->strftime('%B_%d_%Y'); $folderName =~ s/^(\w+_)0/$1/; -is($todayFolder->getTitle, $folderName, 'getFolder: folder has the right name'); +is($todayFolder->getTitle, $folderName, '... folder has the right name'); my $folderUrl = join '/', $archive->getUrl, lc $folderName; -is($todayFolder->getUrl, $folderUrl, 'getFolder: folder has the right URL'); -is($todayFolder->getParent->getId, $archive->getId, 'getFolder: created folder has the right parent'); -is($todayFolder->get('state'), 'published', 'getFolder: created folder is published'); -is($todayFolder->get('status'), 'approved', 'getFolder: created folder is approved'); +is($todayFolder->getUrl, $folderUrl, '... folder has the right URL'); +is($todayFolder->getParent->getId, $archive->getId, '... created folder has the right parent'); +is($todayFolder->get('state'), 'published', '... created folder is published'); +is($todayFolder->get('status'), 'approved', '... created folder is approved'); +is($todayFolder->get('styleTemplateId'), $archive->get('styleTemplateId'), '... created folder has correct styleTemplateId'); my $sameFolder = $archive->getFolder($now); is($sameFolder->getId, $todayFolder->getId, 'call with same time returns the same folder'); @@ -558,11 +565,12 @@ $archive->exportAssetCollateral($assetFile, {}, $session); my $exportedFiles = $exportStorage->getFiles(); cmp_bag( $exportedFiles, - [qw/ - mystories.rss mystories - mystories.atom - mystories.rdf - /], + [qw{ + mystories.rss mystories + mystories.atom mystories.rdf + mystories/index.html mystories/keyword_echo.html + mystories/keyword_roger.html mystories/keyword_foxtrot.html + }], 'exportAssetCollateral: feed files exported' );