refactor: improved fallback settings for importer#1120
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the fallback image settings for the Feedzy RSS feeds importer to improve user experience. Users can now choose between using the general fallback image from global settings or setting a custom fallback image specifically for each feed.
- Refactored fallback image UI to present radio button options for general vs custom settings
- Improved JavaScript code modernization with ES6 syntax and better formatting
- Enhanced UX with clearer labeling and preview functionality for fallback images
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| includes/views/js/import-metabox-edit.js | Modernized JavaScript syntax from ES5 to ES6, improved code formatting and structure |
| includes/views/import-metabox-edit.php | Added radio button interface for fallback image options with preview functionality |
| includes/admin/feedzy-rss-feeds-import.php | Updated logic to separate custom and inherited thumbnail handling |
| css/settings.css | Added CSS for new fallback images display layout |
Comments suppressed due to low confidence (1)
includes/views/import-metabox-edit.php:774
- The variable name
$default_thumbnails_id(plural) is confusing since it's derived from$default_thumbnail_id(singular). Consider renaming to$default_thumbnail_idsfor clarity.
$default_thumbnails_id = isset( $default_thumbnail_id ) ? explode( ',', $default_thumbnail_id ) : array();
| // Reset the image preview. | ||
| document.querySelector('.feedzy-media-preview').remove(); | ||
| removeFallbackImage.classList.remove('is-show'); | ||
| // removeFallbackImage.classList.remove('is-show'); |
There was a problem hiding this comment.
This commented-out code should be removed rather than left as a comment, as it creates confusion about the intended behavior.
| } | ||
| } else { | ||
| $( '<div class="fz-form-group mb-20 feedzy-media-preview"><a href="javascript:;" class="btn btn-outline-primary feedzy-images-selected">' + feedzy.i10n.action_btn_text_3.replace( '%d', countSelected ) + '</a></div>' ).insertBefore( button.parent() ); | ||
| $( |
There was a problem hiding this comment.
The code appears to have a line break issue. The jQuery selector should be properly closed, but the opening $( doesn't match with the context - this looks like a formatting error that could cause JavaScript syntax errors.
|
Plugin build for 27cf0b2 is ready 🛎️!
Note You can preview the changes in the Playground |
| <?php | ||
| echo wp_kses_post( | ||
| sprintf( | ||
| /* translators: %s: opening anchor tag, %s: closing anchor tag */ |
There was a problem hiding this comment.
This translator's comment seems to be outdated.
| <?php | ||
| echo wp_kses_post( | ||
| sprintf( | ||
| /* translators: %s: opening anchor tag, %s: closing anchor tag */ |
| sprintf( | ||
| /* translators: %s: opening anchor tag, %s: closing anchor tag */ | ||
| __( 'No general fallback image set. %s', 'feedzy-rss-feeds' ), | ||
| '<a href="' . esc_url( admin_url( 'admin.php?page=feedzy-settings' ) ) . '" target="_blank">' . esc_html__( 'Set one in Feedzy Settings', 'feedzy-rss-feeds' ) . '</a>' |
There was a problem hiding this comment.
Update it like we disscus it
fcf213c to
5191444
Compare
8b98d9d to
27cf0b2
Compare
|
🎉 This PR is included in version 5.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
Now the user can select between general settings and their custom fallback image.
Will affect visual aspect of the product
YES
Screenshots
Test instructions
Check before Pull Request is ready:
Closes https://github.com/Codeinwp/feedzy-rss-feeds-pro/issues/885#event-18809301811