Browse Source

feat: improve notes across the board

main
Inhji Y. 6 months ago
parent
commit
1753b53e75
  1. 13
      lib/mirage_web/live/blog_live.html.leex
  2. 11
      lib/mirage_web/live/inbox_live/item_component.html.leex
  3. 26
      lib/mirage_web/live/note_live/index.html.leex
  4. 26
      lib/mirage_web/live/note_live/show.html.leex

13
lib/mirage_web/live/blog_live.html.leex

@ -18,11 +18,14 @@
<% else %>
<section>
<%= for note <- @list.notes do %>
<%= live_patch to: Routes.note_show_path(MirageWeb.Endpoint, :show, note) do %>
<article id="note-<%= note.id %>">
<h2 class="title"><%= note.title %></h2>
</article>
<% end %>
<article id="note-<%= note.id %>">
<header>
<%= live_patch to: Routes.note_show_path(MirageWeb.Endpoint, :show, note) do %>
<h2 class="title"><%= note.title %></h2>
<% end %>
<time>Created <%= note.inserted_at |> Timex.from_now() %></time> <time>Last Edited <%= note.updated_at |> Timex.from_now() %></time>
</header>
</article>
<% end %>
</section>
<% end %>

11
lib/mirage_web/live/inbox_live/item_component.html.leex

@ -1,8 +1,7 @@
<article>
<h2>
<%= live_patch @note.title, to: Routes.note_show_path(MirageWeb.Endpoint, :show, @note) %>
</h2>
<p>
<time><%= @note.inserted_at |> Timex.from_now() %></time>
</p>
<h4>
<%= link @note.title, to: Routes.note_show_path(@socket, :show, @note) %>
<time><%= @note.updated_at |> Timex.from_now() %></time>
</h4>
<p><%= @note.content |> String.slice(0..50) %></p>
</article>

26
lib/mirage_web/live/note_live/index.html.leex

@ -14,28 +14,34 @@
return_to: Routes.note_index_path(@socket, :index) %>
<% end %>
<hr>
<section class="bg-content width-full">
<h3>✒️ Last Edited</h3>
<div class="cards">
<%= for note <- @notes.last_edited do %>
<%= link to: Routes.note_show_path(@socket, :show, note), class: "col card" do %>
<strong><%= note.title %></strong>
<article>
<h4>
<%= link note.title, to: Routes.note_show_path(@socket, :show, note) %>
<time><%= note.updated_at |> Timex.from_now() %></time>
</h4>
<p><%= note.content |> String.slice(0..50) %></p>
<% end %>
</article>
<% end %>
</div>
</section>
<hr>
<section class="bg-content width-full">
<h3>🕶️ Most Viewed</h3>
<div class="cards">
<%= for note <- @notes.most_viewed do %>
<%= link to: Routes.note_show_path(@socket, :show, note), class: "col card" do %>
<strong><%= note.title %></strong>
<article>
<h4>
<%= link note.title, to: Routes.note_show_path(@socket, :show, note) %>
<time><%= note.updated_at |> Timex.from_now() %></time>
</h4>
<p><%= note.content |> String.slice(0..50) %></p>
<% end %>
</article>
<% end %>
</div>
</section>

26
lib/mirage_web/live/note_live/show.html.leex

@ -10,14 +10,27 @@
<article>
<header>
<h1><%= @note.title %></h1>
<time datetime="<%= @note.inserted_at %>">Created <%= Timex.from_now(@note.inserted_at) %></time>
<time datetime="<%= @note.updated_at %>">Last edited <%= Timex.from_now(@note.updated_at) %></time>
<div class="tags">
<%= for topic <- @note.topics do %>
<span class="tag">
<%= link topic.text, to: Routes.topic_path(MirageWeb.Endpoint, :show, topic) %>
</span>
<% end %>
</div>
</header>
<section class="content html">
<%= raw @note.content_html %>
</section>
<footer>
<time datetime="<%= @note.inserted_at %>">Created <%= Timex.from_now(@note.inserted_at) %></time>
<time datetime="<%= @note.updated_at %>">Last edited <%= Timex.from_now(@note.updated_at) %></time>
</footer>
<hr>
<%= if not Enum.empty?(@note.backlinks) do %>
<section class="backlinks">
<h4>Backlinks</h4>
@ -58,15 +71,6 @@
</form>
</section>
<% end %>
<footer>
Tags:
<%= for topic <- @note.topics do %>
<time>
<%= link topic.text, to: Routes.topic_path(MirageWeb.Endpoint, :show, topic) %>
</time>
<% end %>
</footer>
</article>
<%= if @current_user do %>

Loading…
Cancel
Save