Skip to content

Commit

Permalink
Fix dataset collapsible
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-Rey committed Oct 25, 2024
1 parent 7ff115d commit f430df1
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 31 deletions.
62 changes: 35 additions & 27 deletions preflib/_layouts/dataset.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ <h2>Details</h2>
<div class="all-data-files">
{% for file in data_files %}
<div class="data-file-wrapper">
<div class="data-file-title collapsible" id="{{ file.name }}">
{% assign num_related_files = file.related_files | size %}
{% assign collapsibleContent = false %}
{% if num_related_files > 0 or file.description != "" %}
{% assign collapsibleContent = true %}
{% else %}
{% assign collapsibleContent = false %}
{% endif %}
<div class="data-file-title{% if collapsibleContent %} collapsible{% endif %}" id="{{ file.name }}">
<div class="menu-icon"><div></div><div></div><div></div></div>
<div class="file-name">
{{ file.title }} &#8212; {{ file.name }}
Expand All @@ -76,36 +83,37 @@ <h2>Details</h2>
</div>
</div>

<div class="collapsible-content" style="display: none">
<div class="data-file-content">
{% if file.description %}
<p>
{{ file.description }}
</p>
{% endif %}
{% if collapsibleContent %}
<div class="collapsible-content" style="display: none">
<div class="data-file-content">
{% if file.description %}
<p>
{{ file.description }}
</p>
{% endif %}

{% assign num_related_files = file.related_files | size %}
{% if num_related_files > 0 %}
<p>The following file{% if num_related_files > 1 %}s are{% else %} is{% endif %} related to this file:</p>
<table class="data-file-related-files-table">
<tr>
<th>File name</th>
<th>Description</th>
<th></th>
</tr>
{% for related_file in file.related_files %}
{% if num_related_files > 0 %}
<p>The following file{% if num_related_files > 1 %}s are{% else %} is{% endif %} related to this file:</p>
<table class="data-file-related-files-table">
<tr>
<td>{{ related_file.name }}</td>
<td>{{ related_file.description }}</td>
<td>
<a href="{{ related_file.url }}" target="_blank" download>Download [{{ related_file.size | filesize_format }}]</a>
</td>
<th>File name</th>
<th>Description</th>
<th></th>
</tr>
{% endfor %}
</table>
{% endif %}
{% for related_file in file.related_files %}
<tr>
<td>{{ related_file.name }}</td>
<td>{{ related_file.description }}</td>
<td>
<a href="{{ related_file.url }}" target="_blank" download>Download [{{ related_file.size | filesize_format }}]</a>
</td>
</tr>
{% endfor %}
</table>
{% endif %}
</div>
</div>
</div>
{% endif %}
</div>
{% endfor %}
</div>
Expand Down
6 changes: 3 additions & 3 deletions preflib/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
gtag('config', 'UA-39177956-1');
</script>

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Kantumruy+Pro:ital,wght@0,100..700;1,100..700&family=Newsreader:ital,opsz,wght@0,6..72,200..800;1,6..72,200..800&family=Roboto+Flex:opsz,[email protected],100..1000&family=STIX+Two+Text:ital,wght@0,400..700;1,400..700&family=Tinos:ital,wght@0,400;0,700;1,400;1,700&family=Yrsa:ital,wght@0,300..700;1,300..700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Kantumruy+Pro:ital,wght@0,100..700;1,100..700&display=swap" rel="stylesheet">

<link rel="stylesheet" type="text/css" href="{{ '/assets/css/style.css' | relative_url }}"/>

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

<link rel="apple-touch-icon" sizes="180x180" href="{{ '/assets/favicon/apple-touch-icon.png' | relative_url }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ '/assets/favicon/favicon-32x32.png' | relative_url }}">
Expand Down
9 changes: 8 additions & 1 deletion preflib/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,9 @@ Download button
color: white;
background-color: var(--color-blue2);
box-shadow: 0 0 1px 0 var(--color-blue1);
padding: 4px;
padding: 10px 20px;
border-radius: 5px;
font-size: smaller;
}

.download-button:hover {
Expand Down Expand Up @@ -1311,3 +1312,9 @@ Collection page
display: flex;
justify-content: center;
}



.collapsible:hover {
cursor: pointer;
}

0 comments on commit f430df1

Please sign in to comment.