diff --git a/assets/css/page-widgets/suggested-tasks.css b/assets/css/page-widgets/suggested-tasks.css index 2f98a59fb5..8fa3f87a79 100644 --- a/assets/css/page-widgets/suggested-tasks.css +++ b/assets/css/page-widgets/suggested-tasks.css @@ -495,3 +495,119 @@ } } } + +/*------------------------------------*\ + Page select setting. +\*------------------------------------*/ +.prpl-pages-item { + + &:has(input[type="radio"][value="yes"]:checked), + &:has(input[type="radio"][value="no"]:checked) { + + h3 { + + .icon-exclamation-circle { + display: block; + } + + .icon-check-circle { + display: none; + } + } + } + + &:has(option[value=""]:not(:checked)):has(input[type="radio"][value="yes"]:checked), + &:has(input[type="radio"][value="not-applicable"]:checked) { + + h3 { + + .icon-check-circle { + display: block; + } + + .icon-exclamation-circle { + display: none; + } + } + } + + .item-actions, + .prpl-select-page { + display: flex; + align-items: center; + gap: 1rem; + } + + .remind-button, + .assign-button { + + svg { + width: 1rem; + height: 1rem; + } + } + + h3 { + font-size: 1.15rem; + margin: 0; + + display: flex; + align-items: center; + gap: 0.5rem; + + .icon { + width: 1em; + height: 1em; + display: none; + } + } + + p { + margin-block-start: 0.5rem; + margin-block-end: 1rem; + } + + .radios { + margin-bottom: 1rem; + } + + .prpl-radio-wrapper { + display: flex; + justify-content: space-between; + align-items: center; + + [data-action="select"], + [data-action="create"] { + visibility: hidden; + } + + &:has(input[type="radio"]:checked) { + + [data-action="select"], + [data-action="create"] { + visibility: visible; + } + } + + &:has(input[type="radio"][value="not-applicable"]) { + padding-top: 0.25rem; + + /* Add bit height, because we dont have button or select */ + } + } +} + +/*------------------------------------*\ + Post types selection. +\*------------------------------------*/ +.prpl-post-types-selection { + + label { + display: block; + margin-top: 0.75rem; + + &:first-child { + margin-top: 0; + } + } +} diff --git a/assets/css/settings-page.css b/assets/css/settings-page.css deleted file mode 100644 index 70d431ed64..0000000000 --- a/assets/css/settings-page.css +++ /dev/null @@ -1,350 +0,0 @@ -/* stylelint-disable-next-line selector-class-pattern */ -.progress-planner_page_progress-planner-settings { - - #wpwrap { - background-color: var(--prpl-background); - } - - ul#adminmenu { - - a.wp-has-current-submenu, - > li.current > a.current { - - &::after { - border-right-color: var(--prpl-background) !important; - } - } - } - - .prpl-settings-wrap { - - h1 { - display: flex; - align-items: center; - padding: 1.2rem; - margin-bottom: 2rem; - - span { - font-weight: 600; - } - } - - #prpl-settings { - - .prpl-widget-wrapper { - padding: var(--prpl-settings-page-gap) var(--prpl-settings-page-gap) 2rem var(--prpl-settings-page-gap); - } - } - } - - .prpl-settings-form-wrap { - background-color: var(--prpl-background-paper); - - border: 1px solid var(--prpl-color-border); - border-radius: var(--prpl-border-radius); - padding: var(--prpl-padding); - box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.07), -2px 0 6px rgba(0, 0, 0, 0.07); - } - - .prpl-settings-section-wrapper { - border: 1px solid var(--prpl-color-border); - border-radius: var(--prpl-border-radius); - padding: var(--prpl-padding); - flex-grow: 1; - } - - .prpl-settings-section-title { - display: flex; - align-items: center; - gap: 0.5rem; - background: var(--prpl-background-monthly); - padding: 1.2rem; - border-radius: 0.5rem; - margin-bottom: var(--prpl-padding); - - &:first-child { - margin-top: 0; - } - - .icon { - width: 1.25em; - height: 1.25em; - } - } - - .prpl-pages-item { - border: 1px solid var(--prpl-color-border); - border-radius: var(--prpl-border-radius); - padding: var(--prpl-padding); - flex-grow: 1; - width: 45%; - - &:has(input[type="radio"][value="yes"]:checked), - &:has(input[type="radio"][value="no"]:checked) { - - h3 { - - .icon-exclamation-circle { - display: block; - } - - .icon-check-circle { - display: none; - } - } - } - - &:has(option[value=""]:not(:checked)):has(input[type="radio"][value="yes"]:checked), - &:has(input[type="radio"][value="not-applicable"]:checked) { - - h3 { - - .icon-check-circle { - display: block; - } - - .icon-exclamation-circle { - display: none; - } - } - } - - .item-actions, - .prpl-select-page { - display: flex; - align-items: center; - gap: 1rem; - } - - .remind-button, - .assign-button { - - svg { - width: 1rem; - height: 1rem; - } - } - - h3 { - font-size: 1.15rem; - margin: 0; - - display: flex; - align-items: center; - gap: 0.5rem; - - .icon { - width: 1em; - height: 1em; - display: none; - } - } - - p { - margin-block-start: 0.5rem; - margin-block-end: 1rem; - } - - .radios { - margin-bottom: 1rem; - } - - .prpl-radio-wrapper { - display: flex; - justify-content: space-between; - align-items: center; - - [data-action="select"], - [data-action="create"] { - visibility: hidden; - } - - &:has(input[type="radio"]:checked) { - - [data-action="select"], - [data-action="create"] { - visibility: visible; - } - } - - &:has(input[type="radio"][value="not-applicable"]) { - padding-top: 0.25rem; /* Add bit height, because we dont have button or select */ - } - } - } - - .prpl-column-pages { - margin-bottom: var(--prpl-gap); - - .prpl-settings-section-title { - background: var(--prpl-background-setting-pages); - - .icon { - - path { - fill: var(--prpl-color-setting-pages-icon); - } - } - } - } - - .prpl-pages-list { - display: flex; - flex-wrap: wrap; - gap: var(--prpl-settings-page-gap); - - .item-description { - - h3 { - margin-bottom: 2rem; - } - - & > p { - display: none; - } - } - - .radios { - display: flex; - flex-direction: column; - gap: 0.5rem; - } - } - - .prpl-button { - color: var(--prpl-color-gray-7); - text-decoration: none; - border: 1px solid var(--prpl-color-border); - border-radius: var(--prpl-border-radius); - padding: 0.5em 0.5em; - font-size: 14px; /* It matches wrapper. + selectPageWrapper.style.visibility = 'hidden'; + } + + // Show only select and edit button. + if ( 'yes' === value ) { + // Show wrapper. - itemRadiosWrapperEl.querySelector( - '.prpl-select-page' - ).style.visibility = 'hidden'; - } - - // Show only select and edit button. - if ( 'yes' === value ) { - // Show + /> + labels->name ); // @phpstan-ignore-line property.nonObject ?> + + + + print_submit_button( \__( 'Set', 'progress-planner' ) ); + } + /** * Add task actions specific to this task. * @@ -130,7 +240,7 @@ public function is_task_completed( $task_id = '' ) { public function add_task_actions( $data = [], $actions = [] ) { $actions[] = [ 'priority' => 10, - 'html' => '' . \esc_html__( 'Go to the settings page', 'progress-planner' ) . '', + 'html' => '' . \esc_html__( 'Set', 'progress-planner' ) . '', ]; return $actions; diff --git a/classes/suggested-tasks/providers/class-settings-saved.php b/classes/suggested-tasks/providers/class-settings-saved.php deleted file mode 100644 index 5fe62f14cf..0000000000 --- a/classes/suggested-tasks/providers/class-settings-saved.php +++ /dev/null @@ -1,88 +0,0 @@ -get_settings()->get( 'include_post_types' ); - } - - /** - * Add task actions specific to this task. - * - * @param array $data The task data. - * @param array $actions The existing actions. - * - * @return array - */ - public function add_task_actions( $data = [], $actions = [] ) { - $actions[] = [ - 'priority' => 10, - 'html' => '' . \esc_html__( 'Go to the settings page', 'progress-planner' ) . '', - ]; - - return $actions; - } -} diff --git a/classes/utils/class-deprecations.php b/classes/utils/class-deprecations.php index b072229003..656ce4dc29 100644 --- a/classes/utils/class-deprecations.php +++ b/classes/utils/class-deprecations.php @@ -81,7 +81,6 @@ class Deprecations { 'Progress_Planner\Suggested_Tasks\Local_Tasks\Providers\One_Time\Sample_Page' => [ 'Progress_Planner\Suggested_Tasks\Providers\Sample_Page', '1.4.0' ], 'Progress_Planner\Suggested_Tasks\Local_Tasks\Providers\One_Time\Search_Engine_Visibility' => [ 'Progress_Planner\Suggested_Tasks\Providers\Search_Engine_Visibility', '1.4.0' ], 'Progress_Planner\Suggested_Tasks\Local_Tasks\Providers\One_Time\Set_Valuable_Post_Types' => [ 'Progress_Planner\Suggested_Tasks\Providers\Set_Valuable_Post_Types', '1.4.0' ], - 'Progress_Planner\Suggested_Tasks\Local_Tasks\Providers\One_Time\Settings_Saved' => [ 'Progress_Planner\Suggested_Tasks\Providers\Settings_Saved', '1.4.0' ], 'Progress_Planner\Suggested_Tasks\Local_Tasks\Providers\One_Time\Site_Icon' => [ 'Progress_Planner\Suggested_Tasks\Providers\Site_Icon', '1.4.0' ], 'Progress_Planner\Suggested_Tasks\Local_Tasks\Providers\Repetitive\Core_Update' => [ 'Progress_Planner\Suggested_Tasks\Providers\Core_Update', '1.4.0' ], 'Progress_Planner\Suggested_Tasks\Local_Tasks\Providers\Repetitive\Create' => [ 'Progress_Planner\Suggested_Tasks\Providers\Repetitive\Create', '1.4.0' ], diff --git a/tests/phpunit/test-class-admin-page-settings.php b/tests/phpunit/test-class-admin-page-settings.php index 80609e7563..d1feac7679 100644 --- a/tests/phpunit/test-class-admin-page-settings.php +++ b/tests/phpunit/test-class-admin-page-settings.php @@ -31,32 +31,6 @@ public function setUp(): void { $this->page_settings_instance = new Page_Settings(); } - /** - * Test constructor registers hooks. - * - * @return void - */ - public function test_constructor_registers_hooks() { - $this->assertNotFalse( \has_action( 'admin_menu', [ $this->page_settings_instance, 'add_admin_menu_page' ] ) ); - $this->assertNotFalse( \has_action( 'wp_ajax_prpl_settings_form', [ $this->page_settings_instance, 'store_settings_form_options' ] ) ); - } - - /** - * Test add_admin_menu_page adds submenu page. - * - * @return void - */ - public function test_add_admin_menu_page() { - global $submenu; - if ( ! isset( $submenu ) ) { - $submenu = []; - } - - $this->page_settings_instance->add_admin_menu_page(); - - // Verify submenu was added. - $this->assertTrue( true ); // Page registration verified via hook. - } /** * Test get_settings returns array. @@ -79,24 +53,4 @@ public function test_get_settings_includes_page_types() { // Settings should be an array (may be empty if no page types). $this->assertIsArray( $settings ); } - - /** - * Test store_settings_form_options requires nonce. - * - * @return void - */ - public function test_store_settings_form_options_requires_nonce() { - // Set up user with manage_options capability. - $user_id = $this->factory->user->create( [ 'role' => 'administrator' ] ); - \wp_set_current_user( $user_id ); - - // Test without nonce. - $_POST = []; - $_POST['action'] = 'prpl_settings_form'; - - // Should handle gracefully without nonce. - $this->assertTrue( true ); // Verified by not throwing errors. - - \wp_set_current_user( 0 ); - } } diff --git a/tests/phpunit/test-class-disable-comments.php b/tests/phpunit/test-class-disable-comments.php index aad5ebd645..5c0c0a17d7 100644 --- a/tests/phpunit/test-class-disable-comments.php +++ b/tests/phpunit/test-class-disable-comments.php @@ -1,6 +1,6 @@ get_settings()->set( 'include_post_types', [ 'post', 'page' ] ); - } -} diff --git a/tests/phpunit/test-class-suggested-tasks.php b/tests/phpunit/test-class-suggested-tasks.php index 7605cc30f8..a13eef01d0 100644 --- a/tests/phpunit/test-class-suggested-tasks.php +++ b/tests/phpunit/test-class-suggested-tasks.php @@ -42,19 +42,19 @@ public function test_task_cleanup() { 'provider_id' => 'update-core', ], [ - 'post_title' => 'settings-saved-' . \gmdate( 'YW' ), - 'task_id' => 'settings-saved-' . \gmdate( 'YW' ), + 'post_title' => 'core-siteicon-' . \gmdate( 'YW' ), + 'task_id' => 'core-siteicon-' . \gmdate( 'YW' ), 'date' => \gmdate( 'YW' ), - 'provider_id' => 'settings-saved', + 'provider_id' => 'core-siteicon', 'category' => 'configuration', ], // Not repetitive task, but with past date. [ - 'post_title' => 'settings-saved-202451', - 'task_id' => 'settings-saved-202451', + 'post_title' => 'core-siteicon-202451', + 'task_id' => 'core-siteicon-202451', 'date' => '202451', - 'provider_id' => 'settings-saved', + 'provider_id' => 'core-siteicon', 'category' => 'configuration', ], diff --git a/tests/phpunit/test-class-upgrade-migration-130.php b/tests/phpunit/test-class-upgrade-migration-130.php index 2a784fe9df..76f76065a8 100644 --- a/tests/phpunit/test-class-upgrade-migration-130.php +++ b/tests/phpunit/test-class-upgrade-migration-130.php @@ -47,7 +47,6 @@ public function test_recreating_tasks_from_activities() { 'review-post-2810-202517', 'review-post-4467-202517', 'update-core-202401', - 'settings-saved-202501', 'review-post-4530-202517', 'review-post-4477-202517', 'review-post-4569-202517', diff --git a/views/admin-page-settings.php b/views/admin-page-settings.php deleted file mode 100644 index 1f7fe5bed4..0000000000 --- a/views/admin-page-settings.php +++ /dev/null @@ -1,48 +0,0 @@ - - -
-
- -
- -
-

- - - -

- -
- the_view( 'page-settings/pages.php' ); ?> - -
- the_view( 'page-settings/post-types.php' ); ?> - the_view( 'page-settings/settings.php' ); ?> -
- - - - -
-
-
diff --git a/views/page-settings/pages.php b/views/page-settings/pages.php deleted file mode 100644 index 990f84b17d..0000000000 --- a/views/page-settings/pages.php +++ /dev/null @@ -1,33 +0,0 @@ - - -
-

- - the_asset( 'images/icon_pages.svg' ); ?> - - - - -

-

- -

-
- get_admin__page_settings()->get_settings() as $prpl_setting ) { - \progress_planner()->the_view( "setting/{$prpl_setting['type']}.php", [ 'prpl_setting' => $prpl_setting ] ); - } - ?> -
-
diff --git a/views/page-settings/post-types.php b/views/page-settings/post-types.php deleted file mode 100644 index cbd19d561e..0000000000 --- a/views/page-settings/post-types.php +++ /dev/null @@ -1,52 +0,0 @@ -get_settings()->get_post_types_names(); -$prpl_post_types = \progress_planner()->get_settings()->get_public_post_types(); - -// Early exit if there are no public post types. -if ( empty( $prpl_post_types ) ) { - return; -} - -// We use it in order to change grid layout when there are more than 5 valuable post types. -$prpl_data_attributes = 5 < \count( $prpl_post_types ) ? 'data-has-many-valuable-post-types' : ''; -?> - -
> -

- - the_asset( 'images/icon_copywriting.svg' ); ?> - - - - -

-
-

- -

-
- - - -
-
-
diff --git a/views/page-settings/settings.php b/views/page-settings/settings.php deleted file mode 100644 index 928c1149d6..0000000000 --- a/views/page-settings/settings.php +++ /dev/null @@ -1,38 +0,0 @@ - - -
-

- - the_asset( 'images/icon_user.svg' ); ?> - - - - -

-
-
- -
-
-
diff --git a/views/setting/page-select.php b/views/setting/page-select.php index fbae1937d7..405b703bc0 100644 --- a/views/setting/page-select.php +++ b/views/setting/page-select.php @@ -9,13 +9,12 @@ if ( ! \defined( 'ABSPATH' ) ) { exit; } - $prpl_setting_value = isset( $prpl_setting['value'] ) ? $prpl_setting['value'] : ''; +$prpl_context = isset( $context ) ? $context : ''; // Default value for the radio button. $prpl_radio_value = '_no_page_needed' === $prpl_setting_value ? 'not-applicable' : 'no'; $prpl_radio_value = \is_numeric( $prpl_setting_value ) && 0 < $prpl_setting_value ? 'yes' : $prpl_radio_value; - ?>