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);
}
});
51 changes: 30 additions & 21 deletions src/themes/OLH/templates/journal/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -351,19 +351,24 @@ <h4>{% trans "Authors" %}</h4>
<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 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>
{% else %}
<p> {% trans 'Downloads are not available for this article.' %}</p>
{% endif %}

{% if proofing %}
<p id="note_to_proofreader_2">
<i class="fa fa-info"></i>
StephDriver marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -448,7 +453,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 +481,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
40 changes: 24 additions & 16 deletions src/themes/clean/templates/journal/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,19 @@ <h2>{% trans "Abstract" %}</h2>
<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/>
StephDriver marked this conversation as resolved.
Show resolved Hide resolved
{% 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 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 %}
{% else %}
<p> {% trans 'Downloads are not available for this article.' %}</p>
{% endif %}
</p>
{% if proofing %}
StephDriver marked this conversation as resolved.
Show resolved Hide resolved
<p id="note_to_proofreader_1">
Expand Down Expand Up @@ -313,13 +317,17 @@ <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 %}
Expand Down
60 changes: 32 additions & 28 deletions src/themes/material/templates/journal/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,48 +178,48 @@ <h2>{% trans "Funding" %}</h2>
<div class="card">
<div class="card-content center">
<div class="alm">
<p class="alm_numbers">
<h5>
{{ article.metrics.views }}
</p>
<p><i class="fa fa-eye"></i> {% trans "Views" %}</p>
</h5>
<p><i class="fa fa-eye"></i>{% trans "Views" %}</p>
</div>
<div class="alm">
<p class="alm_numbers">
<h5>
{{ article.metrics.downloads }}
</p>
<p><i class="fa fa-download"></i> {% trans "Downloads" %}</p>
</h5>
<p><i class="fa fa-download"></i>{% trans "Downloads" %}</p>
</div>
{% if article.metrics.alm.twitter %}
<div class="alm">
<p class="alm_numbers">
<h5>
{{ article.metrics.alm.twitter }}
</p>
<p><i class="fa fa-twitter"></i> {% trans "Tweets" %}</p>
</h5>
<p><i class="fa fa-twitter"></i>{% trans "Tweets" %}</p>
</div>
{% endif %}
{% if article.metrics.alm.wikipedia %}
<div class="alm">
<p class="alm_numbers">
<h5>
{{ article.metrics.alm.wikipedia }}
</p>
<p><i class="fa fa-wikipedia-w"></i> {% trans "Wikipedia" %}</p>
</h5>
<p><i class="fa fa-wikipedia-w"></i>{% trans "Wikipedia" %}</p>
</div>
{% endif %}
{% if article.metrics.alm.reddit %}
<div class="alm">
<p class="alm_numbers">
<h5>
{{ article.metrics.alm.reddit }}
</p>
<p><i class="fa fa-reddit"></i> {% trans "Reddit" %}</p>
</h5>
<p><i class="fa fa-reddit"></i>{% trans "Reddit" %}</p>
</div>
{% endif %}

{% if article.citation_count and not journal_settings.article.suppress_citations_metric %}
<div class="alm">
<p class="alm_numbers">
<h5>
{{ article.citation_count }}
</p>
<p><i class="fa fa-quote-left"></i> {% trans "Citations" %}</p>
</h5>
<p><i class="fa fa-quote-left"></i>{% trans "Citations" %}</p>
</div>
{% endif %}
</div>
Expand Down Expand Up @@ -254,13 +254,13 @@ <h4>
{% with article.get_doi_url as doi_url%}
<a class="waves-effect waves-light btn btn-small facebook-bg"
href="https://www.facebook.com/share.php?p[url]={% if doi_url %}{{ doi_url }}{% else %}{{ article.url }}{% endif %}"
target="_blank"><i class="fa fa-facebook"></i></a>
target="_blank" aria-label= {% trans "Share on Facebook" %}><i class="fa fa-facebook"></i></a>
<a class="waves-effect waves-light btn btn-small twitter-bg"
href="https://twitter.com/intent/tweet?text={{ article.title }} {% if doi_url %}{{ doi_url }}{% else %}{{ article.url }}{% endif %}"
target="_blank"><i class="fa fa-twitter"></i></a>
target="_blank" aria-label={% trans "Share on X" %}><i class="fa fa-twitter"></i></a>
<a class="waves-effect waves-light btn btn-small linkedin-bg"
href="https://www.linkedin.com/sharing/share-offsite?url={% if doi_url %}{{ doi_url }}{% else %}{{ article.url }}{% endif %}"
target="_blank"><i class="fa fa-linkedin"></i></a></button>
target="_blank" aria-label={% trans "Share on Linked In" %}><i class="fa fa-linkedin"></i></a></button>
StephDriver marked this conversation as resolved.
Show resolved Hide resolved
{% endwith %}

{% if article.frozen_authors.count > 0 %}
Expand Down Expand Up @@ -473,13 +473,17 @@ <h4>{% trans field.field.name %}</h4>
<h4>
{% trans "File Checksums" %} (MD5)
</h4>
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>
</div>
Expand Down