Skip to content

Commit

Permalink
For logged in users, we now show a thumbnail instead of their email
Browse files Browse the repository at this point in the history
address.
  • Loading branch information
jfly committed Nov 24, 2015
1 parent a75c4e8 commit a77e6f6
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions WcaOnRails/app/assets/stylesheets/delegates.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ tr.candidate-delegate {
height: 50px;

vertical-align: middle;
}
.avatar-thumbnail-lg {
width: 100px;
height: 100px;

&.avatar-thumbnail-lg {
width: 100px;
height: 100px;
}
}

.popover-content img {
Expand Down
8 changes: 8 additions & 0 deletions WcaOnRails/app/assets/stylesheets/navbar-static-top.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ body {
}
}

$nav-avatar-thumbnail-size: 40px;
.avatar-thumbnail {
width: $nav-avatar-thumbnail-size;
height: $nav-avatar-thumbnail-size;
margin-top: -($nav-avatar-thumbnail-size - 20px) / 2;
margin-bottom: -($nav-avatar-thumbnail-size - 20px) / 2;
}

.navbar-collapse {
background: #ddd;
margin: 0;
Expand Down
5 changes: 4 additions & 1 deletion WcaOnRails/app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<a href="#" class="dropdown-toggle top-nav" data-toggle="dropdown" data-hover="dropdown">
<% if current_user %>
<% notification_count = notifications_for_user(current_user).length %>
<%= current_user.email %>
<%= render "shared/user_avatar", user: current_user, do_not_show_full_image_on_hover: true %>
<% if notification_count > 0 %>
<span class="badge"><%= notification_count %></span>
<% end %>
Expand All @@ -111,6 +111,9 @@
</a>
<ul class="dropdown-menu" role="menu">
<% if current_user %>
<li role="presentation" class="dropdown-header">
<%= current_user.name %>
</li>
<li>
<%= link_to notifications_path do %>
Notifications
Expand Down
10 changes: 8 additions & 2 deletions WcaOnRails/app/views/shared/_user_avatar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
<% url = user.send(avatar_symbol).url(:thumb) + ( defined?(break_cache) ? "?#{Time.now.to_f}" : "" ) %>
<div class="avatar-thumbnail <%= defined?(avatar_class) ? avatar_class : "" %>"
style="background-image: url('<%= url %>');"
data-trigger="hover" data-toggle="popover" title="<%= defined?(title) ? title : "" %>" data-html="true" data-content="<img src='<%= user.send(avatar_symbol).url %>'></img>"
<% if !defined?(do_not_show_full_image_on_hover) %>
data-trigger="hover"
data-toggle="popover"
title="<%= defined?(title) ? title : "" %>"
data-html="true"
data-content="<img src='<%= user.send(avatar_symbol).url %>'></img>"
<% end %>
></div>
<% else %>
<div class="avatar-thumbnail"></div>
<div class="avatar-thumbnail" style="background-image: url('<%= asset_path 'missing_avatar_thumb.png' %>');"></div>
<% end %>

0 comments on commit a77e6f6

Please sign in to comment.