Browse Source

feat: show amount of notes, links, topics

main
Inhji Y. 8 months ago
parent
commit
bec0b73b06
  1. 2
      lib/mirage_web/live/link_live/index.ex
  2. 3
      lib/mirage_web/live/link_live/index.html.leex
  3. 1
      lib/mirage_web/live/note_live/index.html.leex
  4. 1
      lib/mirage_web/templates/topic/index.html.eex

2
lib/mirage_web/live/link_live/index.ex

@ -6,7 +6,7 @@ defmodule MirageWeb.LinkLive.Index do
@impl true
def mount(_params, _session, socket) do
{:ok, assign(socket, :notes_links, Links.list_links())}
{:ok, assign(socket, :links, Links.list_links())}
end
@impl true

3
lib/mirage_web/live/link_live/index.html.leex

@ -1,5 +1,6 @@
<header class="hero">
<h1>Listing Links</h1>
<p><%= Enum.count(@links) %> Links</p>
</header>
<%= if @live_action in [:new, :edit] do %>
@ -12,7 +13,7 @@
<% end %>
<section class="bg-content width-full grid cards wrap">
<%= for link <- @notes_links do %>
<%= for link <- @links do %>
<%= live_redirect to: Routes.link_show_path(@socket, :show, link), class: "col card", id: "link-#{link.id}" do %>
<strong><%= link.title %></strong>
<p><%= link.domain || link.url %></p>

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

@ -4,6 +4,7 @@
<header class="hero">
<h1>Listing Notes</h1>
<p><%= Enum.count(@notes) %> Notes</p>
<%= if @current_user do %>
<span><%= live_patch "New Note", to: Routes.note_index_path(@socket, :new), class: "button" %></span>
<% end %>

1
lib/mirage_web/templates/topic/index.html.eex

@ -1,5 +1,6 @@
<header class="hero">
<h1>Listing Topics</h1>
<p><%= Enum.count(@topics) %> Topics</p>
</header>
<div class="tags width-full bg-content">

Loading…
Cancel
Save