Compare commits
2 commits
8f9ef3c9f8
...
c7ea7eef3e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7ea7eef3e | ||
|
|
977ea97d65 |
2 changed files with 4 additions and 10 deletions
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 %>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue