Skip to content

Commit

Permalink
Add a nice animation on successful refilling
Browse files Browse the repository at this point in the history
  • Loading branch information
klmp200 committed Dec 15, 2024
1 parent f63fb59 commit 379527c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions counter/static/bundled/counter/counter-click-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ exportToHtml("loadCounter", (config: CounterConfig) => {
).data.amount;
},

async onRefillingSuccess() {
await this.updateBalance();
document.getElementById("selling-accordion").click();
},

async handleCode(event: SubmitEvent) {
const code = (
$(event.target).find("#code_field").val() as string
Expand Down
4 changes: 2 additions & 2 deletions counter/templates/counter/counter_click.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</div>

<div id="click_form">
<h5>{% trans %}Selling{% endtrans %}</h5>
<h5 id="selling-accordion">{% trans %}Selling{% endtrans %}</h5>
<div>
{% set counter_click_url = url('counter:click', counter_id=counter.id, user_id=customer.user_id) %}

Expand Down Expand Up @@ -103,7 +103,7 @@
{% if refilling_fragment %}
<h5>{% trans %}Refilling{% endtrans %}</h5>
<div
@htmx:after-request="updateBalance()"
@htmx:after-request="onRefillingSuccess()"
>
{{ refilling_fragment }}
</div>
Expand Down

0 comments on commit 379527c

Please sign in to comment.