Skip to content

Commit

Permalink
Update meta-box-subscription-info.php
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Jun 3, 2024
1 parent 197bf2b commit ca1f781
Showing 1 changed file with 59 additions and 66 deletions.
125 changes: 59 additions & 66 deletions views/meta-box-subscription-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@

<tr>
<th scope="row" rowspan="3">
<?php esc_html_e( 'Action links', 'pronamic_ideal' ); ?>
<?php esc_html_e( 'Customer action links', 'pronamic_ideal' ); ?>

<span class="dashicons dashicons-editor-help pronamic-pay-tip" title="<?php echo esc_attr__( 'These actions links can be shared with the customer.', 'pronamic_ideal' ); ?>" tabindex="0"></span>

Expand All @@ -280,22 +280,26 @@
?>
<script>
function pronamic_pay_action_links() {
var clipboard = new ClipboardJS( '.pronamic-pay-copy-url' ),
successTimeout;
const elements = document.querySelectorAll( '.pronamic-pay-copy-url' );

clipboard.on( 'success', function( event ) {
var triggerElement = jQuery( event.trigger ),
successElement = jQuery( '.success', triggerElement.closest( '.pronamic-pay-action-link-clipboard' ) );
elements.forEach( function ( element ) {
var clipboard = new ClipboardJS( element ),
successTimeout;

event.clearSelection();
clipboard.on( 'success', function( event ) {
var triggerElement = jQuery( event.trigger ),
successElement = jQuery( '.success', triggerElement.closest( '.pronamic-pay-action-link-clipboard' ) );

clearTimeout( successTimeout );
event.clearSelection();

successElement.removeClass( 'hidden' );
clearTimeout( successTimeout );

successTimeout = setTimeout( function() {
successElement.addClass( 'hidden' );
}, 3000 );
successElement.removeClass( 'hidden' );

successTimeout = setTimeout( function() {
successElement.addClass( 'hidden' );
}, 3000 );
} );
} );
}

Expand All @@ -320,7 +324,7 @@ function pronamic_pay_action_links() {

flex-direction: row;

justify-content: space-between;
justify-content: flex-start;

gap: 5px;
}
Expand All @@ -341,10 +345,6 @@ function pronamic_pay_action_links() {
color: #007017;
}

.pronamic-pay-action-link-anchor {
text-overflow: ellipsis;
}

.pronamic-pay-description {
color: #646970;
}
Expand All @@ -356,29 +356,27 @@ function pronamic_pay_action_links() {
<strong><?php esc_html_e( 'Cancel link', 'pronamic_ideal' ); ?></strong>
</div>

<div class="pronamic-pay-action-link-tool">
<div>
<?php
<div>
<?php

$url = $subscription->get_cancel_url();
$url = $subscription->get_cancel_url();

printf(
'<a href="%s">%s</a>',
esc_attr( $url ),
esc_html( $url )
);
printf(
'<a class="pronamic-pay-action-link-anchor" href="%s">%s</a>',
esc_attr( $url ),
esc_html( $url )
);

?>
</div>
?>
</div>

<div class="pronamic-pay-action-link-clipboard">
<button type="button" class="button button-small pronamic-pay-copy-url" data-clipboard-text="<?php echo \esc_url( $url ); ?>"><?php \esc_html_e( 'Copy URL to clipboard', 'pronamic_ideal' ); ?></button>
<span class="success hidden" aria-hidden="true"><?php \esc_html_e( 'Copied!', 'pronamic_ideal' ); ?></span>
</div>
<div class="pronamic-pay-action-link-clipboard">
<button type="button" class="button button-small pronamic-pay-copy-url" data-clipboard-text="<?php echo \esc_url( $url ); ?>"><?php \esc_html_e( 'Copy URL to clipboard', 'pronamic_ideal' ); ?></button>
<span class="success hidden" aria-hidden="true"><?php \esc_html_e( 'Copied!', 'pronamic_ideal' ); ?></span>
</div>

<div class="pronamic-pay-description">
This link can be shared with the customer and gives the customer the option to cancel this subscription.
<?php \esc_html_e( 'This link can be shared with the customer and gives the customer the option to cancel this subscription.', 'pronamic_ideal' ); ?>
</div>
</div>
</td>
Expand All @@ -390,29 +388,27 @@ function pronamic_pay_action_links() {
<strong><?php esc_html_e( 'Renewal link', 'pronamic_ideal' ); ?></strong>
</div>

<div class="pronamic-pay-action-link-tool">
<div>
<?php
<div>
<?php

$url = $subscription->get_renewal_url();
$url = $subscription->get_renewal_url();

printf(
'<a href="%s">%s</a>',
esc_attr( $url ),
esc_html( $url )
);
printf(
'<a class="pronamic-pay-action-link-anchor" href="%s">%s</a>',
esc_attr( $url ),
esc_html( $url )
);

?>
</div>
?>
</div>

<div class="pronamic-pay-action-link-clipboard">
<button type="button" class="button button-small pronamic-pay-copy-url" data-clipboard-text="<?php echo \esc_url( $url ); ?>"><?php \esc_html_e( 'Copy URL to clipboard', 'pronamic_ideal' ); ?></button>
<span class="success hidden" aria-hidden="true"><?php \esc_html_e( 'Copied!', 'pronamic_ideal' ); ?></span>
</div>
<div class="pronamic-pay-action-link-clipboard">
<button type="button" class="button button-small pronamic-pay-copy-url" data-clipboard-text="<?php echo \esc_url( $url ); ?>"><?php \esc_html_e( 'Copy URL to clipboard', 'pronamic_ideal' ); ?></button>
<span class="success hidden" aria-hidden="true"><?php \esc_html_e( 'Copied!', 'pronamic_ideal' ); ?></span>
</div>

<div class="pronamic-pay-description">
This link can be shared with the customer and gives the customer the option to (early) renew the subscription.
<?php \esc_html_e( 'This link can be shared with the customer and gives the customer the option to (early) renew the subscription.', 'pronamic_ideal' ); ?>
</div>
</div>
</td>
Expand All @@ -424,30 +420,27 @@ function pronamic_pay_action_links() {
<strong><?php esc_html_e( 'Change payment method link', 'pronamic_ideal' ); ?></strong>
</div>

<div class="pronamic-pay-action-link-tool">
<div>
<?php
<div>
<?php

$url = $subscription->get_mandate_selection_url();
$url = $subscription->get_mandate_selection_url();

printf(
'<a href="%s">%s</a>',
esc_attr( $url ),
esc_html( $url )
);
printf(
'<a class="pronamic-pay-action-link-anchor" href="%s">%s</a>',
esc_attr( $url ),
esc_html( $url )
);

?>
</div>
?>
</div>

<div class="pronamic-pay-action-link-clipboard">
<button type="button" class="button button-small pronamic-pay-copy-url" data-clipboard-text="<?php echo \esc_url( $url ); ?>"><?php \esc_html_e( 'Copy URL to clipboard', 'pronamic_ideal' ); ?></button>
<span class="success hidden" aria-hidden="true"><?php \esc_html_e( 'Copied!', 'pronamic_ideal' ); ?></span>
</div>
<div class="pronamic-pay-action-link-clipboard">
<button type="button" class="button button-small pronamic-pay-copy-url" data-clipboard-text="<?php echo \esc_url( $url ); ?>"><?php \esc_html_e( 'Copy URL to clipboard', 'pronamic_ideal' ); ?></button>
<span class="success hidden" aria-hidden="true"><?php \esc_html_e( 'Copied!', 'pronamic_ideal' ); ?></span>
</div>

<div class="pronamic-pay-description">
This link can be shared with the customer and gives the customer the opportunity to change the payment method.<br>
This is useful if a credit card expires or if a customer wants to have the charge debited from another account.
<?php \esc_html_e( 'This link can be shared with the customer and gives the customer the opportunity to change the payment method. This is useful if a credit card expires or if a customer wants to have the charge debited from another account.', 'pronamic_ideal' ); ?>
</div>
</div>
</td>
Expand Down

0 comments on commit ca1f781

Please sign in to comment.