Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new notice about latest release #2798

Merged
merged 6 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
56 changes: 55 additions & 1 deletion assets/css/admin-notices.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,19 @@ $notice-success: #43af99;
aspect-ratio: 1;
}

&__label {
font-weight: 600;
background: var(--wpjm-brand-color-shade-4);
color: var(--wpjm-brand-color-primary);
border-radius: 40px;
padding: 6px 12px;
display: inline-block;
text-transform: uppercase;
align-self: flex-start;
font-size: 12px;
}

&__heading {
margin: 0 0 8px 0;
font-weight: 700;
font-size: 16px;
letter-spacing: -0.36px;
Expand All @@ -62,12 +73,26 @@ $notice-success: #43af99;
&__message {
flex: 1 1 min-content;
align-self: center;
display: flex;
flex-direction: column;
gap: 10px;
min-width: min(100%, 400px);
line-height: 1.5;

&, p {
font-size: 14px;
}

ul {
margin: 0;
padding-left: 10px;
list-style-type: '•';
}
li {
padding-left: 10px;
}


}

&__actions {
Expand Down Expand Up @@ -108,6 +133,35 @@ $notice-success: #43af99;
}
}

&--landing {
padding: 40px 40px;
align-items: flex-start;
flex-direction: row;
justify-content: space-between;
}
&--landing &__top {
flex-direction: column;
gap: 20px;
align-items: flex-start;
}

&--landing &__message {
gap: 20px;
}

&--landing &__heading {
font-size: 40px;
letter-spacing: -0.8px;
}

&--landing &__image {
max-width: 50%;
}
&--landing &__image img {
max-width: 100%;
max-height: 500px;
}

}

.wpjm-addon-update-notice-info {
Expand Down
92 changes: 92 additions & 0 deletions includes/admin/class-release-notice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
/**
* File containing the class \WP_Job_Manager\Admin\Release_Notice.
*
* @package wp-job-manager
*/

namespace WP_Job_Manager\Admin;

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Admin notice about changes and new features introduced in the latest release.
*/
class Release_Notice {

/**
* Set up notice.
*/
public static function init() {
add_filter( 'wpjm_admin_notices', [ __CLASS__, 'add_release_notice' ] );

add_action( 'job_manager_action_enable_stats', fn() => \WP_Job_Manager_Settings::instance()->set_setting( \WP_Job_Manager\Stats::OPTION_ENABLE_STATS, '1' ) );
yscik marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* Add a release notice for the 2.3.0 release.
*
* @param array $notices
*
* @return array
*/
public static function add_release_notice( $notices ) {

// Make sure to update the version number in the notice ID when changing this notice for a new release.

$notice_id = 'release_notice_2_3_0';

$action_url = \WP_Job_Manager_Admin_Notices::get_action_url( 'enable_stats', $notice_id );
$notices[ $notice_id ] = [
'type' => 'site-wide',
'label' => 'New',
'heading' => 'Job Statistics',

yscik marked this conversation as resolved.
Show resolved Hide resolved
'message' => '<div>' . __(
'
<p>Collect analytics data about site visitors for each job listing. Display the detailed statistics in the refreshed jobs dashboard.</p>
yscik marked this conversation as resolved.
Show resolved Hide resolved
<ul>
<li>Page views and unique visitors with daily breakdown</li>
<li>Search impressions and apply button clicks</li>
<li>Add-on integration: Job alert impressions, bookmarks, application stats</li>
yscik marked this conversation as resolved.
Show resolved Hide resolved
<li>GDPR-compliant, with no personal user information collected</li>
</ul>
',
'wp-job-manager'
) . '</div>',
'actions' => [
[
'label' => __( 'Enable', 'wp-job-manager' ),
'url' => $action_url,
'primary' => true,
],
[
'label' => __( 'Dismiss', 'wp-job-manager' ),
'url' => \WP_Job_Manager_Admin_Notices::get_dismiss_url( $notice_id ),
'primary' => false,
],
[
'label' => __( 'See what\'s new in 2.3', 'wp-job-manager' ),
'url' => 'https://wpjobmanager.com/2024/03/27/new-in-2-3-job-statistics/',
'class' => 'is-link',
],
],
'icon' => false,
'level' => 'landing',
'image' => 'https://wpjobmanager.com/wp-content/uploads/2024/03/jm-230-release.png',
'dismissible' => false,
'extra_details' => '',
'conditions' => [
[
'type' => 'screens',
'screens' => [ 'edit-job_listing' ],
],
],
];

return $notices;
}

}
Loading
Loading