Skip to content

Commit

Permalink
Tweak - Test email input and button design (#1280)
Browse files Browse the repository at this point in the history
* Added - input_test_button field for test email purpose

* enhance - report test email design

* Fix - PHPCS issue

* global settings email template send test mail section design fix

* Fix - Spinner on test email and test email tooltip text

* Tweak - text of report email

* Changelog updated

---------

Co-authored-by: Ayush Shrestha <ayushstha143@gmail.com>
Co-authored-by: Deependra Chaudhary <elendoff11@gmail.com>
  • Loading branch information
3 people authored Jun 28, 2024
1 parent b971985 commit 86f3ae1
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 39 deletions.
18 changes: 18 additions & 0 deletions assets/css/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9658,6 +9658,24 @@
&--field {
flex: 1;

&.forminp-input_test_button {
@media screen and (max-width: 782px) {
display: flex;
flex-direction: column;
gap: 12px;

input[type="email"] {
width: 100%;
margin-right: 0 !important;
}

.button.everest_forms_send_email_test {
margin-bottom: 0;
width: max-content;
}
}
}

fieldset {
> label {
font-size: 14px;
Expand Down
8 changes: 4 additions & 4 deletions assets/js/admin/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,16 +307,16 @@
type: "post",
beforeSend: function() {
var spinner = '<i class="evf-loading evf-loading-active"></i>';
$(".everest_forms_send_email_test")
.closest(".everest_forms_send_email_test")
$(".everest_forms_send_routine_report_test_email")
.closest(".everest_forms_send_routine_report_test_email")
.append(spinner);
$(".everest-froms-send_test_email_notice").remove();
},
complete: function(response) {
var message_string = "";

$(".everest_forms_send_email_test")
.closest(".everest_forms_send_email_test")
$(".everest_forms_send_routine_report_test_email")
.closest(".everest_forms_send_routine_report_test_email")
.find(".evf-loading")
.remove();
$(".everest-froms-send_test_email_notice").remove();
Expand Down
3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

= 3.0.1 - xx-xx-2024
* Enhancement - Global Setting Premium Sidebar.
* Fix - Block design all messed up when viewed in block editor.
* Fix - Block design all messed up when viewed in block editor.
* Tweak - Test email input and button design.

= 3.0.0.1 - 27-05-2024
* Fix - Form builder loading when recaptcha is enabled.
Expand Down
70 changes: 63 additions & 7 deletions includes/admin/class-evf-admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public static function output_fields( $options ) {
case 'title':
if ( ! empty( $value['title'] ) ) {
$tabs = apply_filters( 'everest_forms_settings_tabs_array', array() );
$current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : '';
$current_tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : '';
$tabs_array = array();
if ( isset( $tabs[ $current_tab ] ) ) {
$tabs_array[ $current_tab ] = isset( $tabs_array[ $current_tab ] ) ? $tabs_array[ $current_tab ] : array();
Expand Down Expand Up @@ -784,13 +784,13 @@ class="<?php echo esc_attr( $value['class'] ); ?>"
?>
<div class="everest-forms-global-settings">
<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo wp_kses_post( $tooltip_html ); ?></label>
<div class="everest-forms-global-settings--field forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">
<div class="everest-forms-global-settings--field forminp-<?php echo isset( $value['type'] ) ? esc_attr( sanitize_title( $value['type'] ) ) : ''; ?>">
<?php
if ( isset( $value['buttons'] ) && is_array( $value['buttons'] ) ) {
foreach ( $value['buttons'] as $button ) {
?>
<a href="<?php echo esc_url( $button['href'] ); ?>" class="button <?php echo esc_attr( $button['class'] ); ?>"
style="<?php echo esc_attr( $value['css'] ); ?>"
<a href="<?php echo isset( $button['href'] ) ? esc_url( $button['href'] ) : ''; ?>" class="button <?php echo isset( $button['class'] ) ? esc_attr( $button['class'] ) : ''; ?>"
style="<?php echo isset( $value['css'] ) ? esc_attr( $value['css'] ) : ''; ?>"
<?php
if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) {
foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) {
Expand All @@ -799,19 +799,75 @@ class="<?php echo esc_attr( $value['class'] ); ?>"
}
?>
>
<?php echo esc_html( $button['title'] ); ?>
<?php echo isset( $button['title'] ) ? esc_html( $button['title'] ) : ''; ?>
</a>
<?php
}
}
?>
<?php echo esc_html( $value['suffix'] ); ?> <?php echo wp_kses_post( $description ); ?>
<?php echo isset( $value['suffix'] ) ? esc_html( $value['suffix'] ) : ''; ?> <?php echo isset( $description ) ? wp_kses_post( $description ) : ''; ?>
</div>
</div>
<?php
break;
case 'input_test_button':
$option_value = $value['value'];
$visibility_class = array();

// Default: run an action.
if ( isset( $value['is_visible'] ) ) {
$visibility_class[] = $value['is_visible'] ? 'everest-forms-visible' : 'everest-forms-hidden';
}

if ( empty( $option_value ) ) {
$option_value = $value['default'];
}

?>
<div class="everest-forms-global-settings <?php echo esc_attr( implode( ' ', $visibility_class ) ); ?>">
<label for="<?php echo esc_attr( $value['input_id'] ); ?>"><?php echo esc_html( $value['title'] ); ?> <?php echo wp_kses_post( $tooltip_html ); ?></label>
<div class="everest-forms-global-settings--field forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">
<input
name="<?php echo isset( $value['input_id'] ) ? esc_attr( $value['input_id'] ) : ''; ?>"
id="<?php echo isset( $value['input_id'] ) ? esc_attr( $value['input_id'] ) : ''; ?>"
type="<?php echo isset( $value['input_type'] ) ? esc_attr( $value['input_type'] ) : ''; ?>"
style="<?php echo isset( $value['input_css'] ) ? esc_attr( $value['input_css'] ) : ''; ?>"
value="<?php echo isset( $option_value ) ? esc_attr( $option_value ) : ''; ?>"
class="<?php echo isset( $value['class'] ) ? esc_attr( $value['class'] ) : ''; ?>"
placeholder="<?php echo isset( $value['placeholder'] ) ? esc_attr( $value['placeholder'] ) : ''; ?>"
<?php
if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) {
foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) {
echo esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
}
}
?>
/><?php echo isset( $value['suffix'] ) ? esc_html( $value['suffix'] ) : ''; ?> <?php echo isset( $description ) ? wp_kses_post( $description ) : ''; ?>
<?php
if ( isset( $value['buttons'] ) && is_array( $value['buttons'] ) ) {
foreach ( $value['buttons'] as $button ) {
?>
<a href="<?php echo esc_url( $button['href'] ); ?>" class="button <?php echo esc_attr( $button['class'] ); ?>"
style="<?php echo isset( $value['button_css'] ) ? esc_attr( $value['button_css'] ) : ''; ?>"
<?php
if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) {
foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) {
echo esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
}
}
?>
>
<?php echo esc_html( $button['title'] ); ?>
</a>
<?php
}
}
?>
<?php echo esc_html( $value['suffix'] ); ?> <?php echo wp_kses_post( $description ); ?>
</div>
</div>
<?php
break;
// Default: run an action.
default:
do_action( 'everest_forms_admin_field_' . $value['type'], $value );
break;
Expand Down
23 changes: 9 additions & 14 deletions includes/admin/settings/class-evf-settings-email.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,30 @@ public function get_settings() {
),
array(
'title' => esc_html__( 'Enable copies', 'everest-forms' ),
'desc' => esc_html__( 'Enable the use of Cc and Bcc email addresses', 'everest-forms' ),
'desc_tip' => esc_html__( 'Email addresses for Cc and Bcc can be applied from the form notification settings.', 'everest-forms' ),
'desc' => esc_html__( 'Email addresses for Cc and Bcc can be applied from the form notification settings.', 'everest-forms' ),
'id' => 'everest_forms_enable_email_copies',
'default' => 'no',
'type' => 'toggle',
'desc_tip' => true,
),
array(
'title' => esc_html__( 'Send Test Email To', 'everest-forms' ),
'desc' => esc_html__( 'Enter email address where test email will be sent.', 'everest-forms' ),
'id' => 'everest_forms_email_send_to',
'type' => 'email',
'desc' => esc_html__( 'Enter the email address where test email will be sent.', 'everest-forms' ),
'input_id' => 'everest_forms_email_send_to',
'placeholder' => 'eg. testemail@gmail.com',
'input_type' => 'email',
'value' => get_option( 'everest_forms_email_send_to', '' ) ? esc_attr( get_option( 'everest_forms_email_send_to', '' ) ) : esc_attr( get_bloginfo( 'admin_email' ) ),
'desc_tip' => true,
),
array(
'title' => __( 'Send Test Email', 'everest-forms' ),
'desc' => __( 'Click to send test email.', 'everest-forms' ),
'id' => 'everest_forms_email_test',
'type' => 'link',
'buttons' => array(
'button_id' => 'everest_forms_email_test',
'type' => 'input_test_button',
'input_css' => 'margin-right:0.5rem',
'buttons' => array(
array(
'title' => __( 'Send Test Email', 'everest-forms' ),
'href' => 'javascript:;',
'class' => 'everest_forms_send_email_test',
),
),
'desc_tip' => true,
'desc_tip' => true,
),
array(
'type' => 'sectionend',
Expand Down
22 changes: 9 additions & 13 deletions includes/admin/settings/class-evf-settings-reporting.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,27 +100,23 @@ public function get_settings() {
'type' => 'text',
),
array(
'title' => esc_html__( 'Send Test Email To', 'everest-forms' ),
'desc' => esc_html__( 'Enter email address where test email will be sent.', 'everest-forms' ),
'id' => 'everest_forms_email_send_to',
'type' => 'email',
'title' => esc_html__( 'Send Test Report', 'everest-forms' ),
'desc' => esc_html__( 'Enter the email address to receive the test email for the routine summary report.', 'everest-forms' ),
'input_id' => 'everest_forms_email_send_to',
'input_type' => 'email',
'input_css' => 'margin-right:0.5rem',
'placeholder' => 'eg. testemail@gmail.com',
'value' => ! empty( $evf_summary_email ) ? esc_attr( $evf_summary_email ) : esc_attr( get_bloginfo( 'admin_email' ) ),
'desc_tip' => true,
),
array(
'title' => __( 'Send Test Email', 'everest-forms' ),
'desc' => __( 'Click to send test email.', 'everest-forms' ),
'id' => 'everest_forms_send_routine_report_test_email',
'type' => 'link',
'buttons' => array(
'button_id' => 'everest_forms_send_routine_report_test_email',
'type' => 'input_test_button',
'buttons' => array(
array(
'title' => __( 'Send Test Email', 'everest-forms' ),
'href' => 'javascript:;',
'class' => 'everest_forms_send_routine_report_test_email',
),
),
'desc_tip' => true,
'desc_tip' => true,
),
array(
'title' => esc_html__( 'Report Form Lists', 'everest-forms' ),
Expand Down

0 comments on commit 86f3ae1

Please sign in to comment.