comfycamp/lib/comfycamp_web/controllers/notes_html.ex

39 lines
784 B
Elixir
Raw Normal View History

2024-07-29 16:19:47 +05:00
defmodule ComfycampWeb.NotesHTML do
2024-07-29 18:07:44 +05:00
@moduledoc """
This module contains pages rendered by NotesController.
2024-07-29 18:07:44 +05:00
"""
2024-07-29 16:19:47 +05:00
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
2024-07-29 16:19:47 +05:00
end