-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ace8576
commit fa9feba
Showing
7 changed files
with
150 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
LinkDotNet.Blog.Web/Shared/Admin/BlogPostAdminActions.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@inject NavigationManager _navigationManager | ||
@inject IToastService _toastService | ||
|
||
<AuthorizeView> | ||
<div class="blogpost-admin"> | ||
<button type="button" class="btn btn-primary" @onclick="EditBlogPost" aria-label="edit"><i class="fas fa-pen-square"></i> Edit | ||
Blogpost</button> | ||
<button type="button" class="btn btn-danger" @onclick="ShowConfirmDialog" aria-label="delete"><i class="fas fa-trash"></i> Delete | ||
Blogpost</button> | ||
</div> | ||
<ConfirmDialog @ref="ConfirmDialog" Title="Delete Blog Post" Content="Do you want to delete the Blog Post?" OnYesPressed="@ShowMessage"> | ||
</ConfirmDialog> | ||
</AuthorizeView> | ||
|
||
@code { | ||
[Parameter] | ||
public string BlogPostId { get; set; } | ||
|
||
private ConfirmDialog ConfirmDialog { get; set; } | ||
|
||
private void ShowMessage() | ||
{ | ||
_toastService.ShowInfo("Hey"); | ||
} | ||
|
||
private void ShowConfirmDialog() | ||
{ | ||
ConfirmDialog.Open(); | ||
} | ||
|
||
private void EditBlogPost() | ||
{ | ||
_navigationManager.NavigateTo($"update/{BlogPostId}"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<ModalDialog @ref="ModalDialog" Title="@Title"> | ||
<h3>@Content</h3> | ||
<div class="actions"> | ||
<button @onclick="OnYesButtonPressed" type="button" class="btn btn-primary">Ok</button> | ||
<button @onclick="OnNoButtonPressed" type="button" class="btn btn">Cancel</button> | ||
</div> | ||
</ModalDialog> | ||
|
||
@code { | ||
[Parameter] | ||
public string Title { get; set; } | ||
|
||
[Parameter] | ||
public string Content { get; set; } | ||
|
||
[Parameter] | ||
public EventCallback OnYesPressed { get; set; } | ||
|
||
[Parameter] | ||
public EventCallback OnNoPressed { get; set; } | ||
|
||
private ModalDialog ModalDialog { get; set; } | ||
|
||
private async Task OnYesButtonPressed() | ||
{ | ||
ModalDialog.Close(); | ||
await OnYesPressed.InvokeAsync(); | ||
} | ||
|
||
private void OnNoButtonPressed() | ||
{ | ||
ModalDialog.Close(); | ||
} | ||
|
||
public void Open() | ||
{ | ||
ModalDialog.Open(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.actions { | ||
float:right; | ||
} | ||
|
||
.actions * { | ||
padding-left: 5px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
@using System.ComponentModel.DataAnnotations | ||
<div class="modal @_modalClass" tabindex="-1" role="dialog" style="display:@_modalDisplay; overflow-y: auto;"> | ||
<div class="modal-dialog modal-lg" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title">@Title</h5> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close" @onclick="Close"> | ||
<span aria-hidden="true"><i class="fas fa-times"></i></span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
@ChildContent | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
@if (_showBackdrop) | ||
{ | ||
<div class="modal-backdrop fade show"></div> | ||
} | ||
|
||
@code { | ||
[Parameter] | ||
public string Title { get; set; } | ||
|
||
[Parameter] | ||
public RenderFragment ChildContent { get; set; } | ||
|
||
private string _modalDisplay = "none;"; | ||
private string _modalClass = ""; | ||
private bool _showBackdrop = false; | ||
|
||
public void Open() | ||
{ | ||
_modalDisplay = "block;"; | ||
_modalClass = "show"; | ||
_showBackdrop = true; | ||
} | ||
|
||
public void Close() | ||
{ | ||
_modalDisplay = "none"; | ||
_modalClass = ""; | ||
_showBackdrop = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
</div> | ||
</div> | ||
</article> | ||
|
||
@code { | ||
[Parameter] | ||
public BlogPost BlogPost { get; set; } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters