add export mode for StoryArchive.
Turn off search variables when in export mode.
This commit is contained in:
parent
fbbd63eaa5
commit
1ddf1b50a4
2 changed files with 50 additions and 7 deletions
|
|
@ -158,6 +158,24 @@ sub definition {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 exportHtml_view ( )
|
||||
|
||||
Extend the base method to change how the tag cloud works and the search
|
||||
interface.
|
||||
|
||||
Sets an internal flag to indicate that it is exporting to signal viewTemplateVars
|
||||
to make those changes.
|
||||
|
||||
=cut
|
||||
|
||||
sub exportHtml_view {
|
||||
my $self = shift;
|
||||
$self->{_exportMode} = 1;
|
||||
return $self->next::method(@_);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getFolder ( date )
|
||||
|
|
@ -376,12 +394,14 @@ sub viewTemplateVariables {
|
|||
startAsset => $self,
|
||||
displayFunc => 'view',
|
||||
});
|
||||
my $i18n = WebGUI::International->new($session, 'Asset');
|
||||
$var->{searchHeader} = WebGUI::Form::formHeader($session, { action => $self->getUrl })
|
||||
. WebGUI::Form::hidden($session, { name => 'func', value => 'view' });
|
||||
$var->{searchFooter} = WebGUI::Form::formFooter($session);
|
||||
$var->{searchButton} = WebGUI::Form::submit($session, { name => 'search', value => $i18n->get('search')});
|
||||
$var->{searchForm} = WebGUI::Form::text($session, { name => 'query', value => $query});
|
||||
if (! $self->{_exportMode}) {
|
||||
my $i18n = WebGUI::International->new($session, 'Asset');
|
||||
$var->{searchHeader} = WebGUI::Form::formHeader($session, { action => $self->getUrl })
|
||||
. WebGUI::Form::hidden($session, { name => 'func', value => 'view' });
|
||||
$var->{searchFooter} = WebGUI::Form::formFooter($session);
|
||||
$var->{searchButton} = WebGUI::Form::submit($session, { name => 'search', value => $i18n->get('search')});
|
||||
$var->{searchForm} = WebGUI::Form::text($session, { name => 'query', value => $query});
|
||||
}
|
||||
return $var;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ $canPostMaker->prepare({
|
|||
fail => [1, $reader ],
|
||||
});
|
||||
|
||||
my $tests = 31
|
||||
my $tests = 33
|
||||
+ $canPostMaker->plan
|
||||
;
|
||||
plan tests => 1
|
||||
|
|
@ -183,6 +183,18 @@ $creationDateSth->execute([$yesterday, $pastStory->getId]);
|
|||
|
||||
my $templateVars;
|
||||
$templateVars = $archive->viewTemplateVariables();
|
||||
|
||||
cmp_deeply(
|
||||
$templateVars,
|
||||
superhashof({
|
||||
searchHeader => ignore(),
|
||||
searchForm => ignore(),
|
||||
searchButton => ignore(),
|
||||
searchFooter => ignore(),
|
||||
}),
|
||||
'viewTemplateVars: search variables present'
|
||||
);
|
||||
|
||||
KEY: foreach my $key (keys %{ $templateVars }) {
|
||||
next KEY if isIn($key, qw/canPostStories addStoryUrl date_loop mode/);
|
||||
delete $templateVars->{$key};
|
||||
|
|
@ -387,6 +399,17 @@ cmp_bag(
|
|||
'keywordCloud template variable has keywords and correct links',
|
||||
);
|
||||
|
||||
$archive->{_exportMode} = 1;
|
||||
$templateVars = $archive->viewTemplateVariables();
|
||||
ok( ( !exists $templateVars->{searchHeader}
|
||||
&& !exists $templateVars->{searchForm}
|
||||
&& !exists $templateVars->{searchButton}
|
||||
&& !exists $templateVars->{searchForm}
|
||||
),
|
||||
'... export mode, no search variables present'
|
||||
);
|
||||
$archive->{_exportMode} = 0;
|
||||
|
||||
################################################################
|
||||
#
|
||||
# RSS and Atom checks
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue