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

[Question] How can I display the name of the current collection in a listview page? #918

Open
BFallert opened this issue Feb 27, 2023 · 6 comments
Labels
⁉ question A non-code issue or question.

Comments

@BFallert
Copy link
Collaborator

BFallert commented Feb 27, 2023

When a collection is clicked on a page that contains a collection list (plugin: Collection), a normal ListView is called.

Currently, however, it is not visible in this ListView page that it was called via the link of a collection.
In the contained Typo3 variables it can be recognized via lastSearch[collection] that the template was called via a collection link, but instead of the collection name only the collection number is contained (i.e. the ID in the Typo3 database).

Is there a possibility to output the data of the collection list, especially display label, description, thumbnail, also in the ListView of a collection?

@michaelkubina
Copy link
Collaborator

The Listview-Controller provides such information via the currentCollection object. In the code it is even assigned to the view, but from what i see it does not get applied anywhere in the template (\Resources\Private\Templates\ListView\Main.html) by default.

It would be required add something like the snippet shown below to the template - but with a lot collections this information block might grow huge. And of course it needs to be styled in your CSS somehow.

I can only speak for certain that it works for the current master branch (not the last release). The current master has already the changes to the collection-plugin that i wrote. This being said i am not sure if the last release already returned a list of collections or just a single item. There were several severe bugs, that made collections not reliable or functional back then.

\Resources\Private\Templates\ListView\Main.html

...
            <f:for each="{currentCollection}" as="currentCollectionItem">
                <div class="collection">
                    <div class="collection-label">
                        <f:if condition="{currentCollectionItem.thumbnail}">
                            <f:image image="{currentCollectionItem.thumbnail}" />
                        </f:if>
                    <div>
                    <div class="collection-thumbnail">
                        <f:if condition="{currentCollectionItem.label}">
                            {currentCollectionItem.label}
                        </f:if>
                    </div>
                    <div class="collection-description">
                        <f:if condition="{currentCollectionItem.description}">
                            {currentCollectionItem.description}
                        </f:if>
                    </div>
                </div>
            </f:for>
...

@sebastian-meyer sebastian-meyer added the ⁉ question A non-code issue or question. label Feb 28, 2023
@BFallert
Copy link
Collaborator Author

I am working with the 4.x branch, but currentCollection does not exist.
currentCollection is not found anywhere in the source code?
Main-Branch and 4.x do not differ significantly.
Have your changes been incorporated elsewhere?
Am I looking in the wrong place?

@michaelkubina
Copy link
Collaborator

michaelkubina commented Feb 28, 2023

You are right, i am sorry! I have mistaken a local adjustment as part of the actual branch. You are right, there is no currentCollection in any branch. If you want to output the collection information, then you need to pass the already resolved collection(s) to your view in the ListViewController.php

$this->view->assign('currentCollection', $collection);

Then call it in the template as i stated above...

If you consider it an expected feature, it would be worth discussing if it should be an option in the listview-plugin.

@BFallert
Copy link
Collaborator Author

BFallert commented Mar 1, 2023

Thanks a lot! That helped me!

For me, it would be an expected feature of the ListView plugin.

It would be a simple straightforward way to display the data entered to a collection. I can put together a PR, then feel free to discuss it there.

@BFallert
Copy link
Collaborator Author

BFallert commented Mar 1, 2023

Just a few small corrections in case someone wants to use this as example

...
            <f:for each="{currentCollection}" as="currentCollectionItem">
                <div class="collection">
                    <div class="collection-thumbnail">
                        <f:if condition="{currentCollectionItem.thumbnail}">
                            <f:image image="{currentCollectionItem.thumbnail}" />
                        </f:if>
                    </div>
                    <div class="collection-label">
                        <f:if condition="{currentCollectionItem.label}">
                            {currentCollectionItem.label}
                        </f:if>
                    </div>
                    <div class="collection-description">
                        <f:if condition="{currentCollectionItem.description}">
                            <f:format.html>{currentCollectionItem.description}</f:format.html>
                        </f:if>
                    </div>
                </div>
            </f:for>
...

BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Mar 1, 2023
@sebastian-meyer
Copy link
Member

There are two different templates for the ListView in Kitodo.Presentation:

  • Resources/Private/Templates/ListView/Main.html
  • Resources/Private/Templates/Collection/List.html

The former is used as a default for any kind of list, that does not have its own template assigned. This template does not contain any information about collections.
The latter is used when ListView is called from within the Collection controller. This template handles collection information assigned by the Collection controller and displays those above the result list.

(At least this is how it should be working. If it's not, that's a bug...)

BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue May 11, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Oct 18, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Oct 20, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Oct 23, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Oct 24, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Oct 24, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Oct 25, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Oct 31, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Nov 6, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Nov 6, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Nov 8, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Nov 8, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Nov 13, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Nov 13, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Nov 21, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Nov 21, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Nov 22, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Nov 22, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Nov 22, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Nov 22, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Dec 4, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Dec 4, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Dec 6, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Dec 6, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Dec 18, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Dec 18, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Dec 20, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Dec 20, 2023
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Jan 29, 2024
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Jan 29, 2024
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Jan 29, 2024
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Jan 29, 2024
BFallert pushed a commit to BFallert/kitodo-presentation that referenced this issue Feb 12, 2024
jmechnich pushed a commit to UB-Mannheim/kitodo-presentation that referenced this issue Feb 13, 2024
jmechnich pushed a commit to UB-Mannheim/kitodo-presentation that referenced this issue Feb 13, 2024
BFallert pushed a commit to UB-Mannheim/kitodo-presentation that referenced this issue Feb 13, 2024
BFallert pushed a commit to UB-Mannheim/kitodo-presentation that referenced this issue Feb 29, 2024
BFallert pushed a commit to UB-Mannheim/kitodo-presentation that referenced this issue May 16, 2024
BFallert pushed a commit to UB-Mannheim/kitodo-presentation that referenced this issue May 21, 2024
BFallert pushed a commit to UB-Mannheim/kitodo-presentation that referenced this issue May 22, 2024
BFallert pushed a commit to UB-Mannheim/kitodo-presentation that referenced this issue May 22, 2024
BFallert pushed a commit to UB-Mannheim/kitodo-presentation that referenced this issue May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⁉ question A non-code issue or question.
Projects
None yet
Development

No branches or pull requests

3 participants