add admin option to edit user links directly from profile page

This commit is contained in:
byte[] 2019-12-21 09:54:13 -05:00
parent 9cef212ed2
commit 6677e318b8
2 changed files with 8 additions and 0 deletions

View file

@ -73,6 +73,11 @@
=> watchers => watchers
= pluralize("user", "users", watchers) = pluralize("user", "users", watchers)
= if manages_links?(@conn, @user) do
br
a href=Routes.profile_user_link_path(@conn, :edit, @user, link)
' Edit
.block .block
= if manages_awards?(@conn) do = if manages_awards?(@conn) do
a.block__header--single-item href=Routes.profile_award_path(@conn, :new, @user) Badges a.block__header--single-item href=Routes.profile_award_path(@conn, :new, @user) Badges

View file

@ -15,6 +15,9 @@ defmodule PhilomenaWeb.ProfileView do
def manages_awards?(conn), def manages_awards?(conn),
do: can?(conn, :create, Philomena.Badges.Award) do: can?(conn, :create, Philomena.Badges.Award)
def manages_links?(conn, user),
do: can?(conn, :edit_links, user)
def award_title(%{badge_name: nil} = award), def award_title(%{badge_name: nil} = award),
do: award.badge.title do: award.badge.title
def award_title(%{badge_name: ""} = award), def award_title(%{badge_name: ""} = award),