Skip to content

Commit

Permalink
Fix typo in namespace. Add necessary CSS to main admin.css file. Remo…
Browse files Browse the repository at this point in the history
…ve enqueues that aren't being used yet. Fix test assertion
  • Loading branch information
dkotter committed Oct 9, 2024
1 parent e6435a5 commit 86311ff
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 44 deletions.
2 changes: 0 additions & 2 deletions includes/Classifai/Admin/SimilarTermsListTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ public function prepare_items() {

$this->_column_headers = array( $columns, $hidden, $sortable );

$this->process_bulk_action();

$terms = get_terms(
[
'taxonomy' => $this->taxonomy,
Expand Down
42 changes: 2 additions & 40 deletions includes/Classifai/Features/TermCleanup.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace ClassifAI\Features;
namespace Classifai\Features;

use Classifai\Admin\SimilarTermsListTable;
use Classifai\Services\LanguageProcessing;
Expand Down Expand Up @@ -83,7 +83,7 @@ public function setup() {
}
}

$this->setting_page_url = admin_url( 'tools.php?page=classifai-term-cleanup' );
$this->setting_page_url = admin_url( 'tools.php?page=classifai-term-cleanup' );
// $this->background_process = new TermCleanupBackgroundProcess(); // TODO: Implement this class.

Check warning on line 87 in includes/Classifai/Features/TermCleanup.php

View workflow job for this annotation

GitHub Actions / vipcs

This comment is 50% valid code; is this commented out code?
}

Expand All @@ -93,8 +93,6 @@ public function setup() {
* This will only fire if the Feature is enabled.
*/
public function feature_setup() {
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_assets' ] );

// Register the settings page for the Feature.
add_action( 'admin_menu', [ $this, 'register_admin_menu_item' ] );
add_action( 'admin_post_classifai_init_term_cleanup', [ $this, 'start_term_cleanup_process' ] );
Expand Down Expand Up @@ -220,42 +218,6 @@ public function render_settings_page() {
<?php
}

/**
* Enqueue the admin scripts.
*
* @param string $hook_suffix The current admin page.
*/
public function enqueue_admin_assets( string $hook_suffix ) {
if ( 'tools_page_classifai-term-cleanup' !== $hook_suffix ) {
return;
}

wp_enqueue_style(
'classifai-style',
CLASSIFAI_PLUGIN_URL . 'assets/css/admin.css',
array(),
CLASSIFAI_PLUGIN_VERSION,
'all'
);

wp_enqueue_script(
'classifai-script',
CLASSIFAI_PLUGIN_URL . 'assets/js/admin.js',
array( 'jquery' ),
CLASSIFAI_PLUGIN_VERSION,
true
);

wp_localize_script(
'classifai-script',
'classifai_term_cleanup_params',
array(
'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
'ajax_nonce' => wp_create_nonce( 'classifai-status' ),
)
);
}

/**
* Get the description for the enable field.
*
Expand Down
132 changes: 132 additions & 0 deletions src/scss/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -923,3 +923,135 @@ div.classifai-openai__result-disable-link {
display: block;
padding: 0 1em 1.5em 1em;
}

.classifai-content .classifai-term-consolidation {
margin-top: 20px;
}

.classifai-term-consolidation .classifai-tabs.tabs-center {
margin-bottom: 24px
}

.classifai-term-consolidation .classifai-tabs.tabs-justify {
table-layout: fixed;
width: 100%
}

.classifai-term-consolidation .classifai-tabs a.tab {
color: #1d2327;
cursor: pointer;
display: block;
font-size: 14px;
padding: 16px 12px;
position: relative;
text-decoration: none;
transform: translateZ(0);
transition: all .3s ease;
margin-bottom: 4px;
background: #f9f9f9;
}

.classifai-term-consolidation .classifai-tabs a.tab:focus {
box-shadow: none
}

.classifai-term-consolidation .classifai-tabs a.tab:hover {
color: var(--classifai-admin-theme-color)
}

.classifai-term-consolidation .classifai-tabs a.tab.active {
background: #f0f0f0;
border-radius: 4px;
box-shadow: none;
font-weight: 600
}

.classifai-term-consolidation .classifai-tabs a.tab.active:after {
opacity: 1;
transform: scale(1)
}

.classifai-term-consolidation .classifai-term-consolidation-wrapper {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-top: 20px;
}


.classifai-term-consolidation .classifai-term-consolidation-content-wrapper .classifai-term-consolidation-content-wrapper-field-label {
text-align: left
}

.classifai-term-consolidation .classifai-term-consolidation-content-wrapper .classifai-term-consolidation-content-wrapper-field {
padding: 0
}

.classifai-term-consolidation .classifai-term-consolidation-content-wrapper .classifai-term-consolidation-content-wrapper-field-label>label {
display: block;
font-weight: 700;
margin-bottom: 0;
text-transform: uppercase
}

.classifai-term-consolidation .classifai-term-consolidation-content-wrapper input[type=password],
.classifai-term-consolidation .classifai-term-consolidation-content-wrapper input[type=text] {
font-size: 14px;
height: 38px;
margin-bottom: 4px;
width: 100%
}

.classifai-term-consolidation .classifai-term-consolidation-content-wrapper .classifai-setup-footer {
margin-top: 40px
}

@media screen and (max-width: 782px) {
.classifai-term-consolidation .classifai-term-consolidation-content-wrapper {
padding-left: 18px
}
}

@media screen and (max-width: 600px) {
.classifai-term-consolidation .classifai-term-consolidation-content-wrapper {
margin-bottom: 20px;
padding-left: 0;
width: 100%
}
}

.classifai-term-consolidation-process-status p{
font-size: 14px;
}

.classifai-term-consolidation-process-status .dashicons-yes-alt{
color: #48be1e;
}

.classifai-term-consolidation .classifai-term-consolidation-content-wrapper input[type=text].current-page{
width: auto;
height: auto;
}

table.similar_terms {
border-collapse: collapse;
border: 2px solid #c3c4c7;
}

table.similar_terms tbody tr.border {
border-left: 2px solid #c3c4c7;
border-right: 2px solid #c3c4c7;
border-top: 2px solid #c3c4c7;
}

table.similar_terms tbody tr.border.skip {
border-top: 0px;
}

table.similar_terms tbody tr.border:last-child {
border-bottom: 2px solid #c3c4c7;
}

table.similar_terms th#actions {
width: 15%;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe( '[Language processing] Term Cleanup - Azure OpenAI Tests', () => {
'/wp-admin/tools.php?page=classifai&tab=language_processing&feature=feature_term_cleanup'
);

cy.get( '#use_ep' ).should( 'be:hidden' );
cy.get( '#use_ep' ).should( 'be.hidden' );
} );

it( 'Can save Term Cleanup settings', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe( '[Language processing] Term Cleanup - OpenAI Tests', () => {
'/wp-admin/tools.php?page=classifai&tab=language_processing&feature=feature_term_cleanup'
);

cy.get( '#use_ep' ).should( 'be:hidden' );
cy.get( '#use_ep' ).should( 'be.hidden' );
} );

it( 'Can save Term Cleanup settings', () => {
Expand Down

0 comments on commit 86311ff

Please sign in to comment.