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

Add link to README file in dataset page #2155

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

- Feat #1289: Add link to README file in dataset page
- Fix #1727: Sort files and samples by id in descending order when querying

## v4.4.1 - 2024-12-24 - 51c426dfe -
## v4.4.1 - 2024-12-24 - 51c426dfe -

- Feat #2067: Sort files by size in dataset page
- Feat #372: Save dataset as xml in log
Expand Down
15 changes: 13 additions & 2 deletions protected/views/dataset/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,18 @@ function showText() {
<div role="tabpanel" class="tab-pane" id="files">
<?php } else { ?>
<div role="tabpanel" class="tab-pane active" id="files">
<?php } ?>
<?php }
$file_models = $fileDataProvider->getData();
$readme_file = array_filter($file_models, function($file) {
return $file['type'] === 'Readme';
});
$readme_file = !empty($readme_file) ? reset($readme_file) : null;
?>
<?php if ($readme_file): ?>
<div>
<a href="<?= $readme_file['location'] ?>" target="_blank" aria-label="Open README file for this dataset in a new tab">Open README File for this dataset</a>
</div>
<?php endif; ?>
<p class="pull-left">
Click on a table column to sort the results.
</p>
Expand All @@ -410,7 +421,7 @@ function showText() {
</tr>
</thead>
<tbody>
<?php $file_models = $fileDataProvider->getData();
<?php
foreach ($file_models as $file) {
?>
<tr>
Expand Down
9 changes: 8 additions & 1 deletion tests/acceptance/DatasetView.feature
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,11 @@ Feature: a user visit the dataset page
And I follow "Files"
When I follow "[aria-label^='Size']"
And I follow "[aria-label^='Size']"
Then I should see "3.88 GB" in the table "#files_table" cell 1 6
Then I should see "3.88 GB" in the table "#files_table" cell 1 6

@issue-1289
Scenario: Link to README file is displayed in files tab
Given I have not signed in
And I am on "/dataset/100006"
When I follow "Files"
Then I should see "Open README File for this dataset"