app.kluk.fr/app/views/moods/index.html.erb
Christophe Robillard 764cb542ac
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / scan_js (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
let visitors pick a day on the public page
Clicking a day shows its mode and illustration in the header, with a link
back to today. The journal stays private: the calendar helper now separates
interactivity from journal exposure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 07:54:25 +02:00

31 lines
1.8 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<% content_for :title, "Mes humeurs – Kluk" %>
<% history = @user.history %>
<% selected_date = (Date.parse(params[:day]) rescue Date.current) %>
<% selected = find_day(history, selected_date) || find_day(history, selected_date = Date.current) %>
<% status = day_status(selected, @user) if selected %>
<% mode = mode_for(selected, @user) if selected %>
<div class="tableau" data-controller="calendrier">
<div class="tableau-calendrier">
<h1 class="tableau-titre">Mes humeurs</h1>
<%= render "moods/legende", user: @user, journal: true %>
<%= render "moods/calendrier", history: history, user: @user, interactive: true, journal: true, selected_date: selected_date %>
</div>
<aside class="detail" aria-live="polite" aria-label="Jour sélectionné">
<figure class="carte-humeur" data-calendrier-target="carte" style="<%= "--humeur: #{mode.color}" if mode %>">
<%= image_tag (mode || Mode.new).image_url, alt: "", data: { calendrier_target: "image" } %>
</figure>
<div class="detail-texte">
<h2 class="detail-date" data-calendrier-target="date"><%= date_longue(selected_date) %></h2>
<p class="detail-mode">
<span data-calendrier-target="mode"><%= mode&.label || "Pas de tasse posée" %></span>
<span class="detail-statut" data-calendrier-target="statut"><%= libelle_statut(status) if mode %></span>
</p>
<% info = selected&.dig(:day_log)&.info %>
<p class="detail-journal <%= "detail-journal-vide" unless info %>" data-calendrier-target="journal" data-vide="Rien d’écrit ce jour-là."><%= info || "Rien d’écrit ce jour-là." %></p>
<%= link_to info ? "Modifier le journal" : "Écrire dans le journal", edit_day_log_for_day_path(day: selected_date),
class: "bouton bouton-petit", data: { calendrier_target: "lien" } %>
</div>
</aside>
</div>