New feature/66 browser native dataset file preview #2172
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.
Pull request for issue: #66
This PR adds a preview modal for the dataset table, eg http://gigadb.gigasciencejournal.com/dataset/100094
The video shows a handful of cases
Screencast from 10-01-25 16:20:33.webm
How to test?
In http://gigadb.gigasciencejournal.com/adminFile/create you can add any arbitrary files via their url to any dataset to test the modal, eg
https://s2.q4cdn.com/175719177/files/doc_presentations/Placeholder-PDF.pdf
https://images.pexels.com/photos/378570/pexels-photo-378570.jpeg
http://gigadb.gigasciencejournal.com/
https://raw.githubusercontent.com/gigascience/gigadb-website/refs/heads/develop/README.md
etc
How have functionalities been implemented?
added a button to the
protected/views/dataset/view.php
that opens a modal to preview the fileif the file is "not supported" the preview button is disabled. What is supported is defined by

protected/views/dataset/view.php:417
protected/views/dataset/_preview_modal.php
contains the code related to the preview modal. At the core, there is a conditional that determines what to do for each file type:this kind of structure is built to be easily extendable by adding more valid cases
I have also renamed the id of a preexisting modal to something more meaningful
Any issues with implementation?
--
Any changes to automated tests?
Added acceptance test that checks for the presence of the preview button and that it toggles a preview modal