comfycamp/lib/comfycamp_web/controllers/notes_html.ex
2024-08-25 23:58:22 +05:00

39 lines
784 B
Elixir
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

defmodule ComfycampWeb.NotesHTML do
@moduledoc """
This module contains pages rendered by NotesController.
"""
use ComfycampWeb, :html
def index(assigns) do
~H"""
<div>
<h1>Заметки</h1>
<%= for note <- @notes do %>
<div>
<.link href={~p"/notes/#{note}"}>
<h2><%= note.title %></h2>
</.link>
<%= note.inserted_at %>
</div>
<% end %>
</div>
"""
end
def show(assigns) do
~H"""
<div>
<h1><%= @note.title %></h1>
<.back navigate={~p"/notes"}>К списку заметок</.back>
<p>Создана: <%= @note.inserted_at %></p>
<p>Обновлена: <%= @note.updated_at %></p>
<%= raw(@note_body) %>
</div>
"""
end
end