Skip to content

Commit

Permalink
refs #41429. Add event listeners for crmaccordion and fix tokenInput …
Browse files Browse the repository at this point in the history
…issue
  • Loading branch information
poliphilochu committed Sep 25, 2024
1 parent 364d0d6 commit 2659f33
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions js/jquery/jquery.crmaccordions.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ $.fn.crmaccordions = function() {
case "click":
$wrapper.toggleClass("crm-accordion-open");
$wrapper.toggleClass("crm-accordion-closed");

if ($wrapper.hasClass("crm-accordion-open")) {
$wrapper.trigger("crmaccordion:open");
} else {
$wrapper.trigger("crmaccordion:close");
}
return false;
break;

Expand Down
12 changes: 11 additions & 1 deletion templates/CRM/Event/Form/Search/Common.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,17 @@ var eventUrl = "{/literal}{$dataURLEvent}{literal}";
var eventPrepopulate = '';
{/if}
{literal}
cj("#event_id").tokenInput( eventUrl, { prePopulate: eventPrepopulate, classes: tokenClass, hintText: hintText });

cj(".crm-accordion-wrapper").on("crmaccordion:open", function() {
if (!cj(".crm-accordion-wrapper #event_id ~ .token-input-list-facebook").length) {
cj(".crm-accordion-wrapper #event_id").tokenInput( eventUrl, { prePopulate: eventPrepopulate, classes: tokenClass, hintText: hintText });
}
});
cj(document).ajaxSuccess(function(event, jqxhr, settings) {
if (jqxhr.responseText.indexOf('id="event_id"') != -1 && !cj("#event_id ~ .token-input-list-facebook").length) {
cj("#event_id").tokenInput( eventUrl, { prePopulate: eventPrepopulate, classes: tokenClass, hintText: hintText });
}
});

var typeUrl = "{/literal}{$dataURLEventType}{literal}";
{/literal}
Expand Down

0 comments on commit 2659f33

Please sign in to comment.