Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#4310 Fix layout regression in MembershipBlock for Contribution pages #26320

Merged
merged 1 commit into from
May 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 24 additions & 27 deletions templates/CRM/Contribute/Form/Contribution/MembershipBlock.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
| and copyright information, see https://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{if $context EQ "makeContribution"}
<div id="membership" class="crm-group membership-group">

<div id="membership" class="crm-group membership-group">
{if $context EQ "makeContribution"}
<div id="priceset">
<fieldset>
{if $renewal_mode}
Expand Down Expand Up @@ -53,6 +52,27 @@
{include file="CRM/Price/Form/PriceSet.tpl" extends="Membership"}
</fieldset>
</div>
{literal}
<script type="text/javascript">
CRM.$(function($) {
//if price set is set we use below below code to show for showing auto renew
var autoRenewOption = {/literal}'{$autoRenewOption}'{literal};
var autoRenew = $("#auto_renew_section");
var autoRenewCheckbox = $("#auto_renew");
var forceRenew = $("#force_renew");
autoRenew.hide();
forceRenew.hide();
if ( autoRenewOption == 1 ) {
autoRenew.show();
} else if ( autoRenewOption == 2 ) {
autoRenewCheckbox.prop('checked', true );
autoRenewCheckbox.attr( 'readonly', true );
autoRenew.hide();
forceRenew.show();
}
});
</script>
{/literal}
{elseif $lineItem and $priceSetID AND !$is_quick_config}
{assign var="totalAmount" value=$amount}
<div class="header-dark">
Expand All @@ -61,29 +81,6 @@
<div class="display-block">
{include file="CRM/Price/Page/LineItem.tpl" context="Membership"}
</div>

</div>
{literal}
<script type="text/javascript">
CRM.$(function($) {
//if price set is set we use below below code to show for showing auto renew
var autoRenewOption = {/literal}'{$autoRenewOption}'{literal};
var autoRenew = $("#auto_renew_section");
var autoRenewCheckbox = $("#auto_renew");
var forceRenew = $("#force_renew");
autoRenew.hide();
forceRenew.hide();
if ( autoRenewOption == 1 ) {
autoRenew.show();
} else if ( autoRenewOption == 2 ) {
autoRenewCheckbox.prop('checked', true );
autoRenewCheckbox.attr( 'readonly', true );
autoRenew.hide();
forceRenew.show();
}
});
</script>
{/literal}
{elseif $membershipBlock AND !$is_quick_config}
<div id="membership" class="crm-group membership-group">
{if $context EQ "makeContribution"}
Expand Down Expand Up @@ -134,7 +131,7 @@
</div>

{/if}{* membership block end here *}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we put the js right before this if - this if is effectively 'if this is the Main page'- so it would always be present - I have a feeling {elseif $lineItem and $priceSetID AND !$is_quick_config} is never true but it seems to be in there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton that {/if} is after a couple of {elseif}s, so not so much, no, as that will leave it outside of the makeContribution context and it won't do anything useful there, rendering the move pointless. This is one of the changes in the commit that introduced this regression.

Right after the {if} might make sense; however it's worth noting that there's no autorenewal checkbox on either the review or thank you pages, meaning it's pointless on those pages anyway.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agileware-fj yep - if should only be in the context = makeContribution - & always there when it is I think?


</div>
{if $membershipBlock AND $is_quick_config}
{if $context neq "makeContribution" }
<div class="header-dark">
Expand Down