app.kluk.fr/app/views/moods/public.html.erb
Christophe Robillard a484f8ffd9
Some checks are pending
CI / lint (push) Waiting to run
CI / scan_ruby (push) Waiting to run
CI / scan_js (push) Waiting to run
CI / test (push) Waiting to run
put the user's name forward on the public page
- title "Les humeurs de …" (with elision) above both columns
- selected date shown above the mode, in ink instead of grey
- brief fade when another day is selected (public page and dashboard)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 16:57:53 +02:00

50 lines
2.9 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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, "Comment ça Kluk chez #{@user.username} ?" %>
<% history = MoodCalendarService.generate_calendar(@user, start_date: 5.months.ago.beginning_of_month, end_date: Date.current) %>
<% selected_date = (Date.parse(params[:day]) rescue Date.current) %>
<% selected = find_day(history, selected_date) if selected_date < Date.current %>
<% selected_date = Date.current unless selected %>
<% aujourdhui = selected_date == Date.current %>
<% mode_du_jour = @user.moods.last&.mode %>
<% mode = aujourdhui ? mode_du_jour : mode_for(selected, @user) %>
<% status = day_status(selected, @user) unless aujourdhui %>
<% since = @user.current_mode_since %>
<article class="public" data-controller="calendrier"
data-calendrier-aujourdhui-value="<%= Date.current.iso8601 %>"
data-calendrier-aujourdhui-date-value="Aujourd’hui, <%= l(Date.current, format: "%A %-d %B") %>"
data-calendrier-aujourdhui-mode-value="<%= mode_du_jour&.label || "Pas de tasse posée" %>"
data-calendrier-aujourdhui-image-value="<%= (mode_du_jour || Mode.new).image_url %>"
data-calendrier-aujourdhui-couleur-value="<%= mode_du_jour&.color %>">
<h1 class="public-nom">Les humeurs <%= de_nom(@user.username) %></h1>
<figure class="carte-humeur carte-humeur-grande" data-calendrier-target="carte anime" style="<%= "--humeur: #{mode.color}" if mode %>">
<%= image_tag (mode || Mode.new).image_url, alt: "", data: { calendrier_target: "image" } %>
</figure>
<div class="public-texte">
<div class="public-jour" data-calendrier-target="anime" aria-live="polite">
<p class="public-date" data-calendrier-target="date"><%= aujourdhui ? "Aujourd’hui, #{l(Date.current, format: "%A %-d %B")}" : date_longue(selected_date) %></p>
<p class="public-mode" data-calendrier-target="mode"><%= mode&.label || "Pas de tasse posée" %></p>
<p class="public-depuis">
<span data-calendrier-target="depuis" <%= "hidden" unless aujourdhui %>>
<% if since == Date.current %>
Depuis ce matin.
<% elsif since %>
Depuis le <%= l(since, format: since.year == Date.current.year ? "%A %-d %B" : "%-d %B %Y") %>.
<% end %>
</span>
<span class="public-autre-jour" data-calendrier-target="retour" <%= "hidden" if aujourdhui %>>
<span class="detail-statut" data-calendrier-target="statut"><%= libelle_statut(status) if mode %></span>
<button type="button" class="lien" data-action="calendrier#revenir">Revenir à aujourd’hui</button>
</span>
</p>
</div>
<section class="public-historique" aria-labelledby="public-historique-titre">
<h2 id="public-historique-titre">Les derniers mois</h2>
<%= render "moods/legende", user: @user %>
<%= render "moods/calendrier", history: history, user: @user, par_annee: false,
interactive: true, selected_date: selected_date %>
</section>
</div>
</article>