Skip to content
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
14 changes: 14 additions & 0 deletions classes/controllers/FrmAppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1507,4 +1507,18 @@ private static function add_missing_tables() {
wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
exit;
}

/**
* Handles the small screen proceed action.
*
* @since x.x
*
* @return void
*/
public static function small_screen_proceed() {
FrmAppHelper::permission_check( 'frm_view_forms' );
check_ajax_referer( 'frm_ajax', 'nonce' );
update_user_option( get_current_user_id(), 'frm_ignore_small_screen_warning', true );
wp_send_json_success();
}
}
2 changes: 2 additions & 0 deletions classes/controllers/FrmHooksController.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ public static function load_ajax_hooks() {

// Reviews.
add_action( 'wp_ajax_frm_dismiss_review', 'FrmAppController::dismiss_review' );

add_action( 'wp_ajax_frm_small_screen_proceed', 'FrmAppController::small_screen_proceed' );
}

/**
Expand Down
8 changes: 6 additions & 2 deletions classes/views/shared/small-device-message.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@
if ( ! defined( 'ABSPATH' ) ) {
die( 'You are not allowed to call this page directly.' );
}
?>

if ( ! get_user_option( 'frm_ignore_small_screen_warning', get_current_user_id() ) ) {
?>
<div id="frm_small_device_message_container">
<div id="frm_small_device_message">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="49" fill="none"><rect width="30" height="47" x="1" y="1" fill="#F5FAFF" stroke="#4199FD" stroke-width="2" rx="3"/><rect width="8" height="2" x="12" y="5" fill="#C0DDFE" rx="1"/><path stroke="#80BBFE" stroke-width="1.5" d="M23 33c0-3.314-2.91-6-6.5-6S10 29.686 10 33"/><circle cx="10.5" cy="20.5" r="1" fill="#80BBFE" stroke="#80BBFE"/><circle cx="21.5" cy="20.5" r="1" fill="#80BBFE" stroke="#80BBFE"/></svg>
<b><?php esc_html_e( 'More on bigger devices', 'formidable' ); ?></b>
<p><?php esc_html_e( 'For the best experience, we recommend using Formidable Forms on larger devices such as a desktop or tablet.', 'formidable' ); ?></p>
<a href="<?php echo esc_url( admin_url() ); ?>" class="frm-button-primary"><?php esc_html_e( 'Go back', 'formidable' ); ?></a>
<div><a href="<?php echo esc_url( admin_url() ); ?>" class="frm-button-primary"><?php esc_html_e( 'Go Back', 'formidable' ); ?></a>&nbsp;&nbsp;&nbsp;&nbsp;<a id="frm_small_screen_proceed_button" href="#" class="frm-button-secondary"><?php esc_html_e( 'Proceed Anyway', 'formidable' ); ?></a></div>
</div>
</div>
<?php
}
4 changes: 2 additions & 2 deletions css/frm_admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -9302,8 +9302,8 @@ Responsive Design
padding-bottom: 1rem;
}

.toplevel_page_formidable #posts-filter,
.post-type-frm_display #posts-filter {
.toplevel_page_formidable:has(#frm_small_device_message_container) #posts-filter,
.post-type-frm_display:has(#frm_small_device_message_container) #posts-filter {
display: none;
}
}
Expand Down
8 changes: 8 additions & 0 deletions js/formidable_admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10639,6 +10639,14 @@ function frmAdminBuildJS() {
maybeAddSaveAndDragIcons( fieldId );
});
});

const smallScreenProceedButton = document.getElementById( 'frm_small_screen_proceed_button' );
if ( smallScreenProceedButton ) {
onClickPreventDefault( smallScreenProceedButton, () => {
document.getElementById( 'frm_small_device_message_container' )?.remove();
doJsonPost( 'small_screen_proceed', new FormData() );
});
}
},

buildInit: function() {
Expand Down
Loading