Skip to content

Commit

Permalink
add lists to stats_live.ex so nav can render on stats page #145 #424
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Nov 1, 2023
1 parent 31df47e commit 8a785e3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lib/app_web/controllers/tag_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ defmodule AppWeb.TagController do
person_id = conn.assigns[:person][:id] || 0
tags = Tag.list_person_tags(person_id)

render(conn, "index.html", tags: tags,
lists: App.List.get_lists_for_person(person_id))
render(conn, "index.html",
tags: tags,
lists: App.List.get_lists_for_person(person_id)
)
end

def new(conn, _params) do
Expand Down
3 changes: 2 additions & 1 deletion lib/app_web/live/stats_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ defmodule AppWeb.StatsLive do
person_id: person_id,
metrics: metrics,
sort_column: :person_id,
sort_order: :asc
sort_order: :asc,
lists: App.List.get_lists_for_person(person_id)
)}
end

Expand Down
8 changes: 6 additions & 2 deletions lib/app_web/templates/nav/nav.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,12 @@
<div x-show="openMenu">
<%= for list <- @lists do %>
<div class="space-y-1 px-2 pb-3 pt-2 text-right">
<a class="text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium"
href={list_url(list.cid)}><%= list_name(list.name) %></a>
<a
class="text-gray-300 hover:bg-gray-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium"
href={list_url(list.cid)}
>
<%= list_name(list.name) %>
</a>
</div>
<% end %>
<div class="space-y-1 px-2 pb-3 pt-2 text-right">
Expand Down

0 comments on commit 8a785e3

Please sign in to comment.