Skip to content

Commit

Permalink
pkp/pkp-lib#9253 Add site-level announcements
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr authored and asmecher committed Nov 8, 2023
1 parent 3a30647 commit 553f073
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 30 deletions.
1 change: 1 addition & 0 deletions dbscripts/xml/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@
<migration class="PKP\migration\upgrade\v3_5_0\I9197_MigrateAccessKeys"/>
<migration class="PKP\migration\upgrade\v3_5_0\I9262_Highlights"/>
<migration class="APP\migration\upgrade\v3_5_0\I9262_Highlights"/>
<migration class="PKP\migration\upgrade\v3_5_0\I9253_SiteAnnouncements"/>
</upgrade>

<!-- Update plugin configuration - should be done as the final upgrade task -->
Expand Down
1 change: 1 addition & 0 deletions pages/index/IndexHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function index($args, $request)
'highlights' => $this->getHighlights($press),
]);

$this->_setupAnnouncements($journal ?? $request->getSite(), $templateMgr);
if ($press) {
// Display the current press home.
$this->_displayPressIndexPage($press, $request);
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 @@ -392,7 +392,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
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,11 @@
.cmp_button_text(@fa-var-chevron-right);
}
}

@media (min-width: @screen-tablet) {
.obj_announcement_summary_has_image {
display: grid;
grid-template-columns: 33% auto;
gap: @triple;
}
}
1 change: 1 addition & 0 deletions plugins/themes/default/styles/pages/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
}

> .obj_announcement_summary {
display: block;
position: relative;
padding: @triple @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 @@ -39,35 +39,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 @@ -22,6 +22,8 @@
</div>
{/if}

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

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

0 comments on commit 553f073

Please sign in to comment.