mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
Marking notification read through js magic
This commit is contained in:
parent
bad4c9dc60
commit
0b89598f39
@ -75,7 +75,7 @@ namespace BTCPayServer.Controllers
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> FlipRead(string id)
|
||||
{
|
||||
// TODO: Refactor
|
||||
|
@ -40,9 +40,8 @@
|
||||
<tbody>
|
||||
@foreach (var item in Model.Items)
|
||||
{
|
||||
@* TODO: Click on td to mark notification read through JavaScript magic *@
|
||||
@* TODO: Multiselect akin to Gmail *@
|
||||
<tr>
|
||||
<tr onclick="rowseen(this)" data-guid="@item.Id">
|
||||
<td class="cursor-pointer @(item.Seen ? "": "font-weight-bold")">@item.Created.ToBrowserDate()</td>
|
||||
<td class="cursor-pointer @(item.Seen ? "": "font-weight-bold")">@item.Body</td>
|
||||
<td>
|
||||
@ -56,15 +55,6 @@
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@if (item.Seen)
|
||||
{
|
||||
<a asp-action="FlipRead" asp-route-id="@item.Id"><span class="fa fa-envelope-o" title="Mark Unread"></span></a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a asp-action="FlipRead" asp-route-id="@item.Id"><span class="fa fa-envelope-open-o" title="Mark Read"></span></a>
|
||||
}
|
||||
|
||||
<a asp-action="Delete" asp-route-id="@item.Id" onclick="return confirm('Are you sure you want to delete this notification');"><span class="fa fa-trash-o" title="Delete"></span></a>
|
||||
</td>
|
||||
</tr>
|
||||
@ -80,3 +70,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script type="text/javascript">
|
||||
function rowseen(sender) {
|
||||
var weightClassName = "font-weight-bold";
|
||||
$(sender).children().eq(0).toggleClass(weightClassName);
|
||||
$(sender).children().eq(1).toggleClass(weightClassName);
|
||||
|
||||
$.post("/Notifications/FlipRead/" + $(sender).data("guid"), function (data) {
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user