-
Notifications
You must be signed in to change notification settings - Fork 368
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 promote modal on job save #2522
Add promote modal on job save #2522
Conversation
if ( 'edit-job_listing' !== $screen->id ) { | ||
return; | ||
|
||
if ( in_array( $screen->id, [ 'edit-job_listing', 'job_listing' ], true ) ) { // Job listing and job editor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is to also load the promote modal on the job editor page.
619ce4a
to
ac137c0
Compare
* | ||
* @return {Function} Unsubscribe function. | ||
*/ | ||
const editorLifecycle = ( { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Borrowed from Sensei LMS.
Borrowed from Sensei LMS.
This reverts commit 75c38d5.
44add0b
to
72c04ac
Compare
c18278d
to
f5866b0
Compare
@@ -0,0 +1,49 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic was extracted from the admin.js
, so we can use it properly in the editor.
@@ -0,0 +1,21 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was also extracted, just in order to make it a module instead of a global function.
@@ -128,6 +128,21 @@ public function admin_enqueue_scripts() { | |||
); | |||
} | |||
|
|||
if ( 'job_listing' === $screen->id && $screen->is_block_editor() ) { // Check if it's block editor in job post. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the standard to include the JS files is here, so I included a JS for the job editor here, including a global variable for the promote URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good and works well.
I also tested some strange WPJM scenarios where it is in draft and I publish with a old expiration date, but it looks like that moves the expiration date forward and continues to publish the job. Deactivate still works well.
Fixes #2518
Changes proposed in this Pull Request
Testing instructions
Screenshot / Video
Screen.Recording.2023-07-17.at.17.51.21.mov