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.
 
 
 
 
 

83 lines
2.6 KiB

<%= if @current_user do %>
<%= live_render @socket, MirageWeb.GotoAnythingLive, id: "goto-anything-wrapper" %>
<% end %>
<%= if @live_action in [:edit] do %>
<%= live_modal @socket, MirageWeb.NoteLive.FormComponent,
id: @note.id,
title: @page_title,
action: @live_action,
note: @note,
return_to: Routes.note_show_path(@socket, :show, @note) %>
<% end %>
<article class="single">
<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>
<footer class="width-full bg-content">
<p class="tags">
<span class="tag">Views: <%= @note.views %></span>
</p>
</footer>
</article>
<%= 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.note_show_path(@socket, :show, 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 to: link.url, class: "link" do %>
<span class="flex"><%= link.title || link.url %></span>
<span class="flex"><%= link.domain %></span>
<% end %>
<%= if @current_user do %>
<%= link "🗑️ DELETE", to: "#", phx_click: "delete_link", phx_value_link_id: link.id, data: [confirm: "Are you sure?"] %>
<% 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", autocomplete: "url" %>
</fieldset>
</form>
<% end %>
<%= if @current_user do %>
<div class="buttons">
<%= live_patch "Edit", to: Routes.note_show_path(@socket, :edit, @note), class: "button", class: "button" %>
<%= live_redirect "Back", to: Routes.note_index_path(@socket, :index), class: "button" %>
<%= link "Delete", to: "#", phx_click: "delete", phx_value_id: @note.id, data: [confirm: "Are you sure?"], class: "button" %>
</div>
<% end %>