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

#275 - Admin Post CRUD & Ordering Enhancements #280

Merged
merged 4 commits into from
Feb 12, 2025

Conversation

gamesover
Copy link
Contributor

@gamesover gamesover commented Feb 9, 2025

address #275 first subtask - admin user can add a post with action text, but no upload image

This PR introduces several improvements and new features for managing posts via the admin interface. Key changes include:

Admin CRUD for Posts:
Administrators can now create, update, and view posts through a dedicated admin interface. The new views and controllers ensure a consistent, user-friendly experience for managing blog posts.

Custom Post Ordering:
The posts index now orders records using a SQL expression:
COALESCE(published_at, publish_scheduled_at) DESC NULLS LAST
followed by a secondary order on created_at DESC. This guarantees that posts are prioritized by the effective publish date, with unpublished posts (or those without dates) sorted at the bottom, and then by their creation time.

Friendly URLs & Slug Generation:
Posts now use FriendlyId for SEO-friendly URLs, with logic to generate slugs based on the published date and title.

Enhanced Validations & Enums:
The Post model now validates presence for key attributes and leverages enums for status (draft, scheduled, published, archived) and category (news, announcements).

Additional Refactoring:
Minor fixes to rubocop styles and unit tests ensure code quality and maintainability.

Add Blog url in menu
blog

New a post
new post

created a post
create post2

list posts
list posts

@gamesover gamesover marked this pull request as draft February 9, 2025 04:40
@gamesover gamesover changed the title #275 - admin can create, update and view posts #275 - Admin Post CRUD & Ordering Enhancements Feb 9, 2025
@gamesover gamesover marked this pull request as ready for review February 9, 2025 05:34
@gamesover gamesover force-pushed the 275-add-post-by-admin-user branch from 3583b99 to 4d5ebad Compare February 9, 2025 13:03
@leesheppard leesheppard merged commit c4b4d02 into rubyaustralia:main Feb 12, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants