Blog index:

on regroupe par titre, indifféremment de l'auteur.
This commit is contained in:
2017-10-10 22:06:25 +02:00
parent ea4c5f82ad
commit c931581375
4 changed files with 17 additions and 15 deletions

View File

@ -1,9 +1,6 @@
@model IEnumerable<IGrouping<BlogIndexKey,BlogPost>>
@model IEnumerable<IGrouping<string,BlogPost>>
@{
ViewData["Title"] = "Blogs, l'index";
// Regroup!?!
@foreach (var group in Model) {
}
}
@section header {
<style>
@ -63,24 +60,24 @@
@foreach (var group in Model) {
var title = group.Key.Title;
var title = group.Key;
string secondclass="";
var first = group.First();
string trclass = (first.Visible) ? "visiblepost" : "hiddenpost";
<div class="row @trclass">
<div class="col-xs-10">
<a asp-action="Details" asp-route-id="@first.Id" class="bloglink">
<img src="@first.Photo" class="smalltofhol"></a>
<a asp-action="Title" asp-route-id="@title">
<markdown>@first.Title</markdown></a>
<a asp-action="Title" asp-route-id="@title" >
@if (first.Photo==null) { }
else {<img src="@first.Photo" class="smallphoto" alt="@first.Title">}
<markdown>@first.Title</markdown>
</a>
<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:xx-small;">
posté le @first.DateCreated.ToString("dddd d MMM yyyy à H:mm")
@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>
@ -118,7 +115,7 @@
</div>
<div class="col-xs-2">
<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>
</div>
</div>

View File

@ -27,7 +27,7 @@
<tr class="@trclass">
<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>
<markdown>@((item.Content?.Length > 120) ? item.Content.Substring(0, 122) + " ..." : item.Content)</markdown>