André Menrath
44daeb5b59
All checks were successful
PHP Code Checker / PHP Code Checker (push) Successful in 52s
PHPUnit / PHPUnit – PHP 7.4 (push) Successful in 1m5s
PHPUnit / PHPUnit – PHP 8.0 (push) Successful in 1m5s
PHPUnit / PHPUnit – PHP 8.1 (push) Successful in 1m7s
PHPUnit / PHPUnit – PHP 8.2 (push) Successful in 1m8s
PHPUnit / PHPUnit – PHP 8.3 (push) Successful in 1m3s
PHPUnit / PHPUnit – PHP 8.4 (push) Successful in 1m4s
Adds the option to compose a custom summary via shortcodes. ToDo: - [x] Integretion-Tests (covering text-only and complex addresses) - [x] Remove duplicated code - [x] Evaluate move shortcodes to Base Event transformer - [x] Commennts - [x] Readability/Maintenability - [x] Explain shortcodes and usage in Admin UI Reviewed-on: #80 Co-authored-by: André Menrath <andre.menrath@posteo.de> Co-committed-by: André Menrath <andre.menrath@posteo.de>
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
jQuery( function( $ ) {
|
|
// Accordion handling in various areas.
|
|
$( '.event-bridge-for-activitypub-settings-accordion' ).on( 'click', '.event-bridge-for-activitypub-settings-accordion-trigger', function() {
|
|
var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
|
|
|
|
if ( isExpanded ) {
|
|
$( this ).attr( 'aria-expanded', 'false' );
|
|
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true );
|
|
} else {
|
|
$( this ).attr( 'aria-expanded', 'true' );
|
|
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false );
|
|
}
|
|
} );
|
|
|
|
// Function to toggle visibility of custom details based on selected radio button.
|
|
function toggleCustomDetailsForSummary() {
|
|
if ($("#event_bridge_for_activitypub_summary_type_custom").is(':checked')) {
|
|
$("#event_bridge_for_activitypub_summary_type_custom-details").show();
|
|
} else {
|
|
$("#event_bridge_for_activitypub_summary_type_custom-details").hide();
|
|
}
|
|
}
|
|
|
|
// Run the toggle function on page load.
|
|
$(document).ready(function() {
|
|
window.console.log("test");
|
|
toggleCustomDetailsForSummary(); // Set the correct state on load.
|
|
|
|
// Listen for changes on the radio buttons
|
|
$("input[name=event_bridge_for_activitypub_summary_type]").change(function() {
|
|
toggleCustomDetailsForSummary(); // Update visibility on change.
|
|
});
|
|
});
|
|
} );
|