Skip to content

Commit

Permalink
Fix a few bugs in templates openlibhums/consortial_billing#74
Browse files Browse the repository at this point in the history
  • Loading branch information
joemull authored and ajrbyers committed Oct 31, 2024
1 parent ae91643 commit bcb0a84
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
26 changes: 11 additions & 15 deletions components/form/button.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
{% if aria_controls %}
aria-controls="{{ aria_controls }}"
aria-expanded="false"
aria-pressed="false"
{% endif %}
{% if id %}
id="{{ id }}"
Expand All @@ -30,16 +29,8 @@
p-4 not-prose
rounded-full border {{ border }} {{ fg }} {{ bg }}
flex gap-4 items-center
"
{% for attr in data_attributes %}
{{ attr }}
{% endfor %}
>
<span
class="
uppercase
font-poppins-bold text-xs tracking-widest
">
">
<span class="uppercase font-poppins-bold text-xs tracking-widest">
{% slot "text" default %}
Button
{% endslot %}
Expand All @@ -51,18 +42,23 @@
const thisButton = document.querySelector('[data-{{ pid }}]');
const form = thisButton.closest('form');
const allButtons = form.querySelectorAll('button');
// Make it clear the button is selected and that it has opened
// new content in the next section of the page.
thisButton.addEventListener('click', () => {
// First return other buttons in this form to normal
for (const button of allButtons) {
button.classList.remove('bg-white');
button.classList.remove('text-blue');
button.classList.add('text-white');
button.setAttribute('aria-pressed', 'false');
thisButton.setAttribute('aria-expanded', 'false');
if (button.hasAttribute('aria-controls')) {
button.setAttribute('aria-expanded', 'false');
}
}
thisButton.classList.add('bg-white');
thisButton.classList.add('text-blue');
thisButton.classList.remove('text-white');
thisButton.setAttribute('aria-pressed', 'true');
thisButton.setAttribute('aria-expanded', 'true');
if (thisButton.hasAttribute('aria-controls')) {
thisButton.setAttribute('aria-expanded', 'true');
}
})
</script>
2 changes: 1 addition & 1 deletion templates/custom/recommend-us-choose-article.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h2 class="text-white">Article{{ article_count|pluralize }} with “{{ query }}
<div class="not-prose">
<ul>
{% for article in articles %}
<li class="list-none">
<li class="list-none mt-4">
<div>{{ article.how_to_cite }}</div>
{% component_block "button_group" %}
{% url 'recommend_us_generate_email' as hx_post %}
Expand Down
2 changes: 1 addition & 1 deletion templates/custom/recommend-us-choose-journal.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h2 class="text-white">Journal{{ journal_count|pluralize }} with “{{ query }}
<div class="not-prose">
<ul>
{% for setting in journal_names %}
<li class="list-none">
<li class="list-none mt-4">
<div>{{ setting.value }}</div>
{% component_block "button_group" %}
{% url 'recommend_us_generate_email' as hx_post %}
Expand Down

0 comments on commit bcb0a84

Please sign in to comment.