style: mix format
This commit is contained in:
parent
c60a5e0f12
commit
a724826a59
1 changed files with 51 additions and 39 deletions
|
@ -27,28 +27,40 @@
|
||||||
{exam.date} |
|
{exam.date} |
|
||||||
<b>
|
<b>
|
||||||
{case Date.diff(exam.date, Date.utc_today()) do
|
{case Date.diff(exam.date, Date.utc_today()) do
|
||||||
0 -> gettext("Today")
|
0 -> gettext("Today")
|
||||||
1 -> gettext("Tommorow")
|
1 -> gettext("Tommorow")
|
||||||
x when x > 1 -> ngettext("Tomorrow", "%{count} days left", x)
|
x when x > 1 -> ngettext("Tomorrow", "%{count} days left", x)
|
||||||
x when x < 0 -> ngettext("Yesterday", "%{count} days passed", x * -1)
|
x when x < 0 -> ngettext("Yesterday", "%{count} days passed", x * -1)
|
||||||
end}
|
end}
|
||||||
</b>
|
</b>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button phx-click="edit" phx-value-id={exam.id}
|
<button
|
||||||
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-3 rounded-md">
|
phx-click="edit"
|
||||||
|
phx-value-id={exam.id}
|
||||||
|
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-3 rounded-md"
|
||||||
|
>
|
||||||
{gettext("Edit")}
|
{gettext("Edit")}
|
||||||
</button>
|
</button>
|
||||||
<button phx-click="remove" phx-value-id={exam.id}
|
<button
|
||||||
class="bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-3 rounded-md">
|
phx-click="remove"
|
||||||
|
phx-value-id={exam.id}
|
||||||
|
class="bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-3 rounded-md"
|
||||||
|
>
|
||||||
{gettext("Remove")}
|
{gettext("Remove")}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<.modal :if={@live_action in [:new, :edit]} id="exam-modal" show on_cancel={JS.patch(~p"/exams")}>
|
<.modal :if={@live_action in [:new, :edit]} id="exam-modal" show on_cancel={JS.patch(~p"/exams")}>
|
||||||
<.live_component module={ExmrWeb.ExamLive.FormComponent} id={@exam.id || :new} title={@page_title}
|
<.live_component
|
||||||
action={@live_action} exam={@exam} patch={~p"/exams"} />
|
module={ExmrWeb.ExamLive.FormComponent}
|
||||||
|
id={@exam.id || :new}
|
||||||
|
title={@page_title}
|
||||||
|
action={@live_action}
|
||||||
|
exam={@exam}
|
||||||
|
patch={~p"/exams"}
|
||||||
|
/>
|
||||||
</.modal>
|
</.modal>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
@ -64,35 +76,35 @@
|
||||||
<!-- Weekdays -->
|
<!-- Weekdays -->
|
||||||
<%= for day <- ~w(Sun Mon Tue Wed Thu Fri Sat) do %>
|
<%= for day <- ~w(Sun Mon Tue Wed Thu Fri Sat) do %>
|
||||||
<div class="font-bold text-center">{day}</div>
|
<div class="font-bold text-center">{day}</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<!-- Empty spaces for previous month -->
|
<!-- Empty spaces for previous month -->
|
||||||
<%= for _ <- 1..(Date.day_of_week(@current_month)) do %>
|
<%= for _ <- 1..(Date.day_of_week(@current_month)) do %>
|
||||||
<div></div>
|
<div></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<!-- Days of the month -->
|
<!-- Days of the month -->
|
||||||
<%= for day <- 1..Date.days_in_month(@current_month) do %>
|
<%= for day <- 1..Date.days_in_month(@current_month) do %>
|
||||||
<% {:ok, date}=Date.new(@current_month.year, @current_month.month, day) %>
|
<% {:ok, date} = Date.new(@current_month.year, @current_month.month, day) %>
|
||||||
|
|
||||||
<div class={["border rounded p-3", @current_month == date && "bg-zinc-800"]}>
|
<div class={["border rounded p-3", @current_month == date && "bg-zinc-800"]}>
|
||||||
<div class="text-sm font-bold">{day}</div>
|
<div class="text-sm font-bold">{day}</div>
|
||||||
|
|
||||||
<!-- Render events for the current day -->
|
<!-- Render events for the current day -->
|
||||||
|
|
||||||
<% IO.puts("Date: #{date}") %>
|
<% IO.puts("Date: #{date}") %>
|
||||||
<% IO.inspect(Map.get(@events, date)) %>
|
<% IO.inspect(Map.get(@events, date)) %>
|
||||||
<%= case Map.get(@events, date) do %>
|
<%= case Map.get(@events, date) do %>
|
||||||
<% nil -> %>
|
<% nil -> %>
|
||||||
<!-- No events for this day -->
|
<!-- No events for this day -->
|
||||||
<% events -> %>
|
<% events -> %>
|
||||||
<ul class="mt-2 text-xs">
|
<ul class="mt-2 text-xs">
|
||||||
<%= for event <- events do %>
|
<%= for event <- events do %>
|
||||||
<li>{event.subject}</li>
|
<li>{event.subject}</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue