WIP encourage people to upload larger avatars

This commit is contained in:
Sebastiaan Janssen
2015-06-23 10:57:01 +02:00
parent 6dc00ec763
commit 5dc3eb618e
4 changed files with 62 additions and 23 deletions
@@ -14,18 +14,22 @@
@if (showNotification)
{
<div class="alertbar__blue">
<div class="alertbar__yellow">
@Html.Raw(notificationText)
</div>
}
@*
@if (Request.Cookies["dismissAvatar"] == null && CurrentPage.Id != home.Id && avatarImage != null && (avatarImage.Width < 400 || avatarImage.Height < 400))
{
<div class="alertbar__blue avatarTooSmall">
Your profile image is a little on the small side, it would look<br />
much nicer if you could <a href="/member/profile">update it to be at least 400x400pixels</a>!<br/>
<span style="font-size: 0.8em; color: gray; padding-top: 4px; display: inline-block;">Neh, I like my blurry avatar, <a class="dismisAvatar" href="#">stop notifying me</a> please.</span>
@if (Request.Cookies["dismissAvatar"] == null && CurrentPage.Id != home.Id && avatarImage != null && (avatarImage.Width < 400 || avatarImage.Height < 400))
{
<div class="notification__blue avatarTooSmall">
<div class="message text-center">
<p>
Your profile picture is a little on the small side, it would look <strong>much nicer</strong> if you <a href="/member/profile">could update it to be larger image.</a>
</p>
</div>
}
*@
<div class="close-notification">
<i class="icon-Delete dismisAvatar"></i><span style="font-size: 0.7em;" class="dismisAvatar">Neh, I like my blurry avatar!</span>
</div>
</div>
}
@@ -1,9 +1,15 @@
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@using System.Drawing
@using our
@using uForum
@using uForum.Services
@{
var topicService = new TopicService(ApplicationContext.DatabaseContext);
Image avatarImage = null;
if (Members.IsLoggedIn())
{
avatarImage = Utils.GetMemberAvatarImage(Members.GetCurrentMember());
}
}
<div class="quick-menu">
<div class="container">
@@ -63,7 +69,24 @@
</div>
</div>
if (avatarImage != null && (avatarImage.Width < 400 || avatarImage.Height < 400))
{
<small>Notifications</small>
<a href="/member/profile" class="forum-thread">
<div class="row">
<div class="col-xs-10 col-md-8">
<div class="forum-thread-text">
<h3>Your profile picture is a little on the small side.</h3>
<p>
It would look <strong>much nicer</strong> if you could update it to be larger image.
</p>
</div>
</div>
</div>
</a>
}
<small>
Activity in threads you participated in
</small>
@@ -83,14 +106,14 @@
<h3>@topic.Title</h3>
<p>
@{
if (topic.Replies != 0 && !string.IsNullOrEmpty(topic.LastReplyAuthorName))
{
<text>last edited by @topic.LastReplyAuthorName</text>
}
else
{
<text>created by @topic.AuthorName</text>
}
if (topic.Replies != 0 && !string.IsNullOrEmpty(topic.LastReplyAuthorName))
{
<text>last edited by @topic.LastReplyAuthorName</text>
}
else
{
<text>created by @topic.AuthorName</text>
}
} @topic.Updated.ConvertToRelativeTime()
</p>
</div>
@@ -1,8 +1,15 @@
@using System.Drawing
@using our
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
@* Get the root of the website *@
var root = CurrentPage.AncestorOrSelf(1);
Image avatarImage = null;
if (Members.IsLoggedIn())
{
avatarImage = Utils.GetMemberAvatarImage(Members.GetCurrentMember());
}
}
<ul>
@@ -19,6 +26,10 @@
var member = Members.GetCurrentMember();
<div class="user">
@Html.Raw(our.Utils.GetMemberAvatar(member, 40))
@if (avatarImage != null && (avatarImage.Width < 400 || avatarImage.Height < 400))
{
<span class="notificationCount">1</span>
}
</div>
}
else
+4 -3
View File
@@ -237,7 +237,7 @@ namespace our
return null;
}
public static string GetGravatar(string email, int size, string memberName)
{
var emailId = email.ToLower();
@@ -246,9 +246,10 @@ namespace our
return string.Format("<img src=\"//www.gravatar.com/avatar/{0}?s={1}&d=mm&r=g&d=retro\" alt=\"{2}\" />", hash, size, memberName);
}
public static string GetLocalAvatar(string imgPath, int size, string memberName)
public static string GetLocalAvatar(string imgPath, int minSize, string memberName)
{
return string.Format("<img src=\"{0}?width={1}&height={1}&mode=crop\" alt=\"{2}\" />", imgPath, size, memberName);
return string.Format("<img src=\"{0}?width={1}&height={1}&mode=crop\" srcset=\"{0}?width={2}&height={2}&mode=crop 2x, {0}?width={3}&height={3}&mode=crop 3x\" alt=\"{4}\" />",
imgPath, minSize, (minSize * 2), (minSize * 3), memberName);
}
}