File tree Expand file tree Collapse file tree 5 files changed +34
-13
lines changed
Views/Themes/Simple/Shared Expand file tree Collapse file tree 5 files changed +34
-13
lines changed Original file line number Diff line number Diff line change 1- <div >
2- This post is from PostList widget loaded from external class library.
1+ @model IEnumerable <BlogPost >
2+ <div class =" list-group" >
3+ @foreach ( var post in Model )
4+ {
5+ <a href =" ~/posts/@post.Slug" class =" list-group-item list-group-item-action" title =" " >@post.Title </a >
6+ }
37</div >
Original file line number Diff line number Diff line change 1- using Microsoft . AspNetCore . Mvc ;
1+ using Core . Services ;
2+ using Microsoft . AspNetCore . Mvc ;
23
34namespace Common . Widgets
45{
56 [ ViewComponent ( Name = "PostList" ) ]
67 public class PostList : ViewComponent
78 {
8- public PostList ( )
9+ IDataService _db ;
10+
11+ public PostList ( IDataService db )
912 {
13+ _db = db ;
1014 }
1115
1216 public IViewComponentResult Invoke ( )
1317 {
14- return View ( "~/Views/Widgets/PostList/Index.cshtml" ) ;
18+ var model = _db . BlogPosts . All ( ) ;
19+
20+ return View ( "~/Views/Widgets/PostList/Index.cshtml" , model ) ;
1521 }
1622 }
1723}
Original file line number Diff line number Diff line change 33@{
44 ViewData [" Title" ] = " Users" ;
55}
6-
76<style >
87 .modal-body .row {
98 line-height : 2.5em ;
109 border-bottom : 1px solid #efefef ;
1110 }
11+ .post-grid-col { max-width : 200px !important }
1212 </style >
1313<div class =" bf-main" >
1414 <partial name =" ~/Pages/Admin/Settings/_Taskbar.cshtml" />
1515 <div class =" bf-body" >
16- <div class =" bf-content bf-content-boxed bf-settings" >
16+ <!-- Grid -->
17+ <div class =" bf-posts-grid d-flex" aria-label =" posts" >
1718 @foreach ( var user in Model .Authors )
1819 {
1920 var avatar = user .Avatar ?? AppSettings .Avatar ;
20- <div class =" card" style =" width : 130px ; margin : 10px 5px 0 0 ; float : left " >
21- <img class =" card-img-top" style =" height : 130px ; overflow : hidden " src =" ~/@avatar" alt =" @avatar" />
22- <div class =" card-body" >
23- <p style =" text-align : center " >
24- <a href =" ~/admin/settings/profile?name=@user.AppUserName" >@user.AppUserName </a >
25- </p >
21+ var img = $" {Url .Content (" ~/" )}{avatar }" ;
22+ <div class =" post-grid-col" >
23+ <div class =" post-grid-item" >
24+ <a class =" item-link" style =" background-image :url (@img );" ><div class =" item-title mt-auto" >  ; </div ></a >
25+ <div class =" item-info d-flex align-items-center" >
26+ <span class =" item-date mr-auto" >@user.DisplayName </span >
27+ <a href =" ~/admin/settings/profile?name=@user.AppUserName" class =" btn-unstyled item-favorite ml-3" data-tooltip =" " title =" " data-original-title =" Profile" >
28+ <i class =" fas fa-external-link-square-alt" ></i >
29+ </a >
30+ </div >
2631 </div >
2732 </div >
2833 }
2934 </div >
35+ <!-- /Grid -->
3036 </div >
3137</div >
3238
Original file line number Diff line number Diff line change 2525 <div class =" card-body" >
2626 @await Component.InvokeAsync("HtmlBlock", new { theme = " Simple" , widget = " Sidebar" } )
2727 </div >
28+ </div >
29+
30+ <div class =" card my-4" >
31+ <h5 class =" card-header" >Post List</h5 >
32+ @await Component.InvokeAsync("PostList", new { theme = " Simple" , widget = " Post List" } )
2833</div >
You can’t perform that action at this time.
0 commit comments