mirror of https://github.com/abpframework/abp.git
8 changed files with 16 additions and 146 deletions
@ -1,93 +0,0 @@ |
|||||
@page |
|
||||
@inherits Volo.Blogging.Pages.Blog.BloggingPage |
|
||||
@using Volo.Blogging.Pages.Blog.Tags |
|
||||
@model PostsModel |
|
||||
@{ |
|
||||
} |
|
||||
|
|
||||
@section scripts { |
|
||||
<abp-script-bundle name="@typeof(PostsModel).FullName"> |
|
||||
<abp-script src="/Pages/Blog/Shared/Scripts/blog.js" /> |
|
||||
</abp-script-bundle> |
|
||||
} |
|
||||
@section styles { |
|
||||
<abp-style-bundle name="@typeof(PostsModel).FullName"> |
|
||||
<abp-style src="/Pages/Blog/Shared/Styles/blog.css" /> |
|
||||
</abp-style-bundle> |
|
||||
} |
|
||||
|
|
||||
<div class="container last-post-section pb-5"> |
|
||||
<div class="row"> |
|
||||
<div class="col-md-8"> |
|
||||
<div class="row"> |
|
||||
<div class="col"> |
|
||||
<div class="titline"> |
|
||||
<h2>#@Model.TagName</h2> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
@for (var index = 0; index < Model.Posts.Count; index++) |
|
||||
{ |
|
||||
var post = Model.Posts[index]; |
|
||||
var oddPost = index % 2 == 1; |
|
||||
|
|
||||
<section class="box-articles"> |
|
||||
<div class="row @(oddPost?"align-middle":"")"> |
|
||||
<div class="col-md-4 order-md-@(oddPost?"last":"first")"> |
|
||||
<div class="img-container"> |
|
||||
<a asp-page="/Blog/Posts/Detail" asp-route-postUrl="@post.Url" asp-route-blogShortName="@Model.BlogShortName"> |
|
||||
<img src="https://placeimg.com/480/270/tech" class="box-article-img"> |
|
||||
</a> |
|
||||
<div class="user-link-icons"> |
|
||||
<a class="add-bookmark" href="#"> |
|
||||
<i class="fa fa-bookmark"></i> |
|
||||
</a> |
|
||||
<a class="share-article" href="#"> |
|
||||
<i class="fa fa-share-alt"></i> |
|
||||
</a> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="col-md-8 order-md-@(oddPost?"first":"last")"> |
|
||||
<p class="tags"> |
|
||||
@foreach (var tag in post.Tags) |
|
||||
{ |
|
||||
<a asp-page="/Blog/Tags/Posts" asp-route-blogShortName="@Model.BlogShortName" asp-route-tagName="@tag.Name" class="tag">@tag.Name</a> |
|
||||
} |
|
||||
</p> |
|
||||
<h3> |
|
||||
<a asp-page="/Blog/Posts/Detail" asp-route-postUrl="@post.Url" asp-route-blogShortName="@Model.BlogShortName">@post.Title</a> |
|
||||
</h3> |
|
||||
<p> |
|
||||
@(post.Content == null ? "" : (post.Content.Length > 250 ? post.Content.Substring(0, 150) : post.Content))... |
|
||||
</p> |
|
||||
<div class="article-owner"> |
|
||||
<div class="article-infos"> |
|
||||
<div class="user-card"> |
|
||||
<a href="#"> |
|
||||
<img src="https://placeimg.com/120/120/pople" class="article-avatar"> |
|
||||
</a> |
|
||||
<a href="#"> |
|
||||
<strong>Armağan Ünlü</strong>, @((DateTime.Today - post.CreationTime).Days) @L["DaysAgo"] |
|
||||
</a> |
|
||||
<span class="seperator">|</span> |
|
||||
<a href="#"> |
|
||||
<i class="fa fa-eye"></i> @post.ReadCount |
|
||||
</a> |
|
||||
<span class="seperator">|</span> |
|
||||
<a href="#"> |
|
||||
<i class="fa fa-comment"></i> @post.CommentCount |
|
||||
</a> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
</section> |
|
||||
} |
|
||||
|
|
||||
</div> |
|
||||
|
|
||||
</div> |
|
||||
</div> |
|
||||
@ -1,34 +0,0 @@ |
|||||
using System.Collections.Generic; |
|
||||
using Microsoft.AspNetCore.Mvc; |
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages; |
|
||||
using Volo.Blogging.Blogs; |
|
||||
using Volo.Blogging.Posts; |
|
||||
|
|
||||
namespace Volo.Blogging.Pages.Blog.Tags |
|
||||
{ |
|
||||
public class PostsModel : PageModel |
|
||||
{ |
|
||||
private readonly IPostAppService _postAppService; |
|
||||
private readonly IBlogAppService _blogAppService; |
|
||||
|
|
||||
[BindProperty(SupportsGet = true)] |
|
||||
public string BlogShortName { get; set; } |
|
||||
|
|
||||
[BindProperty(SupportsGet = true)] |
|
||||
public string TagName { get; set; } |
|
||||
|
|
||||
public IReadOnlyList<PostWithDetailsDto> Posts { get; set; } |
|
||||
|
|
||||
public PostsModel(IPostAppService postAppService, IBlogAppService blogAppService) |
|
||||
{ |
|
||||
_postAppService = postAppService; |
|
||||
_blogAppService = blogAppService; |
|
||||
} |
|
||||
|
|
||||
public async void OnGetAsync() |
|
||||
{ |
|
||||
var blog = await _blogAppService.GetByShortNameAsync(BlogShortName); |
|
||||
Posts = (await _postAppService.GetListByBlogIdAndTagName(blog.Id, TagName)).Items; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue