mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 21:47:59 +01:00
add admin option to edit user links directly from profile page
This commit is contained in:
parent
9cef212ed2
commit
6677e318b8
2 changed files with 8 additions and 0 deletions
|
@ -73,6 +73,11 @@
|
|||
=> 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
|
||||
= if manages_awards?(@conn) do
|
||||
a.block__header--single-item href=Routes.profile_award_path(@conn, :new, @user) Badges
|
||||
|
|
|
@ -15,6 +15,9 @@ defmodule PhilomenaWeb.ProfileView do
|
|||
def manages_awards?(conn),
|
||||
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),
|
||||
do: award.badge.title
|
||||
def award_title(%{badge_name: ""} = award),
|
||||
|
|
Loading…
Reference in a new issue