Compare commits
No commits in common. "94b6ef89dd15f2ce5901bf7314a50ce9edd8f22a" and "c7ea7eef3e38265ae29a468b8913626afc9adfc5" have entirely different histories.
94b6ef89dd
...
c7ea7eef3e
5 changed files with 8 additions and 14 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
module MoodsHelper
|
module MoodsHelper
|
||||||
def mode_for(mood, user)
|
def mode_for(mood)
|
||||||
if user.guess?
|
if params[:guess] == "active"
|
||||||
mood[:mode] || mood[:guess] || "unknown"
|
mood[:mode] || mood[:guess] || "unknown"
|
||||||
else
|
else
|
||||||
mood[:mode] || "unknown"
|
mood[:mode] || "unknown"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
class User < ApplicationRecord
|
class User < ApplicationRecord
|
||||||
has_secure_password
|
has_secure_password
|
||||||
has_many :sessions, dependent: :destroy
|
has_many :sessions, dependent: :destroy
|
||||||
has_many :moods, -> { order "recorded_at" }
|
has_many :moods
|
||||||
|
|
||||||
normalizes :email_address, with: ->(e) { e.strip.downcase }
|
normalizes :email_address, with: ->(e) { e.strip.downcase }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,20 +36,20 @@
|
||||||
<div class="container mb-4 p-3 has-background-white day-info">
|
<div class="container mb-4 p-3 has-background-white day-info">
|
||||||
<div class="title is-4">
|
<div class="title is-4">
|
||||||
<span class="icon"><i class="fa-regular fa-calendar"></i></span>
|
<span class="icon"><i class="fa-regular fa-calendar"></i></span>
|
||||||
<span data-mood-target="modeDay">Aujourd'hui : <%= @mode %></span>
|
<span data-mood-target="modeDay">Aujourd'hui</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="logs">
|
<div class="logs">
|
||||||
<div class="is-flex is-flex-direction-row is-flex-wrap-wrap mb-3">
|
<div class="is-flex is-flex-direction-row is-flex-wrap-wrap mb-3">
|
||||||
<% @history.each do |month| %>
|
<% @history.each do |month| %>
|
||||||
<div class="mr-3">
|
<div class="mr-3">
|
||||||
<div> <%= I18n.l(month[:month], format: "%b %y").capitalize %></div>
|
<div> <%= I18n.l(month[:month], format: "%B %Y").capitalize %></div>
|
||||||
<div class="is-flex is-flex-wrap-wrap">
|
<div class="is-flex is-flex-wrap-wrap">
|
||||||
<% month[:weeks].each do |week| %>
|
<% month[:weeks].each do |week| %>
|
||||||
<div class="is-flex is-flex-direction-column is-flex-wrap-wrap mb-3">
|
<div class="is-flex is-flex-direction-column is-flex-wrap-wrap mb-3">
|
||||||
<% week.each do |mood| %>
|
<% week.each do |mood| %>
|
||||||
<% mode = mode_for(mood, Current.user) %>
|
<% mode = mode_for(mood) %>
|
||||||
<div data-image="<%= asset_path(mode + ".jpg") %>" data-mode="<%= mode %>" data-day="<%= l mood[:recorded_at].to_date %>" data-action="click->mood#updateDayInfo" title="<%= l(mood[:recorded_at].to_date) %> : <%= mode %>" class="day <%= mode %>"></div>
|
<div data-image="<%= asset_path(mode + ".jpg") %>" data-mode="<%= mode %>" data-day="<%= l mood[:recorded_at].to_date %>" data-action="click->mood#updateDayInfo" title="<%= mood[:recorded_at] %> : <%= mode %>" class="day <%= mode %>"></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
class AddGuessToUsers < ActiveRecord::Migration[8.0]
|
|
||||||
def change
|
|
||||||
add_column :users, :guess, :boolean, default: false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
3
db/schema.rb
generated
3
db/schema.rb
generated
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[8.0].define(version: 2026_02_26_101258) do
|
ActiveRecord::Schema[8.0].define(version: 2026_02_19_114040) do
|
||||||
create_table "moods", force: :cascade do |t|
|
create_table "moods", force: :cascade do |t|
|
||||||
t.string "mode"
|
t.string "mode"
|
||||||
t.datetime "recorded_at"
|
t.datetime "recorded_at"
|
||||||
|
|
@ -48,7 +48,6 @@ ActiveRecord::Schema[8.0].define(version: 2026_02_26_101258) do
|
||||||
t.datetime "invitation_accepted_at"
|
t.datetime "invitation_accepted_at"
|
||||||
t.string "username", null: false
|
t.string "username", null: false
|
||||||
t.boolean "public", default: false
|
t.boolean "public", default: false
|
||||||
t.boolean "guess", default: false
|
|
||||||
t.index ["email_address"], name: "index_users_on_email_address", unique: true
|
t.index ["email_address"], name: "index_users_on_email_address", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue