Compare commits

...

2 commits

Author SHA1 Message Date
Christophe Robillard
c7ea7eef3e show calendar icon when select a day
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
2026-02-26 10:34:00 +01:00
Christophe Robillard
977ea97d65 only click to view mood day, no mouse over 2026-02-26 10:33:34 +01:00
2 changed files with 4 additions and 10 deletions

View file

@ -1,23 +1,17 @@
import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
static targets = [ "image", "modeDay", "modeDayMobile" ]
static targets = [ "image", "modeDay" ];
updateDayInfo(event) {
const image = this.imageTarget;
const modeDay = this.modeDayTarget;
const modeDayMobile = this.modeDayMobileTarget;
const modeDayContent = event.target.dataset.day + ' : ' + event.target.dataset.mode;
image.src = event.target.dataset.image;
modeDayMobile.textContent = modeDayContent;
modeDay.textContent = modeDayContent;
event.target.className = "selected-day " + event.target.dataset.mode;
}
removeFeedback(event) {
event.target.className = "day " + event.target.dataset.mode;
}
connect() {
window.location = "#end";
}

View file

@ -34,9 +34,9 @@
</div>
</div>
<div class="container mb-4 p-3 has-background-white day-info">
<div class="title is-4" data-mood-target="modeDay">
<div class="title is-4">
<span class="icon"><i class="fa-regular fa-calendar"></i></span>
Aujourd'hui
<span data-mood-target="modeDay">Aujourd'hui</span>
</div>
</div>
<div class="logs">
@ -49,7 +49,7 @@
<div class="is-flex is-flex-direction-column is-flex-wrap-wrap mb-3">
<% week.each do |mood| %>
<% 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 mouseover->mood#updateDayInfo mouseleave->mood#removeFeedback" title="<%= mood[:recorded_at] %> : <%= 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 %>
</div>
<% end %>