My space on the web https://inhji.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

60 lines
1.9 KiB

<header class="hero">
<h1><span class="id"><%= "##{@note.id}" %></span> <%= @note.title %></h1>
<p><time datetime="<%= @note.inserted_at %>"><%= Timex.from_now(@note.inserted_at) %></time> / <time datetime="<%= @note.updated_at %>"><%= Timex.from_now(@note.updated_at) %></time></p>
<p class="tags">
<%= for topic <- @note.topics do %>
<span class="tag"><%= topic.text %></span>
<% end %>
</p>
</header>
<div class="width-full bg-content" phx-update="ignore" id="note-<%= @note.id %>">
<div class="content html">
<%= raw @note.content_html %>
</div>
</div>
<%= if not Enum.empty?(@note.backlinks) do %>
<section class="backlinks">
<h4>Backlinks</h4>
<%= for backlink <- @note.backlinks do %>
<div class="link-wrapper">
<%= live_patch backlink.title, to: Routes.live_path(@socket, MirageWeb.ShowNoteLive, backlink), class: "link" %>
</div>
<% end %>
</section>
<% end %>
<%= if not Enum.empty?(@note.links) do %>
<section class="sources">
<h4>Sources</h4>
<%= for link <- @note.links do %>
<div class="link-wrapper">
<%= link link.title || link.url, to: link.url, class: "link" %>
<%= if @current_user do %>
<%= link "🗑️ DELETE", to: "#", phx_click: "delete_link", phx_value_link_id: link.id %>
<% end %>
</div>
<% end %>
</section>
<% end %>
<%= if @current_user do %>
<%= f = form_for @link_changeset, "#", [phx_submit: :save_link] %>
<fieldset>
<%= hidden_input f, :note_id %>
<%= url_input f, :url, placeholder: "Add new link and press ENTER" %>
</fieldset>
</form>
<% end %>
<%= if @current_user do %>
<div class="buttons">
<span><%= link "Edit", to: Routes.note_path(MirageWeb.Endpoint, :edit, @note), class: "button" %></span>
<span><%= link "Back", to: Routes.note_path(MirageWeb.Endpoint, :index), class: "button" %></span>
<span><%= link "Delete", to: Routes.note_path(MirageWeb.Endpoint, :delete, @note), method: :delete, data: [confirm: "Are you sure?"], class: "button" %></span>
</div>
<% end %>