File tree Expand file tree Collapse file tree 7 files changed +150
-11
lines changed Expand file tree Collapse file tree 7 files changed +150
-11
lines changed Original file line number Diff line number Diff line change 1
1
@page " /blogPost/{blogPostId}"
2
2
@using LinkDotNet .Domain
3
3
@using LinkDotNet .Infrastructure .Persistence
4
+ @using LinkDotNet .Blog .Web .Shared .Admin
4
5
@using Markdig
5
6
@inject IRepository _repository
6
7
@inject IJSRuntime _jsRuntime
15
16
<Title Value =" @BlogPost.Title" ></Title >
16
17
<OgData Title =" @BlogPost.Title" AbsolutePreviewImageUrl =" @BlogPost.PreviewImageUrl" Description =" @(Markdown.ToPlainText(BlogPost.ShortDescription))" ></OgData >
17
18
<div class =" blog-outer-box" >
18
- <div class =" content blog-container" >
19
- <div class =" blog-content" >
20
- <header >
21
- <h1 >@BlogPost.Title </h1 ></header >
22
- <div class =" blogpost-date" >
23
- @BlogPost.UpdatedDate
24
- </div >
19
+ <div class =" content blog-container" >
20
+ <div class =" blog-content" >
21
+ <header >
22
+ <h1 >@BlogPost.Title </h1 ></header >
23
+ <div class =" blogpost-date" >
24
+ @BlogPost.UpdatedDate
25
+ </div >
26
+
27
+ <div class =" admin-action" >
28
+ <BlogPostAdminActions BlogPostId =" @BlogPostId" ></BlogPostAdminActions >
29
+ </div >
25
30
26
- <div class =" blogpost-content" >
27
- @( RenderMarkupString (BlogPost .Content ))
31
+ <div class =" blogpost-content" >
32
+ @( RenderMarkupString (BlogPost .Content ))
33
+ </div >
28
34
</div >
29
35
</div >
30
36
</div >
31
- </div >
32
37
}
33
38
34
39
@code {
Original file line number Diff line number Diff line change
1
+ @inject NavigationManager _navigationManager
2
+ @inject IToastService _toastService
3
+
4
+ <AuthorizeView >
5
+ <div class =" blogpost-admin" >
6
+ <button type =" button" class =" btn btn-primary" @onclick =" EditBlogPost" aria-label =" edit" ><i class =" fas fa-pen-square" ></i > Edit
7
+ Blogpost</button >
8
+ <button type =" button" class =" btn btn-danger" @onclick =" ShowConfirmDialog" aria-label =" delete" ><i class =" fas fa-trash" ></i > Delete
9
+ Blogpost</button >
10
+ </div >
11
+ <ConfirmDialog @ref =" ConfirmDialog" Title =" Delete Blog Post" Content =" Do you want to delete the Blog Post?" OnYesPressed =" @ShowMessage" >
12
+ </ConfirmDialog >
13
+ </AuthorizeView >
14
+
15
+ @code {
16
+ [Parameter ]
17
+ public string BlogPostId { get ; set ; }
18
+
19
+ private ConfirmDialog ConfirmDialog { get ; set ; }
20
+
21
+ private void ShowMessage ()
22
+ {
23
+ _toastService .ShowInfo (" Hey" );
24
+ }
25
+
26
+ private void ShowConfirmDialog ()
27
+ {
28
+ ConfirmDialog .Open ();
29
+ }
30
+
31
+ private void EditBlogPost ()
32
+ {
33
+ _navigationManager .NavigateTo ($" update/{BlogPostId }" );
34
+ }
35
+
36
+ }
Original file line number Diff line number Diff line change
1
+ <ModalDialog @ref =" ModalDialog" Title =" @Title" >
2
+ <h3 >@Content </h3 >
3
+ <div class =" actions" >
4
+ <button @onclick =" OnYesButtonPressed" type =" button" class =" btn btn-primary" >Ok</button >
5
+ <button @onclick =" OnNoButtonPressed" type =" button" class =" btn btn" >Cancel</button >
6
+ </div >
7
+ </ModalDialog >
8
+
9
+ @code {
10
+ [Parameter ]
11
+ public string Title { get ; set ; }
12
+
13
+ [Parameter ]
14
+ public string Content { get ; set ; }
15
+
16
+ [Parameter ]
17
+ public EventCallback OnYesPressed { get ; set ; }
18
+
19
+ [Parameter ]
20
+ public EventCallback OnNoPressed { get ; set ; }
21
+
22
+ private ModalDialog ModalDialog { get ; set ; }
23
+
24
+ private async Task OnYesButtonPressed ()
25
+ {
26
+ ModalDialog .Close ();
27
+ await OnYesPressed .InvokeAsync ();
28
+ }
29
+
30
+ private void OnNoButtonPressed ()
31
+ {
32
+ ModalDialog .Close ();
33
+ }
34
+
35
+ public void Open ()
36
+ {
37
+ ModalDialog .Open ();
38
+ }
39
+ }
Original file line number Diff line number Diff line change
1
+ .actions {
2
+ float : right;
3
+ }
4
+
5
+ .actions * {
6
+ padding-left : 5px ;
7
+ }
Original file line number Diff line number Diff line change
1
+ @using System .ComponentModel .DataAnnotations
2
+ <div class =" modal @_modalClass" tabindex =" -1" role =" dialog" style =" display :@_modalDisplay; overflow-y : auto ;" >
3
+ <div class =" modal-dialog modal-lg" role =" document" >
4
+ <div class =" modal-content" >
5
+ <div class =" modal-header" >
6
+ <h5 class =" modal-title" >@Title </h5 >
7
+ <button type =" button" class =" close" data-dismiss =" modal" aria-label =" Close" @onclick =" Close" >
8
+ <span aria-hidden =" true" ><i class =" fas fa-times" ></i ></span >
9
+ </button >
10
+ </div >
11
+ <div class =" modal-body" >
12
+ @ChildContent
13
+ </div >
14
+ </div >
15
+ </div >
16
+ </div >
17
+
18
+ @if (_showBackdrop )
19
+ {
20
+ <div class =" modal-backdrop fade show" ></div >
21
+ }
22
+
23
+ @code {
24
+ [Parameter ]
25
+ public string Title { get ; set ; }
26
+
27
+ [Parameter ]
28
+ public RenderFragment ChildContent { get ; set ; }
29
+
30
+ private string _modalDisplay = " none;" ;
31
+ private string _modalClass = " " ;
32
+ private bool _showBackdrop = false ;
33
+
34
+ public void Open ()
35
+ {
36
+ _modalDisplay = " block;" ;
37
+ _modalClass = " show" ;
38
+ _showBackdrop = true ;
39
+ }
40
+
41
+ public void Close ()
42
+ {
43
+ _modalDisplay = " none" ;
44
+ _modalClass = " " ;
45
+ _showBackdrop = false ;
46
+ }
47
+ }
Original file line number Diff line number Diff line change 31
31
</div >
32
32
</div >
33
33
</article >
34
+
34
35
@code {
35
36
[Parameter ]
36
37
public BlogPost BlogPost { get ; set ; }
Original file line number Diff line number Diff line change 127
127
border-radius : 3px ;
128
128
}
129
129
.blog-card : hover .details {
130
- left : 0% ;
130
+ left : 0 ;
131
131
}
132
132
@media (min-width : 640px ) {
133
133
.blog-card {
163
163
.blog-card .alt .details {
164
164
padding-left : 25px ;
165
165
}
166
+ }
167
+
168
+ .admin-action {
169
+ padding-top : 10px ;
166
170
}
You can’t perform that action at this time.
0 commit comments