Skip to content

Commit

Permalink
Do not show buttons on tool pages when not necessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
J08nY committed Dec 11, 2024
1 parent 4c498e7 commit a9fe338
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions _includes/tool_meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,29 @@
<tr><th scope="row">Tutorial</th><td><a href="{{ include.tutorials[0].url | relative_url }}"><b>yes</b></a></td></tr>
{% endif %}
</table>
{% if include.tutorials and include.tutorials.size > 0 %}
{% assign tutorials_button = true %}
{% else %}
{% assign tutorials_button = false %}
{% endif %}
{% capture script_name %}install_{{ include.tool.slug }}.sh{% endcapture %}
{% assign scripts = site.static_files | where_exp: "file", "file.name contains script_name" %}
{% if scripts and scripts.size > 0 %}
{% assign scripts_button = true %}
{% else %}
{% assign scripts_button = false %}
{% endif %}
<div id="tool-links">
{% if tutorials_button or scripts_button %}
<a href="{{ include.tool.url | relative_url }}"><button {% if include.which == "tool" %}class="inactive"{% endif %}>Tool page</button></a>
{% if include.tutorials and include.tutorials.size > 0 %}
{% endif %}

{% if tutorials_button %}
<a href="{{ include.tutorials[0].url | relative_url }}"><button {% if include.which == "tutorial" %}class="inactive"{% endif %}>Tutorial page</button></a>
{% endif %}
{% capture script_name %}install_{{ include.tool.slug }}.sh{% endcapture %}
{% assign scripts = site.static_files | where_exp: "file", "file.name contains script_name" %}
{% if scripts and scripts.size > 0 %}

{% if scripts_button %}
<a href="{{ scripts[0].path | relative_url }}"><button>Install script</button></a>
{% endif %}
</div>
</div>
</div>

0 comments on commit a9fe338

Please sign in to comment.