Add issue override form param to NewsletterCollection.
This commit is contained in:
parent
169d750b0e
commit
4daf1f6c9f
1 changed files with 19 additions and 7 deletions
|
|
@ -111,19 +111,28 @@ sub prepareView {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
sub getViewVars {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $self = shift;
|
||||
my $overrides = shift || {};
|
||||
my $session = $self->session;
|
||||
|
||||
my $var = $self->get;
|
||||
my $var = $self->get;
|
||||
|
||||
my $displayIssueId = $overrides->{ displayIssue };
|
||||
my $maxRecent = $self->get('recentIssueCount');
|
||||
my $recentCount = 0;
|
||||
|
||||
my $recentCount = 0;
|
||||
my @issues;
|
||||
my $issues = $self->getIssues;
|
||||
foreach my $issue ( @{ $issues } ) {
|
||||
my $issueVar = $issue->get;
|
||||
$issueVar->{ url } = $issue->getUrl;
|
||||
$issueVar->{ url } = $issue->getUrl;
|
||||
|
||||
if ( $recentCount < $self->get('recentIssueCount') ) {
|
||||
my $isRecent =
|
||||
( !$displayIssueId && $recentCount < $maxRecent )
|
||||
|| ( $issue->getId eq $displayIssueId )
|
||||
;
|
||||
|
||||
if ( $isRecent ) {
|
||||
$issueVar->{ content } = $self->getAssetContent( $issue );
|
||||
$issueVar->{ isRecent } = 1;
|
||||
$recentCount++;
|
||||
|
|
@ -145,8 +154,11 @@ sub getViewVars {
|
|||
#----------------------------------------------------------------------------
|
||||
sub view {
|
||||
my $self = shift;
|
||||
my $form = $self->session->form;
|
||||
|
||||
my $var = $self->getViewVars;
|
||||
my $var = $self->getViewVars( {
|
||||
displayIssue => $form->guid('displayIssue'),
|
||||
} );
|
||||
|
||||
return $self->processTemplate( $var, undef, $self->{_viewTemplate} );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue