Skip to content

Commit

Permalink
Chore: Consolidate static page routes using a scope declaration (#4865)
Browse files Browse the repository at this point in the history
## Because

This PR refactors the routing configuration for static pages in
routes.rb by consolidating individual get routes into a single scope
declaration for the static_pages controller. This change streamlines the
routing, improves readability, and makes future management of static
pages more efficient.


## This PR

- Replaced individual get routes for static pages (home, about, faq,
team, contributing, support_us, terms_of_use, privacy-policy,
success_stories) with a scope declaration for the static_pages
controller in routes.rb.


## Issue

Closes #4855 

## Additional Information
NA

## Pull Request Requirements
<!-- Replace the whitespace between the square brackets with an 'x',
e.g. [x]. After you create the PR, they will become checkboxes that you
can click on. -->
- [x] I have thoroughly read and understand [The Odin Project
Contributing
Guide](https://github.com/TheOdinProject/theodinproject/blob/main/CONTRIBUTING.md)
- [x] The title of this PR follows the `keyword: brief description of
change` format, using one of the following keywords:
    - `Feature` - adds new or amends existing user-facing behavior
- `Chore` - changes that have no user-facing value, refactors,
dependency bumps, etc
    - `Fix` - bug fixes
-   [x] The `Because` section summarizes the reason for this PR
- [x] The `This PR` section has a bullet point list describing the
changes in this PR
- [x] I have verified all tests and linters pass after making these
changes.
- [x] If this PR addresses an open issue, it is linked in the `Issue`
section
-   [ ] If applicable, this PR includes new or updated automated tests
  • Loading branch information
Tongxin-Sun authored Dec 3, 2024
1 parent 9338e14 commit 237043e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,18 @@
resources :points, only: %i[index show create]
end

get 'home' => 'static_pages#home'
get 'about' => 'static_pages#about'
get 'faq' => 'static_pages#faq'
get 'team' => 'static_pages#team'
get 'contributing' => 'static_pages#contributing'
get 'support_us' => 'static_pages#support_us'
get 'terms_of_use' => 'static_pages#terms_of_use'
get 'privacy-policy' => 'static_pages#privacy_policy'
get 'success_stories' => 'static_pages#success_stories'
scope controller: :static_pages do
get 'home'
get 'about'
get 'faq'
get 'team'
get 'contributing'
get 'support_us'
get 'terms_of_use'
get 'privacy-policy'
get 'success_stories'
end

get 'sitemap' => 'sitemap#index', defaults: { format: 'xml' }

namespace :guides do
Expand Down

0 comments on commit 237043e

Please sign in to comment.