Blog index:

on regroupe par titre, indifféremment de l'auteur.
main
Paul Schneider 8 years ago
parent ea4c5f82ad
commit c931581375
4 changed files with 17 additions and 15 deletions

@ -61,8 +61,9 @@ namespace Yavsc.Controllers
.Include(p=>p.ACL).Where(p=>p.AuthorId == uid || p.Visible && p.ACL.Count == 0); .Include(p=>p.ACL).Where(p=>p.AuthorId == uid || p.Visible && p.ACL.Count == 0);
} }
return View(posts.OrderByDescending( p=> p.DateModified) return View(posts.OrderByDescending( p=> p.DateCreated)
.GroupBy(p=> new BlogIndexKey { Title = p.Title, AuthorId = p.AuthorId } ).Skip(skip).Take(maxLen));
.GroupBy(p=> p.Title).Skip(skip).Take(maxLen));
} }
[Route("/Title/{id?}")] [Route("/Title/{id?}")]

@ -1,9 +1,6 @@
@model IEnumerable<IGrouping<BlogIndexKey,BlogPost>> @model IEnumerable<IGrouping<string,BlogPost>>
@{ @{
ViewData["Title"] = "Blogs, l'index"; ViewData["Title"] = "Blogs, l'index";
// Regroup!?!
@foreach (var group in Model) {
}
} }
@section header { @section header {
<style> <style>
@ -63,24 +60,24 @@
@foreach (var group in Model) { @foreach (var group in Model) {
var title = group.Key.Title; var title = group.Key;
string secondclass=""; string secondclass="";
var first = group.First(); var first = group.First();
string trclass = (first.Visible) ? "visiblepost" : "hiddenpost"; string trclass = (first.Visible) ? "visiblepost" : "hiddenpost";
<div class="row @trclass"> <div class="row @trclass">
<div class="col-xs-10"> <div class="col-xs-10">
<a asp-action="Title" asp-route-id="@title" >
<a asp-action="Details" asp-route-id="@first.Id" class="bloglink"> @if (first.Photo==null) { }
<img src="@first.Photo" class="smalltofhol"></a> else {<img src="@first.Photo" class="smallphoto" alt="@first.Title">}
<a asp-action="Title" asp-route-id="@title"> <markdown>@first.Title</markdown>
<markdown>@first.Title</markdown></a> </a>
<markdown>@((first.Content?.Length > 120) ? first.Content.Substring(0, 120) + " ..." : first.Content)</markdown> <markdown>@((first.Content?.Length > 120) ? first.Content.Substring(0, 120) + " ..." : first.Content)</markdown>
<span style="font-size:x-small;">(@first.Author.UserName </span>, <span style="font-size:x-small;">(@first.Author.UserName </span>,
<span style="font-size:xx-small;"> <span style="font-size:xx-small;">
posté le @first.DateCreated.ToString("dddd d MMM yyyy à H:mm") posté le @first.DateCreated.ToString("dddd d MMM yyyy à H:mm")
@if ((first.DateModified - first.DateCreated).Minutes > 0){  @if ((first.DateModified - first.DateCreated).Minutes > 0){ 
@:- Modifié le @first.DateModified.ToString("dddd d MMM yyyy à H:mm") @:- Modifié le @first.DateModified.ToString("dddd d MMM yyyy à H:mm",System.Globalization.CultureInfo.CurrentUICulture)
}) })
</span> </span>
@ -118,7 +115,7 @@
</div> </div>
<div class="col-xs-2"> <div class="col-xs-2">
<a asp-action="Details" asp-route-id="@item.Id" class="btn btn-lg"> <a asp-action="Details" asp-route-id="@item.Id" class="btn btn-lg">
le @item.DateModified.ToString("dddd d MMM yyyy à H:mm") le @item.DateModified.ToString("dddd d MMM yyyy à H:mm",System.Globalization.CultureInfo.CurrentUICulture)
</a> </a>
</div> </div>
</div> </div>

@ -27,7 +27,7 @@
<tr class="@trclass"> <tr class="@trclass">
<td><a asp-action="Details" asp-route-id="@item.Id" class="bloglink"> <td><a asp-action="Details" asp-route-id="@item.Id" class="bloglink">
<img src="@item.Photo" class="smalltofhol"></a> <img src="@item.Photo" class="smallphoto"></a>
</td> </td>
<td> <td>
<markdown>@((item.Content?.Length > 120) ? item.Content.Substring(0, 122) + " ..." : item.Content)</markdown> <markdown>@((item.Content?.Length > 120) ? item.Content.Substring(0, 122) + " ..." : item.Content)</markdown>

@ -204,6 +204,10 @@ textarea {
/* Set widths on image and video, since otherwise they use their native resolution */ /* Set widths on image and video, since otherwise they use their native resolution */
.smallphoto {
max-height: 4em;
}
/* .navbar-reac */ /* .navbar-reac */

Loading…