Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#9253 Add site-level announcements #1452

Open
wants to merge 2 commits into
base: stable-3_4_0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pages/index/IndexHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public function index($args, $request)
$this->validate(null, $request);
$press = $request->getPress();

$templateMgr = TemplateManager::getManager($request);
$this->_setupAnnouncements($press ?? $request->getSite(), $templateMgr);

if (!$press) {
$press = $this->getTargetContext($request, $hasNoContexts);
if ($press) {
Expand Down Expand Up @@ -129,8 +132,6 @@ public function _displayPressIndexPage($press, $request)
'authorUserGroups' => Repo::userGroup()->getCollector()->filterByRoleIds([\PKP\security\Role::ROLE_ID_AUTHOR])->filterByContextIds([$press->getId()])->getMany()->remember(),
]);

$this->_setupAnnouncements($press, $templateMgr);

// Display Featured Books
if ($press->getSetting('displayFeaturedBooks')) {
$featureDao = DAORegistry::getDAO('FeatureDAO'); /** @var FeatureDAO $featureDao */
Expand Down
3 changes: 2 additions & 1 deletion plugins/themes/default/styles/components.less
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,8 @@
}

// Announcements
.cmp_announcements {
// Double class rule overrides .pkp_structure_main ul
.cmp_announcements.cmp_announcements {
&:extend(.pkp_unstyled_list);
margin-left: -@base;
margin-right: -@base;
Expand Down
30 changes: 1 addition & 29 deletions templates/frontend/pages/index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,35 +45,7 @@
{include file="frontend/components/monographList.tpl" monographs=$newReleases titleKey="catalog.newReleases"}
{/if}

{* Announcements *}
{if $numAnnouncementsHomepage && $announcements|@count}
<div id="homepageAnnouncements" class="cmp_announcements highlight_first">
<h2>
{translate key="announcement.announcements"}
</h2>
{foreach name=announcements from=$announcements item=announcement}
{if $smarty.foreach.announcements.iteration > $numAnnouncementsHomepage}
{break}
{/if}
{if $smarty.foreach.announcements.iteration == 1}
{include file="frontend/objects/announcement_summary.tpl" heading="h3"}
<div class="more">
{else}
<article class="obj_announcement_summary">
<h4>
<a href="{url router=PKPApplication::ROUTE_PAGE page="announcement" op="view" path=$announcement->getId()}">
{$announcement->getLocalizedTitle()|escape}
</a>
</h4>
<div class="date">
{$announcement->getDatePosted()|date_format:$dateFormatShort}
</div>
</article>
{/if}
{/foreach}
</div><!-- .more -->
</div>
{/if}
{include file="frontend/objects/announcements_list.tpl" numAnnouncements=$numAnnouncementsHomepage}

{* Additional Homepage Content *}
{if $additionalHomeContent}
Expand Down
2 changes: 2 additions & 0 deletions templates/frontend/pages/indexSite.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
</div>
{/if}

{include file="frontend/objects/announcements_list.tpl" numAnnouncements=$numAnnouncementsHomepage}

<div class="presses">
<h2>
{translate key="context.contexts"}
Expand Down