Shared Partials
Reusable view partials live in app/views/shared/. These provide consistent UI patterns across the application.
Available Partials
| Partial | Purpose |
|---|---|
_bookmark_button.html.erb |
Toggle bookmark/unbookmark with turbo_confirm |
_card_grid.html.erb |
Flexible grid layout with turbo_frame and pagination |
_close_button.html.erb |
Close button with optional back_path, sr-only label |
_delete_button.html.erb |
Delete action button |
_edit_button.html.erb |
Edit action button |
_empty_state.html.erb |
Empty state with icon, headline, message, optional CTA |
_error_messages.html.erb |
Validation error display with i18n keys |
_profile_image.html.erb |
User profile image with ActiveStorage fallback |
_resource_header.html.erb |
Header with bookmark filter, filter button, create button (with policy check) |
_resource_search.html.erb |
Search form with search_path and turbo_frame locals |
_table_checkbox.html.erb |
Checkbox for table row selection |
Conventions
- Locals are documented with
<%# locals: (variable:) %>comments at the top of each partial - Partials use
t()helpers for all user-facing text (no hardcoded strings) - Authorization checks use Pundit policies where applicable
- State changes use
data-turbo-confirmfor destructive actions
Turbo Stream Partials
Some resources have .turbo_stream.erb templates for reactive updates:
resources/sentence_sentences/generate.turbo_stream.erb– Updates generated sentencesresources/verbs/index.turbo_stream.erb– Handles pagination withturbo_stream.append