Skip to content

Commit cc4fc5e

Browse files
committed
fix profile accept donations checkbox
1 parent a02c882 commit cc4fc5e

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

root/account/profile.tx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@
123123
%% my $donation = $author.donation.map(-> $d { $d.id }).grep.size();
124124
<div class="col-sm-8 col-md-6">
125125
<label class="checkbox">
126-
<input name="donations" type="checkbox"[% if $donation { %] checked="checked"[% } %] onchange="$('#metacpan_donations').slideToggle()" /> Accept donations
126+
<input name="donations" type="checkbox"[% if $donation { %] checked="checked"[% } %] /> Accept donations
127127
</label>
128128
</div>
129129
</div>
130-
<div id="metacpan_donations"[% if !$donation { %] style="display: none"[% } %]>
130+
<div id="metacpan_donations" class="slide-out [% if !$donation { 'slide-out-hidden' } %]">
131131
%% my $user_donations = $author.donation.indexed_by('name');
132132
%% for ['PayPal', 'Wishlist', 'Flattr'] -> $system {
133133
%% my $found = $user_donations[$system];

root/static/js/profile.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,15 @@ document.querySelector('.account-settings button.fill-location').addEventListene
119119
fillLocation();
120120
});
121121

122+
const donation_box = document.querySelector('#metacpan_donations');
123+
document.querySelector('.profile-form input[name="donations"]').addEventListener('change', (e) => {
124+
if (donation_box.classList.contains("slide-out-hidden")) {
125+
donation_box.classList.toggle("slide-out-hidden");
126+
}
127+
else {
128+
donation_box.classList.toggle("slide-up");
129+
}
130+
donation_box.classList.toggle("slide-down");
131+
});
132+
122133
});

root/static/less/global.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,9 @@ h1, .h1, h2, .h2, h3, .h3 {
475475
display: grid;
476476
grid-template-rows: 1fr;
477477
}
478+
.slide-out-hidden {
479+
grid-template-rows: 0fr;
480+
}
478481
.slide-out.slide-down {
479482
animation: slide-down 0.4s;
480483
}

0 commit comments

Comments
 (0)