Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.

Add list of content to the homepage#64

Merged
thewilkybarkid merged 56 commits intolibero:masterfrom
nlisgo:homepage-lazy—teaser
Apr 9, 2019

Hidden character warning

The head ref may contain hidden characters: "homepage-lazy\u2014teaser"
Merged

Add list of content to the homepage#64
thewilkybarkid merged 56 commits intolibero:masterfrom
nlisgo:homepage-lazy—teaser

Conversation

@nlisgo
Copy link
Copy Markdown
Contributor

@nlisgo nlisgo commented Apr 2, 2019

No description provided.

@nlisgo nlisgo requested a review from a team as a code owner April 2, 2019 20:07
@nlisgo
Copy link
Copy Markdown
Contributor Author

nlisgo commented Apr 3, 2019

Since 84a4228 I am experiencing an issue with the heading variable not being available in the teaser template. I suspect the href is not available either. Not sure why this small adjustment is causing the teaser template not to work.

@thewilkybarkid thewilkybarkid changed the title [WIP] Add list of articles to the homepage [WIP] Add list of content to the homepage Apr 9, 2019
@thewilkybarkid thewilkybarkid changed the title [WIP] Add list of content to the homepage Add list of content to the homepage Apr 9, 2019
pages:
homepage:
path: '/'
primary_listing: 'scholarly-articles/items'
Copy link
Copy Markdown
Contributor

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-configuration then?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

->scalarNode('primary_listing')
->isRequired()
->end()
Is required, but can point at either content or search API (anything that returns a libero:item-list).

$listener->onBuildView($event);
$view = $event->getView();

$this->assertInstanceOf(TemplateView::class, $view);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the negative cases but what would be a way of shortening the assertion phases of these tests? Extract a custom assertion method that contains this phase seems cheap and effective.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this->assertEquals(new TemplateView('template'), $view); works.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exists in other tests too, will follow up with a refactor.


$element = $this->loadElement(
<<<XML
<libero:front xmlns:libero="http://libero.pub">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a pity that this is a completely duplicated test in another bundle, that just changes the input from JATS to libero XML.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be able to do something to help these different implementations and their test suites, but definitely one for the future.


$level = $view->getContext()['level'] ?? 1;
if ($view->hasContext('list_title')) {
$level++;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mutable counter in a long method, tricky

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think can break this listener up.

Copy link
Copy Markdown
Contributor

@thewilkybarkid thewilkybarkid Apr 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


return $view->withArgument(
'href',
$this->urlGenerator->generate("libero.page.content.{$service}", ['id' => $id])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good abstraction of UrlGenerator as an application service that is passed in where needed

private $client;
private $converter;

public function __construct(ClientInterface $client, ViewConverter $converter)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixing the Listeners with Clients is the dangerous part in terms of layering, but I'd agree there's no other clear option here at the moment

@thewilkybarkid thewilkybarkid merged commit 5bfb50b into libero:master Apr 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants