mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +01:00
user link stuff (untested)
This commit is contained in:
parent
113908f820
commit
b5637e9afb
3 changed files with 17 additions and 3 deletions
|
@ -32,6 +32,10 @@
|
|||
border-bottom: 1px solid $border_color;
|
||||
}
|
||||
|
||||
.block__content--destroyed {
|
||||
background-color: $destroyed_content_color;
|
||||
}
|
||||
|
||||
.block__header {
|
||||
font-size: 14px;
|
||||
line-height: $block_header_height;
|
||||
|
|
|
@ -69,16 +69,16 @@
|
|||
- else
|
||||
.block__header
|
||||
span.block__header__title User Links
|
||||
= for link <- @user.verified_links, link.public or can?(@conn, :edit, link) do
|
||||
= for link <- @user.verified_links, should_see_link?(@conn, @user, link) do
|
||||
- watchers = if link.tag, do: @watcher_counts[link.tag.id] || 0, else: 0
|
||||
|
||||
.block__content.alternating-color.break-word
|
||||
.block__content.alternating-color.break-word class=link_block_class(link)
|
||||
.center
|
||||
= if link.tag do
|
||||
.tag_list = render PhilomenaWeb.TagView, "_tag.html", tag: link.tag, conn: @conn
|
||||
= link(link.uri, to: link.uri)
|
||||
|
||||
= if current?(@user, @conn.assigns.current_user) do
|
||||
= if current?(@user, @conn.assigns.current_user) or manages_links?(@conn, @user) do
|
||||
br
|
||||
' Watched by
|
||||
=> watchers
|
||||
|
@ -93,6 +93,10 @@
|
|||
' •
|
||||
a href=Routes.profile_user_link_path(@conn, :edit, @user, link)
|
||||
' Edit
|
||||
- else
|
||||
=> unless link.public do
|
||||
br
|
||||
' Hidden
|
||||
|
||||
.block
|
||||
= if manages_awards?(@conn) and not hide_staff_tools?(@conn) do
|
||||
|
|
|
@ -18,6 +18,12 @@ defmodule PhilomenaWeb.ProfileView do
|
|||
def manages_links?(conn, user),
|
||||
do: can?(conn, :edit_links, user)
|
||||
|
||||
def should_see_link?(conn, user, link),
|
||||
do: link.public or can?(conn, :edit, link) or current?(user, conn.assigns.current_user)
|
||||
|
||||
def link_block_class(%{public: false}), do: "block__content--destroyed"
|
||||
def link_block_class(_link), do: nil
|
||||
|
||||
def award_title(%{badge_name: nil} = award),
|
||||
do: award.badge.title
|
||||
|
||||
|
|
Loading…
Reference in a new issue