Skip to content

Commit

Permalink
Reduce redundant use of getCurrentPublication
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy-1 committed Mar 3, 2023
1 parent d2bab45 commit c0b00bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions templates/frontend/objects/article_summary.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*}

{assign var="articlePath" value=$article->getBestId()}
{assign var="publication" value=$article->getCurrentPublication()}

{if (!$section.hideAuthor && $article->getHideAuthor() == $smarty.const.AUTHOR_TOC_DEFAULT) || $article->getHideAuthor() == $smarty.const.AUTHOR_TOC_SHOW}
{assign var="showAuthor" value=true}
Expand All @@ -37,7 +38,9 @@
</div>
{/if}

{if $showAuthor || $article->getPages() || ($article->getDatePublished() && $showDatePublished)}
{assign var=submissionPages value=$publication->getData('pages')}
{assign var=submissionDatePublished value=$publication->getData('datePublished')}
{if $showAuthor || $submissionPages || ($submissionDatePublished && $showDatePublished)}
<div class="summary_meta">
{if $showAuthor}
<div class="authors">
Expand All @@ -46,15 +49,15 @@
{/if}

{* Page numbers for this article *}
{if $article->getPages()}
{if $submissionPages}
<div class="pages">
{$article->getPages()|escape}
{$submissionPages|escape}
</div>
{/if}

{if $showDatePublished && $article->getDatePublished()}
{if $showDatePublished && $submissionDatePublished}
<div class="published">
{$article->getDatePublished()|date_format:$dateFormatShort}
{$submissionDatePublished|date_format:$dateFormatShort}
</div>
{/if}

Expand All @@ -72,10 +75,10 @@
{/if}
{/if}
{assign var="hasArticleAccess" value=$hasAccess}
{if $currentContext->getSetting('publishingMode') == $smarty.const.PUBLISHING_MODE_OPEN || $article->getCurrentPublication()->getData('accessStatus') == $smarty.const.ARTICLE_ACCESS_OPEN}
{if $currentContext->getSetting('publishingMode') == $smarty.const.PUBLISHING_MODE_OPEN || $publication->getData('accessStatus') == $smarty.const.ARTICLE_ACCESS_OPEN}
{assign var="hasArticleAccess" value=1}
{/if}
{include file="frontend/objects/galley_link.tpl" parent=$article hasAccess=$hasArticleAccess purchaseFee=$currentJournal->getData('purchaseArticleFee') purchaseCurrency=$currentJournal->getData('currency')}
{include file="frontend/objects/galley_link.tpl" parent=$article publication=$publication hasAccess=$hasArticleAccess purchaseFee=$currentJournal->getData('purchaseArticleFee') purchaseCurrency=$currentJournal->getData('currency')}
{/foreach}
</div>
{/if}
Expand Down
2 changes: 1 addition & 1 deletion templates/frontend/objects/galley_link.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
{assign var="page" value="article"}
{assign var="parentId" value=$parent->getBestId()}
{* Get a versioned link if we have an older publication *}
{if $publication && $publication->getId() !== $parent->getCurrentPublication()->getId()}
{if $publication && $publication->getId() !== $parent->getData('currentPublicationId')}
{assign var="path" value=$parentId|to_array:"version":$publication->getId():$galley->getBestGalleyId()}
{else}
{assign var="path" value=$parentId|to_array:$galley->getBestGalleyId()}
Expand Down

0 comments on commit c0b00bd

Please sign in to comment.