mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Marking notification read through js magic
This commit is contained in:
@@ -75,7 +75,7 @@ namespace BTCPayServer.Controllers
|
|||||||
return RedirectToAction(nameof(Index));
|
return RedirectToAction(nameof(Index));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpPost]
|
||||||
public async Task<IActionResult> FlipRead(string id)
|
public async Task<IActionResult> FlipRead(string id)
|
||||||
{
|
{
|
||||||
// TODO: Refactor
|
// TODO: Refactor
|
||||||
|
|||||||
@@ -40,9 +40,8 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
@foreach (var item in Model.Items)
|
@foreach (var item in Model.Items)
|
||||||
{
|
{
|
||||||
@* TODO: Click on td to mark notification read through JavaScript magic *@
|
|
||||||
@* TODO: Multiselect akin to Gmail *@
|
@* 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.Created.ToBrowserDate()</td>
|
||||||
<td class="cursor-pointer @(item.Seen ? "": "font-weight-bold")">@item.Body</td>
|
<td class="cursor-pointer @(item.Seen ? "": "font-weight-bold")">@item.Body</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -56,15 +55,6 @@
|
|||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<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>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -80,3 +70,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</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>
|
||||||
|
|||||||
Reference in New Issue
Block a user