yavsc/Yavsc/Views/Blogspot/Index.cshtml

119 lines
3.8 KiB
Text
Raw Normal View History

2017-04-12 02:10:02 +02:00
@model IEnumerable<IGrouping<BlogIndexKey,Blog>>
2016-05-17 18:22:18 +02:00
@{
2017-03-11 01:06:42 +01:00
ViewData["Title"] = "Blogs, l'index";
2017-04-12 02:10:02 +02:00
// Regroup!?!
@foreach (var group in Model) {
}
}
@section header {
<style>
.collapsed {
height: 1em;
}
.sametitle {
overflow: hidden;
transition: height 1s;
}
td {
transition: height 1s;
}
</style>
}
@section scripts {
<script>
$(document).ready(function () {
$(".sametitle").addClass("collapsed")
.on("mouseover",function(){
$(this).removeClass("collapsed")
}).on("mouseout",function(){
$(this).addClass("collapsed")
});
}
)
</script>
2016-05-17 18:22:18 +02:00
}
2017-03-11 01:06:42 +01:00
<h2>@ViewData["Title"]</h2>
2016-05-17 18:22:18 +02:00
<p class="text-success">@ViewData["StatusMessage"]</p>
2017-02-12 23:53:53 +01:00
@if (User.IsSignedIn()) {
<label>
<input type="checkbox" id="cbv" checked/>Invisibles, posts privés</label>
2017-03-11 01:06:42 +01:00
<script>
$("#cbv").change(function() {
if (this.checked) {
$("tr.hiddenpost").removeClass("hidden");
} else {
$("tr.hiddenpost").addClass("hidden");
}
});
</script>
2016-05-17 18:22:18 +02:00
<p>
2016-07-27 11:09:49 +02:00
<a asp-action="Create">@SR["Create a new article"]</a>
2016-05-17 18:22:18 +02:00
</p>
2017-03-11 01:06:42 +01:00
}
2016-05-17 18:22:18 +02:00
<table class="table">
<tr>
2017-04-12 02:10:02 +02:00
<th>
2017-03-11 01:06:42 +01:00
@SR["Title"]
2016-05-17 18:22:18 +02:00
</th>
2017-04-12 02:10:02 +02:00
<th>
apperçu
</th>
2016-05-17 18:22:18 +02:00
</tr>
2017-04-12 02:10:02 +02:00
2017-03-11 01:06:42 +01:00
@foreach (var group in Model) {
2017-04-12 02:10:02 +02:00
var title = group.Key.Title;
string secondclass="";
var first = group.First();
string trclass = (first.Visible) ? "visiblepost" : "hiddenpost";
<tr class="@trclass">
<td><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>
2016-05-17 18:22:18 +02:00
</td>
<td>
2017-04-12 02:10:02 +02:00
<markdown>@((first.Content?.Length > 120) ? first.Content.Substring(0, 120) + " ..." : first.Content)</markdown>
<span style="font-size:x-small;">(@first.Author.UserName </span>,
2016-08-03 16:38:25 +02:00
<span style="font-size:xx-small;">
2017-04-12 02:10:02 +02:00
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")
2017-02-12 23:53:53 +01:00
})
2016-07-29 13:16:08 +02:00
</span>
2017-04-12 02:10:02 +02:00
@if (group.Count()>1) {
<div class="sametitle">
Au même titre:
<table>
@foreach (var item in group.Skip(1)) {
trclass = ((item.Visible)?"visiblepost":"hiddenpost");
<tr class="@trclass"><td>le @item.DateModified.ToString("dddd d MMM yyyy à H:mm")</td>
<td><markdown>@((item.Content?.Length > 120) ? item.Content.Substring(0, 120) + " ..." : item.Content)</markdown>
</td>
<td> <a asp-action="Details" asp-route-id="@item.Id" class="btn btn-lg">Details</a>
</td></tr>
} </table></div>
}
2016-07-29 13:16:08 +02:00
</td>
<td>
2016-05-17 18:22:18 +02:00
<ul class="actiongroup">
2017-04-12 02:10:02 +02:00
@if (await AuthorizationService.AuthorizeAsync(User, first, new ViewRequirement())) {
<li>
2017-04-12 02:10:02 +02:00
<a asp-action="Details" asp-route-id="@first.Id" class="btn btn-lg">Details</a>
2016-05-17 18:22:18 +02:00
</li>
}
2017-04-12 02:10:02 +02:00
@if (await AuthorizationService.AuthorizeAsync(User, first, new EditRequirement())) {
<li><a asp-action="Edit" asp-route-id="@first.Id" class="btn btn-default">@SR["Edit"]</a>
2016-05-17 18:22:18 +02:00
</li>
2017-04-12 02:10:02 +02:00
<li><a asp-action="Delete" asp-route-id="@first.Id" class="btn btn-danger">@SR["Delete"]</a>
2016-05-17 18:22:18 +02:00
</li>
}
</ul>
</td>
</tr>
}
</table>