initial
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
@import "@wordpress/base-styles/colors.native"; // stylelint-disable-line scss/at-import-partial-extension
|
||||
|
||||
.vrts-notice {
|
||||
padding-bottom: 0.75em;
|
||||
|
||||
p,
|
||||
form {
|
||||
display: inline;
|
||||
padding-right: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.admin-notice-button {
|
||||
border: 0;
|
||||
margin-bottom: 2px;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
min-height: 19px;
|
||||
line-height: 1;
|
||||
border-radius: 0;
|
||||
text-decoration: underline;
|
||||
|
||||
&:hover {
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
switch ( $data['view'] ) {
|
||||
case 'connection_failed':
|
||||
$template = __DIR__ . '/views/admin-notification-connection-failed.php';
|
||||
break;
|
||||
|
||||
case 'get_started':
|
||||
$template = __DIR__ . '/views/admin-notification-get-started.php';
|
||||
break;
|
||||
|
||||
case 'new_test_added':
|
||||
$template = __DIR__ . '/views/admin-notification-new-test-added.php';
|
||||
break;
|
||||
|
||||
case 'new_test_failed':
|
||||
$template = __DIR__ . '/views/admin-notification-new-test-failed.php';
|
||||
break;
|
||||
|
||||
case 'new_tests_added':
|
||||
$template = __DIR__ . '/views/admin-notification-new-tests-added.php';
|
||||
break;
|
||||
|
||||
case 'plugin_activated':
|
||||
$template = __DIR__ . '/views/admin-notification-plugin-activated.php';
|
||||
break;
|
||||
|
||||
case 'settings_saved':
|
||||
$template = __DIR__ . '/views/admin-notification-settings-saved.php';
|
||||
break;
|
||||
|
||||
case 'license_added':
|
||||
$template = __DIR__ . '/views/admin-notification-license-added.php';
|
||||
break;
|
||||
|
||||
case 'license_not_added':
|
||||
$template = __DIR__ . '/views/admin-notification-license-not-added.php';
|
||||
break;
|
||||
|
||||
case 'test_disabled':
|
||||
$template = __DIR__ . '/views/admin-notification-test-disabled.php';
|
||||
break;
|
||||
|
||||
case 'test_started':
|
||||
$template = __DIR__ . '/views/admin-notification-test-started.php';
|
||||
break;
|
||||
|
||||
case 'test_failed':
|
||||
$template = __DIR__ . '/views/admin-notification-test-failed.php';
|
||||
break;
|
||||
|
||||
case 'unlock_more_tests':
|
||||
$template = __DIR__ . '/views/admin-notification-unlock-more-tests.php';
|
||||
break;
|
||||
|
||||
default:
|
||||
$template = '';
|
||||
break;
|
||||
}//end switch
|
||||
|
||||
if ( file_exists( $template ) ) {
|
||||
include $template;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/* global jQuery, ajaxurl */
|
||||
|
||||
import 'scripts/relative-time-element';
|
||||
|
||||
jQuery( document ).ready( function ( $ ) {
|
||||
$( document ).on( 'click', '.vrts-notice .notice-dismiss', ( event ) => {
|
||||
if ( ajaxurl ) {
|
||||
const nonce =
|
||||
event.target.parentElement.querySelector( '#_wpnonce' ).value;
|
||||
const view = event.target.parentElement.dataset.view;
|
||||
|
||||
const data = {
|
||||
action: 'vrts_admin_notice_dismiss',
|
||||
url: ajaxurl,
|
||||
security: nonce,
|
||||
view,
|
||||
};
|
||||
|
||||
$.ajax( {
|
||||
type: 'POST',
|
||||
url: ajaxurl,
|
||||
data,
|
||||
} );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<div class="vrts-notice notice notice-error" data-view="<?php echo esc_attr( $data['view'] ); ?>">
|
||||
<h3><?php esc_html_e( 'Connection failed', 'visual-regression-tests' ); ?></h3>
|
||||
<p><?php esc_html_e( 'Something went wrong while trying to connect to the external service.', 'visual-regression-tests' ); ?></p>
|
||||
<form id="form-retry-connection" method="post">
|
||||
<?php wp_nonce_field( 'vrts_retry_connection_nonce' ); ?>
|
||||
<?php submit_button( esc_attr__( 'Retry connection', 'visual-regression-tests' ), 'admin-notice-button', 'submit_retry_connection', false ); ?>
|
||||
</form>
|
||||
</div>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<div class="vrts-notice notice notice-info is-dismissible" data-view="<?php echo esc_attr( $data['view'] ); ?>">
|
||||
<?php wp_nonce_field( 'vrts_admin_notice_nonce' ); ?>
|
||||
<h3><?php esc_html_e( 'Let’s get started!', 'visual-regression-tests' ); ?></h3>
|
||||
<p><?php esc_html_e( 'Click “Add New“ to create a Visual Regression Test for your Website and find issues before others do.', 'visual-regression-tests' ); ?></p>
|
||||
</div>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<div class="vrts-notice notice notice-success" data-view="<?php echo esc_attr( $data['view'] ); ?>">
|
||||
<?php wp_nonce_field( 'vrts_admin_notice_nonce' ); ?>
|
||||
<h3><?php esc_html_e( 'License activated!', 'visual-regression-tests' ); ?></h3>
|
||||
<p><?php esc_html_e( 'Enjoy your upgraded features for seamless visual testing.', 'visual-regression-tests' ); ?></p>
|
||||
</div>
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
<div class="vrts-notice notice notice-error" data-view="<?php echo esc_attr( $data['view'] ); ?>">
|
||||
<?php wp_nonce_field( 'vrts_admin_notice_nonce' ); ?>
|
||||
<h3><?php esc_html_e( 'Invalid License Key', 'visual-regression-tests' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %1$s, %2$s: link wrapper. */
|
||||
esc_html__( 'We could not verify the license key you entered. Please check for typos and try again. If the issue persists, %1$scontact us%2$s for assistance. We’re here to help!', 'visual-regression-tests' ),
|
||||
'<a href="https://vrts.app/contact/" target="_blank">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<div class="vrts-notice notice notice-success" data-view="<?php echo esc_attr( $data['view'] ); ?>">
|
||||
<?php wp_nonce_field( 'vrts_admin_notice_nonce' ); ?>
|
||||
<h3><?php esc_html_e( 'Test added successfully', 'visual-regression-tests' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: the title of the page. */
|
||||
esc_html__( 'Tests will be run for the following page: %s', 'visual-regression-tests' ),
|
||||
esc_html( $data['page_title'] )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Vrts\Core\Utilities\Url_Helpers;
|
||||
|
||||
?>
|
||||
<div class="vrts-notice notice notice-error is-dismissable" data-view="<?php echo esc_attr( $data['view'] ); ?>">
|
||||
<h3><?php esc_html_e( 'Ready for an Upgrade?', 'visual-regression-tests' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
'%1$s <a href="%2$s" title="%3$s">%3$s</a>',
|
||||
esc_html__( 'Looks like you need a bigger plan to add more tests.', 'visual-regression-tests' ),
|
||||
esc_url( Url_Helpers::get_page_url( 'upgrade' ) ),
|
||||
esc_html__( 'Upgrade here!', 'visual-regression-tests' )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<div class="vrts-notice notice notice-success" data-view="<?php echo esc_attr( $data['view'] ); ?>">
|
||||
<?php wp_nonce_field( 'vrts_admin_notice_nonce' ); ?>
|
||||
<h3><?php esc_html_e( 'Tests added successfully', 'visual-regression-tests' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: the title of the page. */
|
||||
esc_html__( 'Tests will be run for the following pages: %s', 'visual-regression-tests' ),
|
||||
esc_html( $data['page_titles'] )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Vrts\Core\Utilities\Url_Helpers;
|
||||
|
||||
?>
|
||||
<div class="notice updated is-dismissible" data-view="<?php echo esc_attr( $data['view'] ); ?>">
|
||||
<p>
|
||||
<strong><?php esc_html_e( 'VRTs Plugin successfully activated!', 'visual-regression-tests' ); ?></strong>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %1$s, %2$s and %3$s, %4$s: link wrapper. */
|
||||
esc_html__( 'Start to %1$sconfigure tests%2$s, or check the customization options in the %3$splugin settings%4$s.', 'visual-regression-tests' ),
|
||||
'<a href="' . esc_url( Url_Helpers::get_page_url( 'tests' ) ) . '">',
|
||||
'</a>',
|
||||
'<a href="' . esc_url( Url_Helpers::get_page_url( 'settings' ) ) . '">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<div class="vrts-notice notice notice-success" data-view="<?php echo esc_attr( $data['view'] ); ?>">
|
||||
<?php wp_nonce_field( 'vrts_admin_notice_nonce' ); ?>
|
||||
<h3><?php esc_html_e( 'Settings saved', 'visual-regression-tests' ); ?></h3>
|
||||
<p><?php esc_html_e( 'Changes have been saved successfully.', 'visual-regression-tests' ); ?></p>
|
||||
</div>
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<div class="vrts-notice notice notice-error" data-view="<?php echo esc_attr( $data['view'] ); ?>">
|
||||
<?php wp_nonce_field( 'vrts_admin_notice_nonce' ); ?>
|
||||
<h3><?php esc_html_e( 'Test disabled successfully', 'visual-regression-tests' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: the title of the page. */
|
||||
esc_html__( 'No more tests will be run for the following page: %s', 'visual-regression-tests' ),
|
||||
esc_html( $data['page_title'] )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<form id="form-undo-test" method="post">
|
||||
<input type="hidden" name="post_id" value="<?php echo esc_attr( $data['post_id'] ); ?>">
|
||||
<?php wp_nonce_field( 'vrts_page_tests_nonce' ); ?>
|
||||
<?php submit_button( esc_attr__( 'Undo', 'visual-regression-tests' ), 'admin-notice-button', 'submit_add_new_test', false ); ?>
|
||||
</form>
|
||||
</div>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<div class="vrts-notice notice notice-error" data-view="<?php echo esc_attr( $data['view'] ); ?>">
|
||||
<?php wp_nonce_field( 'vrts_admin_notice_nonce' ); ?>
|
||||
<h3><?php esc_html_e( 'Test couldn’t be started', 'visual-regression-tests' ); ?></h3>
|
||||
<p><?php esc_html_e( 'A Test is already in progress. Please wait for the current Test to finish, then try again.', 'visual-regression-tests' ); ?></p>
|
||||
</div>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<div class="vrts-notice notice notice-info" data-view="<?php echo esc_attr( $data['view'] ); ?>">
|
||||
<?php wp_nonce_field( 'vrts_admin_notice_nonce' ); ?>
|
||||
<h3><?php esc_html_e( 'Testing has started 🚀', 'visual-regression-tests' ); ?></h3>
|
||||
<p><?php esc_html_e( 'New screenshots are being taken and compared with the previous version.', 'visual-regression-tests' ); ?></p><br>
|
||||
<p><?php esc_html_e( 'This may take a moment. You’ll receive an email if any visual changes are detected.', 'visual-regression-tests' ); ?></p>
|
||||
</div>
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Vrts\Core\Utilities\Url_Helpers;
|
||||
|
||||
?>
|
||||
<div class="vrts-notice notice notice-info" data-view="<?php echo esc_attr( $data['view'] ); ?>">
|
||||
<h3><?php esc_html_e( 'Unlock more tests', 'visual-regression-tests' ); ?></h3>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
'%s %s',
|
||||
sprintf(
|
||||
/* translators: %1$s, %2$s: number of tests. */
|
||||
esc_html__( 'Good work! You have added %1$s of %2$s available tests.', 'visual-regression-tests' ),
|
||||
intval( $data['total_tests'] ) - intval( $data['remaining_tests'] ),
|
||||
intval( $data['total_tests'] )
|
||||
),
|
||||
sprintf(
|
||||
/* translators: %1$s, %2$s: link wrapper. */
|
||||
esc_html__( 'Upgrade %1$shere%2$s to add more tests to your website!', 'visual-regression-tests' ),
|
||||
'<a href="' . esc_url( Url_Helpers::get_page_url( 'upgrade' ) ) . '">',
|
||||
'</a>'
|
||||
)
|
||||
)
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
Reference in New Issue
Block a user