Skip to content
This repository has been archived by the owner on Mar 27, 2022. It is now read-only.

Commit

Permalink
Show family avatars on profile page
Browse files Browse the repository at this point in the history
  • Loading branch information
seven1m committed Feb 18, 2017
1 parent 38c7a15 commit 4ad0558
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 6 deletions.
21 changes: 21 additions & 0 deletions app/assets/stylesheets/app/profile.scss
Expand Up @@ -50,3 +50,24 @@
}
}
}

.family-box {
text-align: center !important;
.box-header {
padding: 5px 0;
.box-title {
float: none;
}
}
.box-body {
padding-top: 0;
}
.person {
display: inline-block;
margin: 0 5px 5px 5px;
text-align: center;
img {
margin-bottom: 5px;
}
}
}
8 changes: 5 additions & 3 deletions app/controllers/people_controller.rb
Expand Up @@ -27,11 +27,13 @@ def show
render action: 'show_limited'
elsif @person and @logged_in.can_read?(@person)
@family = @person.family
if @family.nil?
@family_people = []
end
if @person == @logged_in
# TODO eager load family here
@family_people = (@person.family.try(:people) || []).reject(&:deleted)
@family_people = @person.family.people.undeleted.where.not(id: @person.id)
else
@family_people = @person.family.try(:visible_people) || []
@family_people = @person.family.visible_people.reject { |p| p.id == @person.id }
end
@albums = @person.albums.order(created_at: :desc)
@friends = @person.friends.minimal
Expand Down
3 changes: 0 additions & 3 deletions app/views/people/_details.haml
@@ -1,7 +1,4 @@
%table.table
%tr.row-with-avatar
%td= link_to avatar_tag(@family), @family
%td= link_to t('people.show.details.family', family: @family.try(:name)), @family
- if @logged_in.admin?(:edit_profiles)
%tr
%td= t('people.show.details.created')
Expand Down
13 changes: 13 additions & 0 deletions app/views/people/_family_box.haml
@@ -0,0 +1,13 @@
- if @family_people.any?
.box.box-info.family-box
.box-header
%h3.box-title= link_to t('people.show.details.family', family: @family.try(:name)), @family
.box-body
- @family_people.each do |person|
= link_to person do
.person
= avatar_tag(person)
%br
= person.first_name
- unless person.visible?
%i.fa.fa-lock.text-gray
2 changes: 2 additions & 0 deletions app/views/people/show.html.haml
Expand Up @@ -45,6 +45,8 @@
= render partial: 'details'

.col-lg-4.col-sm-6
= render 'family_box'

- if @person.testimony.present?
.box.box-solid.box-success.testimony
.box-header
Expand Down

0 comments on commit 4ad0558

Please sign in to comment.