Skip to content

Commit 654d005

Browse files
NateWrasmecher
authored andcommitted
pkp/pkp-lib#9262 Add highlights
1 parent 63df63a commit 654d005

File tree

16 files changed

+10084
-0
lines changed

16 files changed

+10084
-0
lines changed

api/v1/highlights/index.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* @defgroup api_v1_highlights Highlights API requests
4+
*/
5+
6+
/**
7+
* @file api/v1/highlights/index.php
8+
*
9+
* Copyright (c) 2014-2023 Simon Fraser University
10+
* Copyright (c) 2003-2023 John Willinsky
11+
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
12+
*
13+
* @ingroup api_v1_highlights
14+
*
15+
* @brief Handle API requests for highlights.
16+
*/
17+
18+
return new \PKP\API\v1\highlights\HighlightsHandler();

dbscripts/xml/install.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<migration class="PKP\migration\install\MetadataMigration" />
4545
<migration class="PKP\migration\install\AnnouncementsMigration" />
4646
<migration class="PKP\migration\install\CategoriesMigration" />
47+
<migration class="PKP\migration\install\HighlightsMigration" />
4748
<migration class="PKP\migration\install\InstitutionsMigration" />
4849
<migration class="APP\migration\install\MetricsMigration" />
4950

dbscripts/xml/upgrade.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109

110110
<upgrade minversion="3.4.0.0" maxversion="3.4.9.9">
111111
<migration class="PKP\migration\upgrade\v3_5_0\I9197_MigrateAccessKeys"/>
112+
<migration class="PKP\migration\upgrade\v3_5_0\I9262_Highlights"/>
112113
</upgrade>
113114

114115
<!-- update plugin configuration - should be done as the final upgrade task -->

pages/index/IndexHandler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ public function index($args, $request)
6060
$this->setupTemplate($request);
6161
$router = $request->getRouter();
6262
$templateMgr = TemplateManager::getManager($request);
63+
$templateMgr->assign([
64+
'highlights' => $this->getHighlights($server),
65+
]);
66+
6367
if ($server) {
6468
// OPS: sections
6569
$sections = Repo::section()->getCollector()->filterByContextIds([$server->getId()])->getMany();

plugins/themes/default/DefaultThemePlugin.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ public function init()
208208
$this->addScript('bsUtil', 'js/lib/bootstrap/util.js');
209209
$this->addScript('bsDropdown', 'js/lib/bootstrap/dropdown.js');
210210

211+
// Load Swiper for carousel
212+
$this->addScript('swiper', 'js/lib/swiper/swiper-bundle' . $min . '.js');
213+
$this->addStyle('swiper', 'js/lib/swiper/swiper-bundle' . $min . '.css');
214+
$this->addScript('swiper-i18n', $this->getSwiperI18n(), ['inline' => true]);
215+
211216
// Load custom JavaScript for this theme
212217
$this->addScript('default', 'js/main.js');
213218

@@ -256,6 +261,17 @@ public function getDescription()
256261
{
257262
return __('plugins.themes.default.description');
258263
}
264+
265+
/**
266+
* Get the locale strings for the swiper carousel
267+
*/
268+
public function getSwiperI18n(): string
269+
{
270+
return 'var pkpDefaultThemeI18N = ' . json_encode([
271+
'nextSlide' => __('plugins.themes.default.nextSlide'),
272+
'prevSlide' => __('plugins.themes.default.prevSlide'),
273+
]);
274+
}
259275
}
260276

261277
if (!PKP_STRICT_MODE) {

0 commit comments

Comments
 (0)