Compare commits

...

2 commits

Author SHA1 Message Date
42ad1b623d Merge pull request 'build' (#12) from build into main
Some checks failed
Dotnet build and test / log-the-inputs (push) Has been cancelled
Dotnet build and test / build (push) Has been cancelled
Reviewed-on: #12
2026-08-03 02:17:32 +01:00
7d1cca9df0
build
Some checks failed
Dotnet build and test / log-the-inputs (pull_request) Has been cancelled
Dotnet build and test / build (pull_request) Has been cancelled
2026-08-03 02:16:57 +01:00
4 changed files with 17 additions and 13 deletions

View file

@ -7,6 +7,7 @@ using Yavsc.Models.Blog;
using Microsoft.Extensions.Options;
using Yavsc.Server.Exceptions;
using Yavsc.Server.Helpers;
using Yavsc.Blogspot;
// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

View file

@ -3,6 +3,7 @@ using System.Security.Claims;
using Microsoft.AspNetCore.Authorization;
using Microsoft.EntityFrameworkCore;
using Yavsc;
using Yavsc.Blogspot;
using Yavsc.Models;
using Yavsc.Models.Blog;
using Yavsc.Server.Exceptions;

View file

@ -1,3 +1,4 @@
@model IEnumerable<IBlogPost>
@{
ViewBag.Title = "Blogs, l'index";
@ -43,20 +44,20 @@
<a asp-action="Create">Create a new article</a>
</p>
}
<div class="blog-index">
@{
int maxTextLen = 75;
foreach (var post in Model) {
<div class="post card">
<a asp-action="Details" asp-route-id="@post.Id" class="bloglink" >
<a asp-action="Details" asp-route-id="@((IBlogPost)post).Id" class="bloglink" >
<div class="float-left"><img class="photo card-photo" src="@post.Photo" ></div>
<h3 class="index-post-title">@post.Title</h3>
</a>
<div>
<a asp-action="Details" asp-route-id="@post.Id">
<a asp-action="Details" asp-route-id="@((IBlogPost)post).Id">
<asciidoc summary="@maxTextLen">@post.Article</asciidoc></a>
<span style="font-size:x-small;">@Html.DisplayFor(m => post.Author)</span>
<span style="font-size:xx-small;">
@ -67,20 +68,20 @@
</span>
</div>
<div class="actiongroup">
@if ((await AuthorizationService.AuthorizeAsync(User, post, new ReadPermission())).Succeeded)
@if ((await AuthorizationService.AuthorizeAsync(User, post, new ReadPermission())).Succeeded)
{
<a asp-action="Details" asp-route-id="@post.Id" class="btn btn-light">Details</a>
<a asp-action="Details" asp-route-id="@((IBlogPost)post).Id" class="btn btn-light">Details</a>
}
else
else
{
<a asp-action="Details" asp-route-id="@post.Id" class="btn btn-light">Details</a>
<a asp-action="Details" asp-route-id="@((IBlogPost)post).Id" class="btn btn-light">Details</a>
}
@if ((await AuthorizationService.AuthorizeAsync(User, post, new EditPermission())).Succeeded)
@if ((await AuthorizationService.AuthorizeAsync(User, post, new EditPermission())).Succeeded)
{
<a asp-action="Edit" asp-route-id="@post.Id" class="btn btn-primary">Edit</a>
<a asp-action="Delete" asp-route-id="@post.Id" class="btn btn-danger">Delete</a>
<a asp-action="Edit" asp-route-id="@((IBlogPost)post).Id" class="btn btn-primary">Edit</a>
<a asp-action="Delete" asp-route-id="@((IBlogPost)post).Id" class="btn btn-danger">Delete</a>
}
</div>
</div>

View file

@ -1,5 +1,6 @@
@using Microsoft.AspNetCore.Mvc.Localization
@using Yavsc
@using Yavsc.Blogspot
@using Yavsc.Models
@using Yavsc.Models.Musical;
@using Yavsc.Models.Drawing;