red dot if there are unread notifications
This commit is contained in:
parent
dbcd64bfe9
commit
11bbcb242f
4 changed files with 25 additions and 5 deletions
|
@ -854,8 +854,10 @@ label {
|
||||||
.accountListItem:hover a {
|
.accountListItem:hover a {
|
||||||
color: #424242;
|
color: #424242;
|
||||||
}
|
}
|
||||||
|
.accountNotifications {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
.accountNotifications.unread a {
|
.accountNotifications.unread a {
|
||||||
color: #424242;
|
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
}
|
}
|
||||||
.accountListItem:hover .accountIcon {
|
.accountListItem:hover .accountIcon {
|
||||||
|
@ -865,6 +867,16 @@ li.accountInvite span {
|
||||||
display: block;
|
display: block;
|
||||||
padding: 9px 0 9px 62px;
|
padding: 9px 0 9px 62px;
|
||||||
}
|
}
|
||||||
|
$unread_notifications_dot_size: 8px;
|
||||||
|
.unread-notifications-dot {
|
||||||
|
width: $unread_notifications_dot_size;
|
||||||
|
height: $unread_notifications_dot_size;
|
||||||
|
background-color: #e22;
|
||||||
|
border-radius: $unread_notifications_dot_size / 2;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
.accountImage {
|
.accountImage {
|
||||||
background-image: url(<%= asset_data_uri 'user.png' %>);
|
background-image: url(<%= asset_data_uri 'user.png' %>);
|
||||||
background-size: 84px 84px;
|
background-size: 84px 84px;
|
||||||
|
|
|
@ -39,11 +39,12 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_has_unread_notifications?
|
def user_has_unread_notifications?
|
||||||
return false if current_user.nil?
|
return @user_has_unread_notifications unless @user_has_unread_notifications.nil?
|
||||||
|
return (@user_has_unread_notifications = false) if current_user.nil?
|
||||||
current_user.mailboxer_notification_receipts.each do |receipt|
|
current_user.mailboxer_notification_receipts.each do |receipt|
|
||||||
return true if receipt.is_read == false
|
return (@user_has_unread_notifications = true) if receipt.is_read == false
|
||||||
end
|
end
|
||||||
false
|
@user_has_unread_notifications = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_unread_notification_count
|
def user_unread_notification_count
|
||||||
|
|
|
@ -24,7 +24,11 @@
|
||||||
</li>
|
</li>
|
||||||
<% if current_user.present? %>
|
<% if current_user.present? %>
|
||||||
<li class="accountListItem accountNotifications <%= user_has_unread_notifications? ? 'unread' : 'read' %>">
|
<li class="accountListItem accountNotifications <%= user_has_unread_notifications? ? 'unread' : 'read' %>">
|
||||||
<div class="accountIcon"></div>
|
<div class="accountIcon">
|
||||||
|
<% if user_has_unread_notifications? %>
|
||||||
|
<div class="unread-notifications-dot"></div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
<%= link_to "Notifications", notifications_path %>
|
<%= link_to "Notifications", notifications_path %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -74,6 +74,9 @@
|
||||||
<!-- Account / Sign in -->
|
<!-- Account / Sign in -->
|
||||||
<% if !(controller_name == "sessions" && action_name == "new") %>
|
<% if !(controller_name == "sessions" && action_name == "new") %>
|
||||||
<div class="sidebarAccount upperRightEl">
|
<div class="sidebarAccount upperRightEl">
|
||||||
|
<% if user_has_unread_notifications? %>
|
||||||
|
<div class="unread-notifications-dot"></div>
|
||||||
|
<% end %>
|
||||||
<div class="sidebarAccountIcon"><div class="tooltipsUnder">Account</div>
|
<div class="sidebarAccountIcon"><div class="tooltipsUnder">Account</div>
|
||||||
<% if current_user && current_user.image %>
|
<% if current_user && current_user.image %>
|
||||||
<%= image_tag current_user.image.url(:thirtytwo), :size => "32x32" %>
|
<%= image_tag current_user.image.url(:thirtytwo), :size => "32x32" %>
|
||||||
|
|
Loading…
Reference in a new issue