Prohlížeč zdrojového kódu
docs/specs/home-page.md
# Spec: Home Page
- **Status:** active
- **Created:** 2026-03-05
- **Related code:** `app/controllers/pages_controller.rb`, `app/views/pages/home.html.erb`, `app/assets/stylesheets/_home.scss`
## Overview
The home page is the entry point for the portfolio. It introduces the site and its author, and gives visitors two clear paths: browsing code examples or viewing the application's source code. It also surfaces a preview of up to six examples as an at-a-glance showcase.
## Behaviour
### Hero section
- A centred hero section displays the site title ("Ruby Webování - Petr Šedivý") and a brief description of what visitors can do.
- Two CTA links are shown: "Procházet příklady" (→ `/examples`) and "Zobrazit zdroj" (→ `/source`).
### Examples preview
- Up to six examples are shown below the hero as cards (in position order).
- Each card shows the example's title (as a link to its detail page), description, and tags.
- If no examples exist, the preview section is omitted entirely.
### Routes
- `GET /` → `pages#home`
## Implementation Notes
- `PagesController#home` loads examples via `ExampleRegistry.all.first(6)` — no DB query, purely file-based.
- The `.hero` class is styled in `_home.scss` as a centred section.
- The examples grid uses the shared `.examples-grid` class (defined in `_cards.scss`), the same grid used on the examples index page.
## Tests
- `spec/requests/pages_spec.rb` — smoke tests: HTTP 200 and presence of site title in response body.
## See Also
- [Examples System](examples.md) — `ExampleRegistry` supplies the examples shown in the preview; the card layout is shared with the examples index.
- [Styling and CSS](styling.md) — `_home.scss` provides the `.hero` styles; `_cards.scss` provides `.examples-grid` and `.tag`.
## Change Log
- 2026-03-05: Initial retrospective spec written.