From 2ea386e557a25a12f8348cdf4a2968cdf07a6169 Mon Sep 17 00:00:00 2001 From: Christophe Robillard Date: Sun, 15 Mar 2026 19:26:52 +0100 Subject: [PATCH] show legend based on custom modes --- app/assets/stylesheets/kluk.css | 27 +-------------------------- app/models/user.rb | 1 + app/views/moods/index.html.erb | 26 ++++++-------------------- 3 files changed, 8 insertions(+), 46 deletions(-) diff --git a/app/assets/stylesheets/kluk.css b/app/assets/stylesheets/kluk.css index 659dea5..9dc978f 100644 --- a/app/assets/stylesheets/kluk.css +++ b/app/assets/stylesheets/kluk.css @@ -42,32 +42,7 @@ main { align-content: center; } -.bar-afond { - background: black; - width: 10px; - height: 10px; -} - -.bar-creatif { - background: red; - width: 10px; - height: 10px; -} - -.bar-frigo { - background: gray; - width: 10px; - height: 10px; -} - -.bar-croisiere { - background: green; - width: 10px; - height: 10px; -} - -.bar-en-charge { - background: orange; +.bar { width: 10px; height: 10px; } diff --git a/app/models/user.rb b/app/models/user.rb index fe92d95..156f55a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,6 +2,7 @@ class User < ApplicationRecord has_secure_password has_many :sessions, dependent: :destroy has_many :moods, -> { order "recorded_at" } + has_many :modes normalizes :email_address, with: ->(e) { e.strip.downcase } diff --git a/app/views/moods/index.html.erb b/app/views/moods/index.html.erb index 5e0bc10..0063f55 100644 --- a/app/views/moods/index.html.erb +++ b/app/views/moods/index.html.erb @@ -12,26 +12,12 @@
Légende
-
-
-
Triste
-
-
-
-
En charge
-
-
-
-
Croisiere
-
-
-
-
Creatif
-
-
-
-
A fond
-
+ <% @user.modes.each do |mode| %> +
+
+
<%= mode.label %>
+
+ <% end %>