This repository was archived by the owner on Nov 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Add list of content to the homepage #64
Merged
The head ref may contain hidden characters: "homepage-lazy\u2014teaser"
Merged
Changes from all commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
2be2d28
Add homepage
thewilkybarkid 2350dfc
Not there anymore
thewilkybarkid 75b044d
Update existing tests
thewilkybarkid ab67c94
Use specific exception
thewilkybarkid 17a3b37
Merge branch 'master' into homepage
thewilkybarkid 2a92d14
Merge fixes
thewilkybarkid ace03ab
Set HTML title using translations
thewilkybarkid 3f35854
Add homepage to integration tests
thewilkybarkid 087a021
Fix and test title
thewilkybarkid 24045d5
Merge branch 'master' into homepage
thewilkybarkid 7222c0c
Extract PageEvent
thewilkybarkid 4ebe45f
Merge branch 'master' into homepage
thewilkybarkid 9b8a204
Missed some cases
thewilkybarkid 572d5c3
Merge branch 'master' into homepage
thewilkybarkid 737ff95
Return type
thewilkybarkid 9880898
Tweak configuration
thewilkybarkid 1bc13dc
Improve name
thewilkybarkid f125fbb
Changes
thewilkybarkid 9c244af
Merge branch 'master' into homepage-lazy
thewilkybarkid 06b0ce8
Merge branch 'master' of github.com:libero/browser into thewilkybarki…
nlisgo e658709
Introduce pattern library teaser templates
nlisgo ee06b3f
Introduce teaser pattern
nlisgo 95516a4
Note to set route to content
nlisgo d8a1bb2
Adjust arguments handled
nlisgo 84a4228
Use teaser-list template
nlisgo 029a201
cs
nlisgo 91d628b
Update vendor-extra/LiberoPageBundle/src/EventListener/BuildView/Item…
thewilkybarkid 137582f
Add in paths
thewilkybarkid d65a080
Merge branch 'master' into homepage-lazy—teaser
thewilkybarkid abba688
Make canHandleTemplate parameter optional
nlisgo ef374e7
Get teaser list working
nlisgo 8844a0e
Merge branch 'homepage-lazy—teaser-new' of github.com:nlisgo/libero-b…
nlisgo 8bbaabc
Re-introduce lazy view
nlisgo 1a0c5fa
cs
nlisgo b67c520
cs
nlisgo 2666132
Pass only front for teaser listeners in JatsContentBundle
nlisgo 942b30e
Add tests for FrontArticleTitleTeaserListener
nlisgo 57280e9
Add tests for ItemTeaserListener
nlisgo b8bb328
Merge branch 'master' into homepage-lazy—teaser
thewilkybarkid 6fa6615
Update homepage test and support Libero content
thewilkybarkid abd30d3
Fix list and add test
thewilkybarkid 922cf53
Add tests
thewilkybarkid 30d382d
Update config
thewilkybarkid f3b6e6c
Tidy
thewilkybarkid 7c2310e
Not needed here
thewilkybarkid 0cdb625
Add title
thewilkybarkid b7ee7af
Merge branch 'master' into homepage-lazy—teaser
thewilkybarkid 5868bdb
Set levels
thewilkybarkid 39edf12
Put in grid and fix levels
thewilkybarkid 61e5820
Set empty text
thewilkybarkid 10177c5
Update
thewilkybarkid 3bb1391
Update
thewilkybarkid 56ec635
Fix terminology
thewilkybarkid c3d74a4
Simplify
thewilkybarkid 63f41a0
Split into three
thewilkybarkid 9605f3e
Missing assertion
thewilkybarkid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...r-extra/JatsContentBundle/src/EventListener/BuildView/FrontArticleTitleTeaserListener.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Libero\JatsContentBundle\EventListener\BuildView; | ||
|
|
||
| use FluentDOM\DOM\Element; | ||
| use Libero\ViewsBundle\Views\SimplifiedViewConverterListener; | ||
| use Libero\ViewsBundle\Views\TemplateView; | ||
| use Libero\ViewsBundle\Views\View; | ||
| use Libero\ViewsBundle\Views\ViewConverter; | ||
| use function Libero\ViewsBundle\array_has_key; | ||
|
|
||
| final class FrontArticleTitleTeaserListener | ||
| { | ||
| use SimplifiedViewConverterListener; | ||
|
|
||
| private $converter; | ||
|
|
||
| public function __construct(ViewConverter $converter) | ||
| { | ||
| $this->converter = $converter; | ||
| } | ||
|
|
||
| protected function handle(Element $object, TemplateView $view) : View | ||
| { | ||
| $heading = $object->ownerDocument->xpath() | ||
| ->firstOf( | ||
| 'jats:article-meta/jats:title-group/jats:article-title', | ||
| $object | ||
| ); | ||
|
|
||
| if (!$heading instanceof Element) { | ||
| return $view; | ||
| } | ||
|
|
||
| return $view | ||
| ->withArgument( | ||
| 'heading', | ||
| $this->converter | ||
| ->convert($heading, '@LiberoPatterns/heading.html.twig', $view->getContext()) | ||
| ->getArguments() | ||
| ); | ||
| } | ||
|
|
||
| protected function canHandleTemplate(?string $template) : bool | ||
| { | ||
| return '@LiberoPatterns/teaser.html.twig' === $template; | ||
| } | ||
|
|
||
| protected function canHandleElement(string $element) : bool | ||
| { | ||
| return '{http://jats.nlm.nih.gov}front' === $element; | ||
| } | ||
|
|
||
| protected function canHandleArguments(array $arguments) : bool | ||
| { | ||
| return !array_has_key($arguments, 'heading'); | ||
| } | ||
| } |
71 changes: 71 additions & 0 deletions
71
vendor-extra/JatsContentBundle/src/EventListener/BuildView/ItemTeaserListener.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Libero\JatsContentBundle\EventListener\BuildView; | ||
|
|
||
| use FluentDOM\DOM\Element; | ||
| use Libero\ViewsBundle\Event\BuildViewEvent; | ||
| use Libero\ViewsBundle\Views\TemplateView; | ||
| use Libero\ViewsBundle\Views\View; | ||
| use Libero\ViewsBundle\Views\ViewConverter; | ||
| use function sprintf; | ||
|
|
||
| final class ItemTeaserListener | ||
| { | ||
| private $converter; | ||
|
|
||
| public function __construct(ViewConverter $converter) | ||
| { | ||
| $this->converter = $converter; | ||
| } | ||
|
|
||
| public function onBuildView(BuildViewEvent $event) : void | ||
| { | ||
| $object = $event->getObject(); | ||
| $view = $event->getView(); | ||
|
|
||
| if (!$view instanceof TemplateView || !$this->canHandleTemplate($view->getTemplate())) { | ||
| return; | ||
| } | ||
|
|
||
| if (!$this->canHandleElement(sprintf('{%s}%s', $object->namespaceURI, $object->localName))) { | ||
| return; | ||
| } | ||
|
|
||
| $handled = $this->handle($object, $view); | ||
|
|
||
| if (!$handled instanceof View) { | ||
| return; | ||
| } | ||
|
|
||
| $event->setView($handled); | ||
|
|
||
| $event->stopPropagation(); | ||
| } | ||
|
|
||
| protected function handle(Element $object, TemplateView $view) : ?View | ||
| { | ||
| $front = $object->ownerDocument->xpath() | ||
| ->firstOf( | ||
| '/libero:item/jats:article/jats:front', | ||
| $object | ||
| ); | ||
|
|
||
| if (!$front instanceof Element) { | ||
| return null; | ||
| } | ||
|
|
||
| return $this->converter->convert($front, $view->getTemplate(), $view->getContext()); | ||
| } | ||
|
|
||
| protected function canHandleTemplate(?string $template) : bool | ||
| { | ||
| return '@LiberoPatterns/teaser.html.twig' === $template; | ||
| } | ||
|
|
||
| protected function canHandleElement(string $element) : bool | ||
| { | ||
| return '{http://libero.pub}item' === $element; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems flexible enough to allow the different services, does it need additions to
sample-configurationthen?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
browser/vendor-extra/LiberoPageBundle/src/DependencyInjection/LiberoPageConfiguration.php
Lines 64 to 66 in 3bb1391
libero:item-list).