Mattias Bodlund 11 hours ago
parent
commit
503930d6ea
1 changed files with 24 additions and 19 deletions
  1. +24
    -19
      AGENTS.md

+ 24
- 19
AGENTS.md View File

@ -1,16 +1,19 @@
# IKEA Foundation - Week 2026 Project
This project is a Ruby on Rails application developed for the IKEA Foundation. It appears to be a multi-lingual, interactive game or educational tool ("Week 2026") where players progress through various stages, making choices or facing "chance" events.
This project is a Ruby on Rails application developed for the IKEA Foundation. It is a multi-lingual, interactive game/educational tool where players progress through various stages, making choices or facing "chance" events.
## Key Features
- **Multi-lingual Support:** Uses the `mobility` gem for translating content into numerous languages (en, zh, hr, cs, da, nl, fi, fr, fr-CA, de, hu, it, ja, ko, nb, pl, pt, ro, sr, sk, sl, es, sv, uk).
- **Content Management:** A hierarchical "Node" system (using `ancestry`) for managing pages, stages, and interactive elements.
- **Player Progression:** Tracks player progress, scores, and decisions across different stages.
- **Interactive Stages:** Includes mechanics for "flipping" between "chance" and "choice" outcomes, sampling random results, and advancing through a sequence of stages.
- **Admin Interface:** A backend for managing nodes, assets (using Active Storage), users, and translations.
- **Background Jobs:** Uses `sidekiq` and `redis` for asynchronous processing.
- **Search:** Integrates `pg_search` for full-text search capabilities within the node/content system.
- **Multi-lingual Support:** Uses the `mobility` gem for translating content into numerous languages. Supported locales include: en, zh, hr, cs, da, nl, fi, fr, fr-CA, de, hu, it, ja, ko, nb, pl, pt, ro, sr, sk, sl, es, sv, uk.
- **Hierarchical Content Management:** A "Node" system (using `ancestry`) for managing pages, stages, and interactive elements.
- **Player Progression:** Tracks player progress, scores, and decisions across different stages in the `Player` model's `progress` JSONB field.
- **Interactive Game Flow:** Managed by `StagesController`, featuring:
- **Flip:** Randomly determines if a stage is a "chance" or "choice" event.
- **Reveal:** Displays the specific content for the flipped event.
- **Pick:** For "chance", randomly samples an outcome; for "choice", records the player's selection.
- **Result:** Shows the outcome (e.g., best, bad, good, game_over) based on the previous step.
- **Admin Interface:** A backend for managing nodes, assets (Active Storage), users, and translations.
- **Search:** `pg_search` integration for content discovery.
## Technical Stack
@ -18,21 +21,23 @@ This project is a Ruby on Rails application developed for the IKEA Foundation. I
- **Language:** Ruby 3.4.9
- **Database:** PostgreSQL
- **Asset Pipeline:** Propshaft with Importmap-rails and Stimulus/Turbo.
- **Task Management:** Sidekiq with Redis.
- **Styling/UI:** Custom CSS/JS (Stimulus controllers for interactivity).
- **Background Jobs:** Sidekiq with Redis.
## Core Models
- `Node`: The central model for content, representing pages, stages, and interactive components in a tree structure.
- `Player`: Represents a session/user playing the game, tracking their `progress`, `current_stage`, and `score`.
- `Asset` & `Attachment`: Manage files and their association with nodes.
- `User`: Handles admin authentication and roles.
- `VerificationCode`: Likely used for secure admin login or two-step authentication.
- `Node`: The central content model. Templates are hierarchy-dependent:
- **Root (Depth 0):** `start`
- **Level 1:** `stage`
- **Level 2:** `choice`, `chance`
- **Level 3 (under choice/chance):** `best`, `bad`, `good`, `game_over`
- `Player`: Tracks session state, `progress`, `current_stage`, and `score`.
- `Asset` & `Attachment`: Handles media and its contextual content (body text, styling) associated with nodes.
- `User`: Admin authentication and roles.
## Project Structure
- `app/controllers/admin/`: Admin backend logic.
- `app/controllers/stages_controller.rb`: Main logic for the interactive game stages.
- `app/controllers/site_controller.rb`: Logic for rendering content nodes as pages.
- `config/locales/`: Translation files for all supported languages.
- `db/migrate/`: Database schema evolutions.
- `app/controllers/stages_controller.rb`: Main game loop (Flip -> Reveal -> Pick -> Result).
- `app/controllers/site_controller.rb`: Content delivery for standard pages.
- `app/models/concerns/`: Shared logic for ancestry, attachments, and tags.
- `config/locales/`: YAML translation files.

Loading…
Cancel
Save