Skip to content

Commit

Permalink
JITM - show a link to settings after a module is activated (#32826)
Browse files Browse the repository at this point in the history
* [not verified] working on adding an activation redirect for Newsletter JITM

* [not verified] changelog

* [not verified] admin url

* [not verified] admin url

* [not verified] tweaks

* [not verified] fixing redirect logic

* [not verified] remove console logging

* [not verified] tidying comments

* [not verified] making the admin URL so we can redirect to my jetpack and other pages which are in the #/jetpack app

* Tweak to show settings link instead of redirect

* settings link logic

* tweaking to link not redirect

* showing and hiding some buttons

* change button to primary

* updating the logic and settings name

* finialising

* changlogger validity fix

* removing jptracks class

* changelog validity

---------

Co-authored-by: Mike Stott <mikestott@Mikes-MacBook-Pro.local>
  • Loading branch information
mikestottuk and Mike Stott authored Oct 6, 2023
1 parent e2ac97d commit c055370
Show file tree
Hide file tree
Showing 31 changed files with 135 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

JITMs can now redirect to a specific Jetpack settings page
2 changes: 1 addition & 1 deletion projects/packages/jitm/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"link-template": "https://github.com/Automattic/jetpack-jitm/compare/v${old}...v${new}"
},
"branch-alias": {
"dev-trunk": "2.4.x-dev"
"dev-trunk": "2.5.x-dev"
}
}
}
3 changes: 2 additions & 1 deletion projects/packages/jitm/src/class-jitm.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
class JITM {

const PACKAGE_VERSION = '2.4.0';
const PACKAGE_VERSION = '2.5.0-alpha';

/**
* The configuration method that is called from the jetpack-config package.
Expand Down Expand Up @@ -156,6 +156,7 @@ public function jitm_enqueue_files() {
'activate_module_text' => esc_html__( 'Activate', 'jetpack-jitm' ),
'activated_module_text' => esc_html__( 'Activated', 'jetpack-jitm' ),
'activating_module_text' => esc_html__( 'Activating', 'jetpack-jitm' ),
'settings_module_text' => esc_html__( 'Settings', 'jetpack-jitm' ),
'nonce' => wp_create_nonce( 'wp_rest' ),
)
);
Expand Down
20 changes: 20 additions & 0 deletions projects/packages/jitm/src/js/jetpack-jitm.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jQuery( document ).ready( function ( $ ) {
html +=
'<a href="#" data-module="' +
envelope.activate_module +
'" data-settings_link="' + envelope.module_settings_link +
'" type="button" class="jitm-button is-compact is-primary" data-jptracks-name="nudge_click" data-jptracks-prop="jitm-' +
envelope.id +
'-activate_module" data-jitm-path="' +
Expand All @@ -80,6 +81,18 @@ jQuery( document ).ready( function ( $ ) {
window.jitm_config.activate_module_text +
'</a>';
html += '</div>';
if ( envelope.module_settings_link){
html += '<div class="jitm-banner__action" id="jitm-banner__settings" style="display:none;">';
html +=
'<a href="' +
envelope.module_settings_link +
'" type="button" class="jitm-button is-compact is-primary" data-jptracks-name="nudge_click" data-jptracks-prop="jitm-' +
envelope.id +
'-settings_link">' +
window.jitm_config.settings_module_text +
'</a>';
html += '</div>';
}
}
if ( envelope.CTA.message ) {
var ctaClasses = 'jitm-button is-compact';
Expand Down Expand Up @@ -209,9 +222,16 @@ jQuery( document ).ready( function ( $ ) {
$( '#jitm-banner__activate a' ).attr( 'disabled', true );
},
} ).done( function () {
// Display the link to settings and hide the activate link
$( '#jitm-banner__activate a' ).text( window.jitm_config.activated_module_text );
$( '#jitm-banner__activate a' ).attr( 'disabled', true );

if ( $activate_button.data( 'settings_link' ) ) {
$( '#jitm-banner__settings' ).show();
$( '#jitm-banner__activate' ).hide();
return;
}

// Hide the JITM after 2 seconds.
setTimeout( function () {
$template.fadeOut( 'slow' );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/backup/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/boost/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Updated composer.lock.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/jetpack/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/migration/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/protect/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/search/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/social/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/starter-plugin/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/videopress/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c055370

Please sign in to comment.