profile pages fixes

This commit is contained in:
byte[] 2019-12-05 13:32:53 -05:00
parent 87990fafe4
commit 3ab695cd3f
5 changed files with 25 additions and 4 deletions

View file

@ -64,7 +64,7 @@ defmodule PhilomenaWeb.ProfileController do
must: [ must: [
%{term: %{user_id: user.id}}, %{term: %{user_id: user.id}},
%{term: %{anonymous: false}}, %{term: %{anonymous: false}},
%{term: %{hidden_from_users: false}}, %{term: %{deleted: false}},
%{term: %{access_level: "normal"}} %{term: %{access_level: "normal"}}
] ]
} }
@ -76,6 +76,9 @@ defmodule PhilomenaWeb.ProfileController do
) )
|> Enum.filter(&Canada.Can.can?(current_user, :show, &1.topic)) |> Enum.filter(&Canada.Can.can?(current_user, :show, &1.topic))
about_me =
Renderer.render_one(%{body: user.description || ""}, conn)
recent_galleries = recent_galleries =
Gallery Gallery
|> where(creator_id: ^user.id) |> where(creator_id: ^user.id)
@ -99,7 +102,8 @@ defmodule PhilomenaWeb.ProfileController do
recent_posts: recent_posts, recent_posts: recent_posts,
recent_galleries: recent_galleries, recent_galleries: recent_galleries,
statistics: statistics, statistics: statistics,
layout_class: "layout--wide" about_me: about_me,
layout_class: "layout--medium"
) )
end end

View file

@ -0,0 +1,11 @@
.block__content.profile-about
= cond do
- @user.description not in [nil, ""] ->
== @about_me
- current?(@user, @conn.assigns.current_user) ->
em
' Want to
=> link "add some info about yourself?", to: "#"
- true ->

View file

@ -8,7 +8,7 @@
.block .block
= for post <- @posts do = for post <- @posts do
.block__content.alternating-color .block__content.alternating-color
| Post ' Post
=> link pretty_time(post.created_at), to: Routes.forum_topic_path(@conn, :show, post.topic.forum, post.topic, post_id: post) <> "#post_#{post.id}" => link pretty_time(post.created_at), to: Routes.forum_topic_path(@conn, :show, post.topic.forum, post.topic, post_id: post) <> "#post_#{post.id}"
| in topic ' in topic
=> link post.topic.title, to: Routes.forum_topic_path(@conn, :show, post.topic.forum, post.topic) => link post.topic.title, to: Routes.forum_topic_path(@conn, :show, post.topic.forum, post.topic)

View file

@ -6,6 +6,7 @@
h1.profile-top__name-header h1.profile-top__name-header
= @user.name = @user.name
| 's profile | 's profile
p = render PhilomenaWeb.UserAttributionView, "_user_title.html", object: %{user: @user}, large: true
span span
' Member since ' Member since
= pretty_time(@user.created_at) = pretty_time(@user.created_at)
@ -20,6 +21,8 @@
li = link("Uploads", to: Routes.search_path(@conn, :index, q: "uploader_id:#{@user.id}")) li = link("Uploads", to: Routes.search_path(@conn, :index, q: "uploader_id:#{@user.id}"))
li = link("Comments", to: Routes.comment_path(@conn, :index, cq: "user_id:#{@user.id}")) li = link("Comments", to: Routes.comment_path(@conn, :index, cq: "user_id:#{@user.id}"))
li = link("Posts", to: Routes.post_path(@conn, :index, pq: "user_id:#{@user.id}")) li = link("Posts", to: Routes.post_path(@conn, :index, pq: "user_id:#{@user.id}"))
= if current?(@user, @conn.assigns.current_user) do
li = link "My reports", to: Routes.report_path(@conn, :index)
ul.profile-top__options__column ul.profile-top__options__column
li = link("Favorites", to: Routes.search_path(@conn, :index, q: "faved_by_id:#{@user.id}")) li = link("Favorites", to: Routes.search_path(@conn, :index, q: "faved_by_id:#{@user.id}"))

View file

@ -10,6 +10,9 @@ defmodule PhilomenaWeb.ProfileView do
img_tag(badge_url_root() <> "/" <> badge.image, options) img_tag(badge_url_root() <> "/" <> badge.image, options)
end end
def current?(%{id: id}, %{id: id}), do: true
def current?(_user1, _user2), do: false
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),