Skip to content

Commit

Permalink
small loader qol on bib refresh + tweaking bib column span
Browse files Browse the repository at this point in the history
  • Loading branch information
acholyn committed Jan 6, 2025
1 parent f2e584b commit a9fd110
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
21 changes: 19 additions & 2 deletions src/rard/templates/research/citingauthor_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,33 @@ <h5>{% trans 'Linked Material' %}</h5>
<div>
<h5>{% trans 'Bibliography' %}</h5>
</div>
<div class="loader-wrapper">
<div class="loader" id="loader"></div>
</div>
<div class="d-flex flex-column">
{% if perms.research.change_citingauthor and has_object_lock %}
<button type="button" class='btn text-primary text-right d-block' hx-get="{% url "citingauthor:refresh_bibliography" pk=citingauthor.pk %}" hx-trigger="click">{% trans 'Refresh bibliography from mentions' %}</button>
<button type="button" id="bib-refresh" class='btn text-primary text-right d-block' hx-get="{% url "citingauthor:refresh_bibliography" pk=citingauthor.pk %}" hx-trigger="click">{% trans 'Refresh bibliography from mentions' %}</button>

{% endif %}
</div>
</div>

{% include 'research/partials/citing_author_bibliography_list.html' with bibliography_items=object.bibliography_items %}
</section>

{% endwith %}

<script>
document.addEventListener("DOMContentLoaded", function() {
const refreshBtn = document.getElementById("bib-refresh");
refreshBtn.addEventListener("click", function() {
const loader = document.querySelector('.loader-wrapper > .loader');
if (loader) {
loader.style.visibility = 'visible';
setTimeout(function() {
loader.style.visibility = 'hidden';
}, 2000);
}
});
});
</script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

<div class="col-sm-3"><a href='{% url "bibliography:detail" item.pk %}'>{{ item.authors }}</a></div>
<div class="col-sm-2">{% if item.year %}{{ item.year }}{% endif %}</div>
<div class="col-sm-4"><a href='{% url "bibliography:detail" item.pk %}'>{{ item.title|safe }}</a></div>

<div class="col-sm-6"><a href='{% url "bibliography:detail" item.pk %}'>{{ item.title|safe }}</a></div>

</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
hx-get="{% url 'citingauthor:bibliography' pk=citingauthor.pk %}"
hx-swap="outerHTML">


{% for item in bibliography_items.all %}

{% include 'research/partials/bibliography_list_item.html' with can_edit=perms.research.change_citingauthor has_object_lock=has_object_lock %}
Expand Down

0 comments on commit a9fd110

Please sign in to comment.