Skip to content

Commit

Permalink
enhance(project): module initial page is set.
Browse files Browse the repository at this point in the history
Description:
In this commit the initial setup page is being added and the redirection is also being added.

resolves: Initial setup page addition #361
  • Loading branch information
satyajittalukder committed Jan 16, 2024
1 parent b5e7c8c commit b3f7d1b
Show file tree
Hide file tree
Showing 13 changed files with 544 additions and 425 deletions.
18 changes: 18 additions & 0 deletions Includes/Admin/AdminMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ public function register_admin_menu() {
array( $this, 'handle_external_redirects' )
);

add_submenu_page(
'sales-booster-for-woocommerce',
__( 'Initial Setup - StoreGrowth', 'storegrowth-sales-booster' ),
__( 'Initial Setup', 'storegrowth-sales-booster' ),
'manage_options',
'sgsb-modules#/ini-setup',
array( $this, 'initial_setup_page_callback' )
);

if ( ! SGSB_PRO_ACTIVE ) {
add_submenu_page(
'sales-booster-for-woocommerce',
Expand Down Expand Up @@ -137,6 +146,15 @@ public function dashboard_callback() {
exit;
}

/**
* Display Initail Setup page content.
*/
public function initial_setup_page_callback() {
$redirect_url = admin_url( 'admin.php?page=sgsb-modules#/ini-setup' );
wp_safe_redirect( $redirect_url );
exit;
}

/**
* Redirect to a specific URL.
*
Expand Down
31 changes: 26 additions & 5 deletions assets/menu-scripts/admin-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
// *************************************
// Add target blank for upgrade button
// *************************************
$("#toplevel_page_sales-booster-for-woocommerce ul > li > a").each(function (e) {
$("#toplevel_page_sales-booster-for-woocommerce ul > li > a").each(function (
e
) {
if ($(this).attr("href").indexOf("?page=go-sgsb-pro") > 0) {
$(this).attr("target", "_blank");
// Add hover effect
$(this).hover(
function() {
$(this).css('color', 'yellowgreen');
function () {
$(this).css("color", "yellowgreen");
},
function() {
$(this).css('color', ''); // Revert to original color on hover out
function () {
$(this).css("color", ""); // Revert to original color on hover out
}
);
}
Expand All @@ -22,4 +24,23 @@
}
});

// *************************************
// Target the admin menu and remove it
// *************************************

let currentPath = window.location.hash;
console.log(currentPath);
if ("#/ini-setup" === currentPath || "#ini-setup" === currentPath) {
console.log("from jquery");
$("#wpadminbar , #adminmenumain").remove();

$(".wp-toolbar").css({
padding: "0", // Replace with your desired background color
});
$("#wpcontent, #wpfooter").css({
marginLeft:"0",
background: "#fff", // Replace with your desired background color
});
$(".notice").remove();
}
})(jQuery);
Loading

0 comments on commit b3f7d1b

Please sign in to comment.