Today's App Updates: Significant Improvements Across Image Handling, User Experience & More
What developments have taken place today?
Several significant improvements and additions have been implemented across various parts of the application, primarily focused on image handling, user interaction, and website display enhancements. These include:
Configuration Updates: The
Config
struct now includes fields for storing the paths to directories where resized images are saved (data_resized_directory
) and original files are stored (data_directory
). This facilitates image URL generation and file organization.Image Resizing & Uploads: A comprehensive image resizing system has been implemented, utilizing the
convert
command-line tool for padding, centering, and compression. TheGenerateImageDiskPath
function now dynamically constructs unique filenames based on width, height, and quality parameters. File upload functionality is also integrated into the ‘Post Add’ form, enabling users to submit images alongside their posts.File Repository Enhancements: New methods (
Save
,LoadOne
,UpdatePath
) have been added to thePostFileRepository
struct for managing associated files within posts.Homepage & Post Display Updates: The homepage template now displays uploaded image paths, and the post display has been revamped to support larger images (800x800) alongside smaller thumbnails, utilizing a fullscreen modal view that adapts to different screen sizes. Responsive design adjustments ensure proper layout on smaller screens.
GitLab Integration: Code has been added to retrieve post statistics from GitLab using the GitLab API and handle commit information retrieval. The
GitLabReader
struct now includes functionality for fetching all files associated with specific posts.Newsletter Subscription: The homepage’s newsletter subscription process is now handled asynchronously, validating email format and preventing duplicate submissions through a series of checks and event listeners.
Testing Framework Improvements: The testing suite has been updated to use
npm run test
instead ofnpx jest
, with enhanced error handling and build aborting on test failure. It also incorporates mocking of theDate.now()
function for consistent test results.Time Difference Display: A new JavaScript file (
/js/post.js
) has been added to display human-readable time differences for posts, leveraging ahumanReadableTimeDifference
function and apluralize
helper. The existinghomepage.js
was updated to reference this new file.Modal Closure: The application now properly closes modals when the Escape key is pressed.
Validation Updates: The
PostAddValidator
has been enhanced to include validation for file uploads (size and format) and to ensure that required fields like title and content are not empty. Additionally, it filters out empty files during validation.Image Resizing Logic Refinement: A dedicated JavaScript file (
/js/post.js
) handles the resizing of images using a new function, accommodating a 100x100 pixel size with an 80-quality setting and includes debugging logging for supported sizes. TheConvert
function now incorporates additional arguments to improve image compatibility.Form Submission Logging: Added logging within the form submission handler to print form data to the console, aiding in debugging.
In summary, these changes significantly enhance the application’s functionality by enabling rich media support (images), streamlining user workflows (file uploads and newsletter subscriptions), improving website presentation (post display and responsive design), and strengthening code quality through testing improvements and validation rules. The integration of GitLab statistics provides valuable data insights, while the modularized JavaScript files promote maintainability and extensibility.
image handling user interaction website enhancements gitlab integration file repository