inveniosoftware / inveniosoftware/cookiecutter-invenio-instance
landing page: switch previewed file not working
- Dominant language
- Python
- Stars
- 6
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
The [JS](https://github.com/inveniosoftware/cookiecutter-invenio-instance/blob/master/%7B%7Bcookiecutter.project_shortname%7D%7D/%7B%7Bcookiecutter.package_name%7D%7D/theme/assets/js/%7B%7Bcookiecutter.package_name%7D%7D/previewer.js#L3) points to a `div` with id `files` that was removed form here in order to use the `invenio-previwer` macros.
Something like this in `record.html` would fix it:
``` html
{% from 'invenio_previewer/macros.html' import file_list, preview_file %}
{% macro preview_file_box(file, pid) %}
{%- if file -%}
{{- preview_file('invenio_records_ui.recid_previewer', pid=pid, filename=file.key) }}
{%- endif %}
{%- endmacro %}
{% macro file_list_box(files, pid) %}
{{ file_list(files, pid) }}
{%- endmacro %}
[....]
{%- set files = record.files %}
{{ preview_file_box(files|select_preview_file) }}
{{ file_list_box(files.dumps()) }}
```
Mainly note the *id*s in the outer div of each macro.
`dumps()` is needed due to https://github.com/inveniosoftware/invenio-records-files/issues/96
P.S: I think this is done https://github.com/inveniosoftware/cookiecutter-invenio-instance/issues/173 and should be closed?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the referenced previewer.js line and the record.html template, then compare them with the invenio-previewer macros described in the issue. Check the status of issue 173 before starting, and verify that selecting a file switches the preview after the template changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, javascript, python
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100