mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-19 14:17:59 +01:00
profile pages fixes
This commit is contained in:
parent
87990fafe4
commit
3ab695cd3f
5 changed files with 25 additions and 4 deletions
|
@ -64,7 +64,7 @@ defmodule PhilomenaWeb.ProfileController do
|
|||
must: [
|
||||
%{term: %{user_id: user.id}},
|
||||
%{term: %{anonymous: false}},
|
||||
%{term: %{hidden_from_users: false}},
|
||||
%{term: %{deleted: false}},
|
||||
%{term: %{access_level: "normal"}}
|
||||
]
|
||||
}
|
||||
|
@ -76,6 +76,9 @@ defmodule PhilomenaWeb.ProfileController do
|
|||
)
|
||||
|> Enum.filter(&Canada.Can.can?(current_user, :show, &1.topic))
|
||||
|
||||
about_me =
|
||||
Renderer.render_one(%{body: user.description || ""}, conn)
|
||||
|
||||
recent_galleries =
|
||||
Gallery
|
||||
|> where(creator_id: ^user.id)
|
||||
|
@ -99,7 +102,8 @@ defmodule PhilomenaWeb.ProfileController do
|
|||
recent_posts: recent_posts,
|
||||
recent_galleries: recent_galleries,
|
||||
statistics: statistics,
|
||||
layout_class: "layout--wide"
|
||||
about_me: about_me,
|
||||
layout_class: "layout--medium"
|
||||
)
|
||||
end
|
||||
|
||||
|
|
11
lib/philomena_web/templates/profile/_about_me.html.slime
Normal file
11
lib/philomena_web/templates/profile/_about_me.html.slime
Normal 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 ->
|
|
@ -8,7 +8,7 @@
|
|||
.block
|
||||
= for post <- @posts do
|
||||
.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}"
|
||||
| in topic
|
||||
' in topic
|
||||
=> link post.topic.title, to: Routes.forum_topic_path(@conn, :show, post.topic.forum, post.topic)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
h1.profile-top__name-header
|
||||
= @user.name
|
||||
| 's profile
|
||||
p = render PhilomenaWeb.UserAttributionView, "_user_title.html", object: %{user: @user}, large: true
|
||||
span
|
||||
' Member since
|
||||
= 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("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}"))
|
||||
= if current?(@user, @conn.assigns.current_user) do
|
||||
li = link "My reports", to: Routes.report_path(@conn, :index)
|
||||
|
||||
ul.profile-top__options__column
|
||||
li = link("Favorites", to: Routes.search_path(@conn, :index, q: "faved_by_id:#{@user.id}"))
|
||||
|
|
|
@ -10,6 +10,9 @@ defmodule PhilomenaWeb.ProfileView do
|
|||
img_tag(badge_url_root() <> "/" <> badge.image, options)
|
||||
end
|
||||
|
||||
def current?(%{id: id}, %{id: id}), do: true
|
||||
def current?(_user1, _user2), do: false
|
||||
|
||||
def award_title(%{badge_name: nil} = award),
|
||||
do: award.badge.title
|
||||
def award_title(%{badge_name: ""} = award),
|
||||
|
|
Loading…
Reference in a new issue