diff --git a/lib/philomena_web/controllers/profile_controller.ex b/lib/philomena_web/controllers/profile_controller.ex index 48ee3ad5..5f24ecbe 100644 --- a/lib/philomena_web/controllers/profile_controller.ex +++ b/lib/philomena_web/controllers/profile_controller.ex @@ -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 diff --git a/lib/philomena_web/templates/profile/_about_me.html.slime b/lib/philomena_web/templates/profile/_about_me.html.slime new file mode 100644 index 00000000..1b63540d --- /dev/null +++ b/lib/philomena_web/templates/profile/_about_me.html.slime @@ -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 -> \ No newline at end of file diff --git a/lib/philomena_web/templates/profile/_recent_posts.html.slime b/lib/philomena_web/templates/profile/_recent_posts.html.slime index 83c90adb..c7b91658 100644 --- a/lib/philomena_web/templates/profile/_recent_posts.html.slime +++ b/lib/philomena_web/templates/profile/_recent_posts.html.slime @@ -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) diff --git a/lib/philomena_web/templates/profile/show.html.slime b/lib/philomena_web/templates/profile/show.html.slime index 88d7169f..43b5a7bf 100644 --- a/lib/philomena_web/templates/profile/show.html.slime +++ b/lib/philomena_web/templates/profile/show.html.slime @@ -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}")) diff --git a/lib/philomena_web/views/profile_view.ex b/lib/philomena_web/views/profile_view.ex index 48b2dd12..9feadcce 100644 --- a/lib/philomena_web/views/profile_view.ex +++ b/lib/philomena_web/views/profile_view.ex @@ -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),