yavsc/Yavsc/Views/Blogspot/Index.cshtml

128 lines
4.1 KiB
Text
Raw Normal View History

@model IEnumerable<IGrouping<string,BlogPost>>
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
}
@section header {
<style>
.collapsed {
height: 1em;
}
2017-10-10 20:50:05 +02:00
.sametitlegrip {
text-decoration: underline;
cursor: pointer;
}
2017-04-12 02:10:02 +02:00
.sametitle {
overflow: hidden;
transition: height 1s;
}
td {
transition: height 1s;
}
2017-10-10 20:50:05 +02:00
div.row {
border-bottom: dashed black 1px;
2017-10-04 23:53:47 +02:00
}
2017-04-12 02:10:02 +02:00
</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
}
2017-10-04 23:53:47 +02:00
<div class="container">
2017-04-12 02:10:02 +02:00
2017-03-11 01:06:42 +01:00
@foreach (var group in Model) {
var title = group.Key;
2017-04-12 02:10:02 +02:00
string secondclass="";
var first = group.First();
string trclass = (first.Visible) ? "visiblepost" : "hiddenpost";
2017-10-04 23:53:47 +02:00
<div class="row @trclass">
<div class="col-xs-10">
<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>
2017-10-04 23:53:47 +02:00
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",System.Globalization.CultureInfo.CurrentUICulture)
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
2017-10-04 23:53:47 +02:00
</div>
<div class="col-xs-2">
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>
2017-10-04 23:53:47 +02:00
</div>
</div>
long gcount = group.Count();
@if (gcount>1) {
<div class="sametitle">
2017-10-10 20:50:05 +02:00
<div class="sametitlegrip">@(gcount-1) autre@(gcount>2?"s":"") au même titre:</div>
2017-10-04 23:53:47 +02:00
@foreach (var item in group.Skip(1)) {
trclass = ((item.Visible)?"visiblepost":"hiddenpost");
<div class="row @trclass">
<div class="col-xs-10">
<markdown>
@((item.Content?.Length > 120) ? item.Content.Substring(0, 120) + "..." : item.Content)
</markdown>
</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",System.Globalization.CultureInfo.CurrentUICulture)
2017-10-04 23:53:47 +02:00
</a>
</div>
</div>
}
</div>
}
2016-05-17 18:22:18 +02:00
}
2017-10-04 23:53:47 +02:00
</div>
2016-05-17 18:22:18 +02:00