Skip to content
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

style: tweak styling for table #53

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/css/admin-options.css

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions functions/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,14 @@ function google_ss2db_truncate_middle( string $str, int $max_chars = 16 ): strin

return substr_replace( $str, '...', (int) floor( $max_chars / 2 ), $str_length - $max_chars );
}

/**
* Retrieves plugin data from the main plugin file.
* This function fetches data such as version number and plugin name from the plugin's main file.
*
* @return array<string, mixed> The plugin data.
*/
function google_ss2db_get_plugin_data(): array {
$plugin_data = get_plugin_data( plugin_dir_path( __DIR__ ) . 'google-spreadsheet-to-db.php' );
return $plugin_data;
}
8 changes: 6 additions & 2 deletions includes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@ function google_ss2db_menu(): void {
* This function is hooked to the WordPress admin styles queue.
*/
function google_ss2db_admin_styles(): void {
wp_enqueue_style( 'admin-options', plugin_dir_url( __DIR__ ) . 'assets/css/admin-options.css', array() );
$plugin_data = google_ss2db_get_plugin_data();
$plugin_version = $plugin_data['Version'];
wp_enqueue_style( 'admin-options', plugin_dir_url( __DIR__ ) . 'assets/css/admin-options.css?v=' . $plugin_version, array() );
}

/**
* Enqueues custom scripts for the admin options page of the plugin.
* It also localizes the script to include nonce and plugin directory URL for secure AJAX calls.
*/
function google_ss2db_admin_scripts(): void {
wp_enqueue_script( 'google-ss2db-script', plugin_dir_url( __DIR__ ) . 'assets/js/admin-options.js', array( 'jquery' ), null, true );
$plugin_data = google_ss2db_get_plugin_data();
$plugin_version = $plugin_data['Version'];
wp_enqueue_script( 'google-ss2db-script', plugin_dir_url( __DIR__ ) . 'assets/js/admin-options.js?v=' . $plugin_version, array( 'jquery' ), null, true );
wp_localize_script(
'google-ss2db-script',
'google_ss2db_data',
Expand Down
3 changes: 2 additions & 1 deletion src/assets/css/_pages/admin-options.css
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
font-size: 10px;
color: #999;

@media only screen and (max-width: 782px) {
@media only screen and (width <= 782px) {
padding-left: 10px;
}
}
Expand Down Expand Up @@ -255,6 +255,7 @@
}

& tr {
height: 28px;
border-right: none;

& td {
Expand Down