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#1613 Change event registration button text based on if there are additional participants #20251

Merged
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions CRM/Event/Form/Registration/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,7 @@ public function buildQuickForm() {
$this->add('select', 'additional_participants',
ts('How many people are you registering?'),
$additionalOptions,
NULL,
['onChange' => "allowParticipant()"]
NULL
);
$isAdditionalParticipants = TRUE;
}
Expand Down Expand Up @@ -514,7 +513,7 @@ public function buildQuickForm() {
$buttonParams['name'] = ts('Register');
}
else {
$buttonParams['name'] = ts('Review your registration');
$buttonParams['name'] = ts('Review');
$buttonParams['icon'] = 'fa-chevron-right';
}

Expand Down
25 changes: 22 additions & 3 deletions templates/CRM/Event/Form/Registration/Register.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@
<div class="crm-public-form-item crm-section additional_participants-section" id="noOfparticipants">
<div class="label">{$form.additional_participants.label} <span class="crm-marker" title="{ts}This field is required.{/ts}">*</span></div>
<div class="content">
{$form.additional_participants.html}{if $contact_id || $contact_id == NULL}{ts}(including yourself){/ts}{/if}
{$form.additional_participants.html}{if $contact_id || $contact_id == NULL}&nbsp;{ts}(including yourself){/ts}{/if}
<br/>
<span
class="description">{ts}Fill in your registration information on this page. If you are registering additional people, you will be able to enter their registration information after you complete this page and click &quot;Review your registration&quot;.{/ts}</span>
<div class="description" id="additionalParticipantsDescription" style="display: none;">{ts}Fill in your registration information on this page. You will be able to enter the registration information for additional people after you complete this page and click &quot;Continue&quot;.{/ts}</div>
</div>
<div class="clear"></div>
</div>
Expand Down Expand Up @@ -168,6 +167,26 @@
{/if}
{literal}

CRM.$(function($) {
$('#additional_participants').change(function() {
toggleAdditionalParticipants();
allowParticipant();
});

function toggleAdditionalParticipants() {
var submit_button = $("#crm-submit-buttons > button").html();
var review_translated = '{/literal}{ts escape="js"}Review{/ts}{literal}';
var continue_translated = '{/literal}{ts escape="js"}Continue{/ts}{literal}';
if ($('#additional_participants').val()) {
$("#additionalParticipantsDescription").show();
$("#crm-submit-buttons > button").html(submit_button.replace(review_translated, continue_translated));
} else {
$("#additionalParticipantsDescription").hide();
$("#crm-submit-buttons > button").html(submit_button.replace(continue_translated, review_translated));
}
}
});

function allowParticipant() {
{/literal}{if $allowGroupOnWaitlist}{literal}
var additionalParticipants = cj('#additional_participants').val();
Expand Down