modified all admin UIs to position action buttons on the left side of grids and implemented ActionDialog throughout rather than dedicated delete components
This commit is contained in:
@ -5,18 +5,18 @@
|
||||
|
||||
@if (PageState.Pages != null)
|
||||
{
|
||||
<ActionLink Action="Add" Text="Add Page" Style="float: right; margin: 10px;" />
|
||||
<ActionLink Action="Add" Text="Add Page" />
|
||||
|
||||
<Pager Items="@PageState.Pages.Where(item => !item.IsDeleted)">
|
||||
<Header>
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
<th>Name</th>
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td>@(new string('-', context.Level * 2))@(context.Name)</td>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.PageId.ToString())" /></td>
|
||||
<td><button @onclick="@(() => Delete(context))" class="btn btn-danger">Delete</button></td>
|
||||
<td><ActionDialog Header="Delete Page" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Page?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeletePage(context))" /></td>
|
||||
<td>@(new string('-', context.Level * 2))@(context.Name)</td>
|
||||
</Row>
|
||||
</Pager>
|
||||
}
|
||||
@ -24,18 +24,19 @@
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||
|
||||
private async Task Delete(Page Page)
|
||||
private async Task DeletePage(Page Page)
|
||||
{
|
||||
try
|
||||
{
|
||||
Page.IsDeleted = true;
|
||||
await PageService.UpdatePageAsync(Page);
|
||||
await logger.LogInformation("Page Deleted {Page}", Page);
|
||||
NavigationManager.NavigateTo(NavigateUrl("admin/pages", Reload.Site));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Pages {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Pages", MessageType.Error);
|
||||
await logger.LogError(ex, "Error Deleting Page {Page} {Error}", Page, ex.Message);
|
||||
AddModuleMessage("Error Deleting Page", MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user