-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement upgrades for amount_extra and extra_donation
Various fixes and changes to the upgrade modal to support being able to upgrade your preordered merch or extra donation. Also slightly refactors how we handle upgrade fields so that it's less onerous to add new fields.
- Loading branch information
Showing
7 changed files
with
85 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,44 +8,51 @@ | |
add_ons | ||
perk_info | ||
donation | ||
upgrade_modal_js | ||
|
||
Use these to add or rearrange fields. Remember to use {{ super() }} to print the original fields as-is. | ||
#} | ||
|
||
{% set id_upgrade_prepend = "upgrade_" if upgrade_modal else "" %} | ||
|
||
{% block badge_type %} | ||
{% if not upgrade_modal %}{{ badge_extras.badge_type }}{% endif %} | ||
{{ badge_extras.badge_type(id=id_upgrade_prepend ~ "badge_type") }} | ||
|
||
{% if c.BADGE_TYPE_PRICES and (not receipt or upgrade_modal) %} | ||
<div class="row g-sm-3"> | ||
{{ form_macros.card_select(badge_extras.upgrade_badge_type if upgrade_modal else badge_extras.badge_type, | ||
attendee.available_badge_type_opts, disabled_opts=c.SOLD_OUT_BADGE_TYPES) }} | ||
</div> | ||
{% if upgrade_modal %} | ||
<script type="text/javascript"> | ||
$(function () { | ||
$("#upgrade_badge_type").on('change', function() { | ||
updateReceiptPreview('badge_type', this.value); | ||
}) | ||
}); | ||
</script> | ||
{% endif %} | ||
<div class="row g-sm-3"> | ||
{{ form_macros.card_select(badge_extras.badge_type, | ||
attendee.available_badge_type_opts, disabled_opts=c.SOLD_OUT_BADGE_TYPES, | ||
target_field_id=id_upgrade_prepend ~ "badge_type") }} | ||
</div> | ||
{% else %} | ||
<div class="row g-sm-3"> | ||
<div class="col-12 col-sm-6"> | ||
<div class="form-text">{{ badge_extras.badge_type.label.text }}</div> | ||
<div class="form-control-plaintext h5">{{ attendee.badge_type_label }}{% if c.MAX_BADGE_TYPE_UPGRADE and attendee.badge_type != c.MAX_BADGE_TYPE_UPGRADE %}{{ macros.upgrade_button('badge-type') }}{% endif %}</div> | ||
<div class="row g-sm-3"> | ||
<div class="col-12 col-sm-6"> | ||
<div class="form-text">{{ badge_extras.badge_type.label.text }}</div> | ||
<div class="form-control-plaintext h5">{{ attendee.badge_type_label }}{% if c.MAX_BADGE_TYPE_UPGRADE and attendee.badge_type != c.MAX_BADGE_TYPE_UPGRADE %}{{ macros.upgrade_button('badge-type') }}{% endif %}</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block add_ons %} | ||
{{ badge_extras.amount_extra }} | ||
{% if c.DONATIONS_ENABLED %} | ||
<div class="row g-sm-3"> | ||
{{ form_macros.card_select(badge_extras.amount_extra, attendee.available_amount_extra_opts, disabled_opts=c.SOLD_OUT_MERCH_TIERS) }} | ||
</div> | ||
{{ form_macros.toggle_fields_js(badge_extras.amount_extra, [badge_extras.shirt], off_values=["0"], toggle_required=True, closest_hide_selector='.row' if not attendee.gets_staff_shirt or c.SHIRT_OPTS == c.STAFF_SHIRT_OPTS else '.form-floating') }} | ||
{{ badge_extras.amount_extra(id=id_upgrade_prepend ~ "amount_extra") }} | ||
|
||
{% if c.DONATIONS_ENABLED and (not receipt or upgrade_modal) %} | ||
<div class="row g-sm-3"> | ||
{{ form_macros.card_select(badge_extras.amount_extra, | ||
attendee.available_amount_extra_opts, disabled_opts=c.SOLD_OUT_MERCH_TIERS, | ||
target_field_id=id_upgrade_prepend ~ "amount_extra") }} | ||
</div> | ||
{{ form_macros.toggle_fields_js(badge_extras.amount_extra, [badge_extras.shirt], off_values=["0"], toggle_required=True, | ||
closest_hide_selector='.row' if not attendee.gets_staff_shirt or c.SHIRT_OPTS == c.STAFF_SHIRT_OPTS else '.form-floating', | ||
source_field_id=id_upgrade_prepend ~ "amount_extra") }} | ||
{% else %} | ||
<div class="row g-sm-3"> | ||
<div class="col-12 col-sm-6"> | ||
<div class="form-text">{{ badge_extras.amount_extra.label.text }}</div> | ||
<div class="form-control-plaintext h5">{{ attendee.amount_extra_label }}{% if c.AVAILABLE_MERCH_TIERS and attendee.amount_extra < c.AVAILABLE_MERCH_TIERS[-1] %}{{ macros.upgrade_button('amount-extra') }}{% endif %}</div> | ||
</div> | ||
</div> | ||
{% endif %} | ||
{% endblock %} | ||
|
||
|
@@ -65,21 +72,44 @@ | |
{% block donation %} | ||
{% if c.COLLECT_EXTRA_DONATION %} | ||
<div class="row g-sm-3"> | ||
<div class="col-12 col-sm-6">{{ form_macros.form_input(badge_extras.extra_donation) }}</div> | ||
<div class="col-12 col-sm-6">{{ form_macros.form_input(badge_extras.extra_donation, id=id_upgrade_prepend ~ "extra_donation") }}</div> | ||
|
||
{% if not admin_area %} | ||
<div class="col-12 col-sm-6"> | ||
<div class="alert alert-warning" role="alert"> | ||
<strong>This donation <em>is not a kick-in</em> and does not come with merchandise.</strong><br/> | ||
{{ c.ORGANIZATION_NAME }} is a 501(c)(3) charitable organization, and additional donations may be tax deductible. | ||
Your employer may also have a charitable donation matching program. Email [email protected] for details. | ||
Your employer may also have a charitable donation matching program. Contact us at {{ c.CONTACT_URL }} for details. | ||
</div> | ||
</div> | ||
{% endif %} | ||
|
||
{% if receipt and not upgrade_modal and not admin_area %} | ||
<div class="form-text"> </div> | ||
<div class="col-12 col-sm-6">{{ macros.upgrade_button('extra-donation', extra_classes="") }}</div> | ||
{% endif %} | ||
|
||
{% if c.EXTRA_DONATION_URL %} | ||
<div class="col-12 col-sm-6">If you're interested in kicking in an extra donation, you can{% if c.COLLECT_EXTRA_DONATION %} also{% endif %} do so at any time of year at <a href="{{ c.EXTRA_DONATION_URL }}" target="_blank">{{ c.EXTRA_DONATION_URL }}</a>!</div> | ||
{% endif %} | ||
</div> | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block upgrade_modal_js %} | ||
{% if upgrade_modal %} | ||
<script type="text/javascript"> | ||
$(function () { | ||
$("#upgrade_badge_type").on('change', function() { | ||
updateReceiptPreview('badge_type', this.value); | ||
}) | ||
$("#upgrade_amount_extra").on('change', function() { | ||
updateReceiptPreview('amount_extra', this.value); | ||
}) | ||
$("#upgrade_extra_donation").on('blur', function() { | ||
updateReceiptPreview('extra_donation', this.value); | ||
}) | ||
}); | ||
</script> | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters