mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-23 01:32:16 +00:00
notifications page
This commit is contained in:
parent
1d8b307bb5
commit
e4a501c026
3 changed files with 46 additions and 1 deletions
|
@ -111,6 +111,19 @@ private set
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult MarkAllRead()
|
||||||
|
{
|
||||||
|
var db = new ApplicationDbContext();
|
||||||
|
string uid = User.Identity.GetUserId();
|
||||||
|
var unread = db.Notifications.Where(x => x.IsRead == false && x.UserId == uid);
|
||||||
|
foreach(var u in unread.ToArray())
|
||||||
|
{
|
||||||
|
u.IsRead = true;
|
||||||
|
}
|
||||||
|
db.SaveChanges();
|
||||||
|
return Redirect(Url.Action("Index", "Manage") + "#t_notifications");
|
||||||
|
}
|
||||||
|
|
||||||
public ActionResult Notification(string id, string url)
|
public ActionResult Notification(string id, string url)
|
||||||
{
|
{
|
||||||
var db = new ApplicationDbContext();
|
var db = new ApplicationDbContext();
|
||||||
|
|
|
@ -95,6 +95,38 @@
|
||||||
<h4>Send me notifications through email when I'm inactive</h4>
|
<h4>Send me notifications through email when I'm inactive</h4>
|
||||||
<p>Check this option to allow us to email you when you receive a notification and you haven't logged in for a week.</p> @Html.CheckBoxFor(Model=>Model.EmailOnNotifications)
|
<p>Check this option to allow us to email you when you receive a notification and you haven't logged in for a week.</p> @Html.CheckBoxFor(Model=>Model.EmailOnNotifications)
|
||||||
|
|
||||||
|
@{
|
||||||
|
var notes = Model.Notifications.Where(x=>x.IsRead==false).OrderByDescending(x=>x.Timestamp);
|
||||||
|
}
|
||||||
|
<h3>Unread Notifications</h3>
|
||||||
|
@if (notes.Count() > 0)
|
||||||
|
{
|
||||||
|
<p>Below is a list of all unread notifications.</p>
|
||||||
|
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li><a href="@Url.Action("MarkAllRead")"><span class="glyphicon glyphicon-book"></span> Mark all read</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<strong>Notification</strong>
|
||||||
|
</div>
|
||||||
|
@foreach(var note in notes)
|
||||||
|
{
|
||||||
|
<div class="row">
|
||||||
|
@if (!string.IsNullOrWhiteSpace(note.AvatarUrl))
|
||||||
|
{
|
||||||
|
<img src="@note.AvatarUrl" height="128" width="128" class="avatar" />
|
||||||
|
}
|
||||||
|
<h5>@note.Title</h5>
|
||||||
|
<p>@note.Description</p>
|
||||||
|
<a href="@note.ActionUrl" class="btn btn-default">Read</a>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<p>You have no notifications.</p>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade in" id="t_privacy">
|
<div class="tab-pane fade in" id="t_privacy">
|
||||||
<h2>Privacy & Security</h2>
|
<h2>Privacy & Security</h2>
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li class="dropdown-header">Notifications (@Html.NotificationCount(User.Identity.Name) unread)</li>
|
<li class="dropdown-header">Notifications (@Html.NotificationCount(User.Identity.Name) unread)</li>
|
||||||
@Html.GetLatestUnread(User.Identity.Name)
|
@Html.GetLatestUnread(User.Identity.Name)
|
||||||
<li>@Html.ActionLink("View all", "Notifications", "Manage")</li>
|
<li><a href="@Url.Action("Index", "Manage")#t_notifications">View all</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="dropdown"><a href="#" data-toggle="dropdown" class="dropdown-toggle"><span class="glyphicon glyphicon-user"></span> @Html.UserName(User.Identity.GetUserId()) <span class="caret"></span></a>
|
<li class="dropdown"><a href="#" data-toggle="dropdown" class="dropdown-toggle"><span class="glyphicon glyphicon-user"></span> @Html.UserName(User.Identity.GetUserId()) <span class="caret"></span></a>
|
||||||
|
|
Loading…
Reference in a new issue