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

3911 do not render empty lists on article page #4293

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
9 changes: 7 additions & 2 deletions src/themes/OLH/assets/js/table_of_contents.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$( document ).ready(function() {

if (!$("#toc")) {
return;
}
Expand Down Expand Up @@ -30,5 +30,10 @@ $( document ).ready(function() {

});

$("#toc").append(toc);
if(iter==0){
$("#toc-section").remove();
}
else{
$("#toc").append(toc);
}
});
80 changes: 45 additions & 35 deletions src/themes/OLH/templates/journal/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,27 +202,29 @@ <h2>{% trans "Publisher Notes" %}</h2>
{% endif %}

{% if article.is_published or proofing %}
{% if galleys %}
<div class="show-for-small-only">
<p>
<strong>{% trans 'Downloads' %}:</strong><br/>
<strong>{% trans 'Downloads' %}:</strong><br/>
{% if galleys %}
{% for galley in galleys %}
<a href="{% url 'article_download_galley' article.id galley.id %}">{% trans "Download" %} {{ galley.label }}</a>
<br/>
{% if galley.file.mime_type == 'application/pdf' and journal.view_pdf_button %}
<a target="_blank" href="{% url 'article_view_galley' article.id galley.id %}">{% trans 'View PDF' %}</a><br/>
{% endif %}
{% endfor %}
</p>
{% if proofing %}
<p id="note_to_proofreader_1">
<i class="fa fa-info"></i>
Note to proofreader: Download links on this page begin to work when the article is published.
</p>
{% if proofing %}
<p id="note_to_proofreader_1">
<i class="fa fa-info"></i>
Note to proofreader: Download links on this page begin to work when the article is published.
</p>
{% endif %}
{% else %}
<p> {% trans 'Downloads are not available for this article.' %}</p>
{% endif %}
</div>
{% endif %}
{% endif %}

{% if article.funders.all %}
<h2>{% trans "Funding" %}</h2>
Expand Down Expand Up @@ -350,25 +352,29 @@ <h4>{% trans "Authors" %}</h4>
{% endif %}
<div class="section">
{% if article.is_published or proofing %}
<h3>{% trans "Download" %}</h3>
<ul>
{% for galley in galleys %}
<li>
<a href="{% url 'article_download_galley' article.id galley.id %}">{% trans "Download" %} {{ galley.label }}</a>
{% if galley.file.mime_type == 'application/pdf' and journal.view_pdf_button %}
</li>
<li>
<a target="_blank" href="{% url 'article_view_galley' article.id galley.id %}">{% trans 'View PDF' %}</a>
</li>
{% endif %}
</li>
{% endfor %}
</ul>
{% if proofing %}
<p id="note_to_proofreader_2">
<i class="fa fa-info"></i>
Note to proofreader: Download links on this page begin to work when the article is published.
</p>
<h3>{% trans "Downloads" %}</h3>
{% if galleys %}
<ul>
{% for galley in galleys %}
<li>
<a href="{% url 'article_download_galley' article.id galley.id %}">{% trans "Download" %} {{ galley.label }}</a>
{% if galley.file.mime_type == 'application/pdf' and journal.view_pdf_button %}
</li>
<li>
<a target="_blank" href="{% url 'article_view_galley' article.id galley.id %}">{% trans 'View PDF' %}</a>
</li>
{% endif %}
</li>
{% endfor %}
</ul>
{% if proofing %}
<p id="note_to_proofreader_2">
<i class="fa fa-info"></i>
Note to proofreader: Download links on this page begin to work when the article is published.
</p>
{% endif %}
{% else %}
<p> {% trans 'Downloads are not available for this article.' %}</p>
{% endif %}
{% else %}
<p> {% trans 'Downloads are not available until this article is published ' %}</p>
Expand Down Expand Up @@ -448,7 +454,7 @@ <h3>{% trans "Non Specialist Summary" %}</h3>
{% endif %}

{% if article_content %}
<div class="section hide-for-small-only">
<div id="toc-section" class="section hide-for-small-only">
<h3>{% trans "Jump to" %}</h3>
<ul id="toc">

Expand Down Expand Up @@ -476,13 +482,17 @@ <h3>{{ article.preprint.repository.object_name }}</h3>

<div class="section hide-for-small-only">
<h3>{% trans "File Checksums" %} (MD5)</h3>
<ul>
{% for galley in galleys %}
<li>
<small>{{ galley.label }}: {{ galley.file.checksum }}</small>
</li>
{% endfor %}
</ul>
{% if galleys %}
<ul>
{% for galley in galleys %}
<li>
<small>{{ galley.label }}: {{ galley.file.checksum }}</small>
</li>
{% endfor %}
</ul>
{% else %}
<p> {% trans 'File Checksums are not available for this article.' %}</p>
{% endif %}
</div>

<div class="section hide-for-small-only">
Expand Down
104 changes: 57 additions & 47 deletions src/themes/clean/templates/journal/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,29 +96,31 @@ <h2>{% trans "Abstract" %}</h2>
{{ article.rights | safe }} </p>
{% endif %}
{% if article.is_published or proofing %}
{% if galleys %}
<div class="d-lg-none d-xl-none d-md-none">
StephDriver marked this conversation as resolved.
Show resolved Hide resolved
<p>
<strong>{% trans 'Downloads' %}></strong><br/>
{% for galley in galleys %}
<a href="{% url 'article_download_galley' article.id galley.id %}">{% trans "Download" %} {{ galley.label }}</a>
<br/>
{% if galley.file.mime_type == 'application/pdf' and journal.view_pdf_button %}
<a target="_blank"
href="{% url 'article_view_galley' article.id galley.id %}">View
PDF</a><br/>
<strong>{% trans 'Downloads' %}</strong><br/>
{% if galleys %}
{% for galley in galleys %}
<a href="{% url 'article_download_galley' article.id galley.id %}">{% trans "Download" %} {{ galley.label }}</a>
<br/>
{% if galley.file.mime_type == 'application/pdf' and journal.view_pdf_button %}
<a target="_blank"
href="{% url 'article_view_galley' article.id galley.id %}">View
PDF</a><br/>
{% endif %}
{% endfor %}
{% if proofing %}
<p id="note_to_proofreader_1">
<i class="fa fa-info"></i>
Note to proofreader: Download links on this page begin to work when the article is published.
</p>
{% endif %}
{% endfor %}
{% else %}
<p> {% trans 'Downloads are not available for this article.' %}</p>
{% endif %}
</p>
{% if proofing %}
<p id="note_to_proofreader_1">
<i class="fa fa-info"></i>
Note to proofreader: Download links on this page begin to work when the article is published.
</p>
{% endif %}
</div>
{% endif %}
{% endif %}
{% if article.funders.all %}
<strong>{% trans "Funding" %}</strong>
{% for funder in article.funders.all %}
Expand Down Expand Up @@ -185,26 +187,30 @@ <h2>{% trans "Authors" %}</h2>
{% endif %}

{% if article.is_published or proofing %}
<h2>{% trans "Download" %}</h2>
<ul>
{% for galley in galleys %}
{% if not galley.label == 'HTML' or not galley.file.mime_type == 'text/html' %}
<li>
<a href="{% url 'article_download_galley' article.id galley.id %}">{% trans "Download" %} {{ galley.label }}</a>
{% if galley.file.mime_type == 'application/pdf' and journal.view_pdf_button %}
</li>
<li>
<a target="_blank" href="{% url 'article_view_galley' article.id galley.id %}">{% trans "View" %} {{ galley.label }}</a>
<h2>{% trans "Downloads" %}</h2>
{% if galleys %}
<ul>
{% for galley in galleys %}
{% if not galley.label == 'HTML' or not galley.file.mime_type == 'text/html' %}
<li>
<a href="{% url 'article_download_galley' article.id galley.id %}">{% trans "Download" %} {{ galley.label }}</a>
{% if galley.file.mime_type == 'application/pdf' and journal.view_pdf_button %}
</li>
<li>
<a target="_blank" href="{% url 'article_view_galley' article.id galley.id %}">{% trans "View" %} {{ galley.label }}</a>
{% endif %}
</li>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
{% if proofing %}
<p id="note_to_proofreader_2">
<i class="fa fa-info"></i>
Note to proofreader: Download links on this page begin to work when the article is published.
</p>
{% endfor %}
</ul>
{% if proofing %}
<p id="note_to_proofreader_2">
<i class="fa fa-info"></i>
Note to proofreader: Download links on this page begin to work when the article is published.
</p>
{% endif %}
{% else %}
<p> {% trans 'Downloads are not available for this article.' %}</p>
{% endif %}
{% endif %}
{% if article.supplementary_files.all %}
Expand Down Expand Up @@ -313,22 +319,26 @@ <h2>{% trans "Citation" %}</h2>
<br/>
</div>
<h2>{% trans 'File Checksums' %}</h2> (MD5)
StephDriver marked this conversation as resolved.
Show resolved Hide resolved
<ul>
{% for galley in galleys %}
<li>
<small>{{ galley.label }}: {{ galley.file.checksum }}</small>
</li>
{% endfor %}
</ul>
{% if galleys %}
<ul>
{% for galley in galleys %}
<li>
<small>{{ galley.label }}: {{ galley.file.checksum }}</small>
</li>
{% endfor %}
</ul>
{% else %}
<p> {% trans 'File Checksums are not available for this article.' %}</p>
{% endif %}
{% endif %}
</div>
{% if article_content %}
<div class="sticky-top">
<h2>{% trans "Table of Contents" %}</h2>
<ul id="toc" class="table-of-contents"></ul>
<div class="sticky-top" id="toc-section">
<h2>{% trans "Table of Contents" %}</h2>
<ul id="toc" class="table-of-contents"></ul>
</div>
{% endif %}
</div>
</div>
</div>

{% include "elements/journal/citation_modals.html" %}
Expand Down
7 changes: 6 additions & 1 deletion src/themes/material/assets/toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,10 @@ $( document ).ready(function() {

});

$("#toc").append(toc);
if(iter==0){
$("#toc-section").remove();
}
else{
$("#toc").append(toc);
}
});
Loading