Compare commits
10 changed files with 295 additions and 9 deletions
|
|
@ -3,8 +3,7 @@ DOTNET_FRAMEWORK=net10.0
|
||||||
APP_PROJECT_NAMES=Org Blogs Api
|
APP_PROJECT_NAMES=Org Blogs Api
|
||||||
SLNDIR=..
|
SLNDIR=..
|
||||||
APP_INSTALL_ENV=preprod
|
APP_INSTALL_ENV=preprod
|
||||||
APP_INSTALL_PREFIX=preprod-
|
APP_INSTALL_PREFIX=$(APP_INSTALL_ENV)-
|
||||||
|
|
||||||
include .$(APP_INSTALL_ENV).env
|
include .$(APP_INSTALL_ENV).env
|
||||||
|
|
||||||
generated/:
|
generated/:
|
||||||
|
|
@ -85,9 +84,6 @@ reinstall: copy-binaries
|
||||||
@for project in $(APP_PROJECT_NAMES); do \
|
@for project in $(APP_PROJECT_NAMES); do \
|
||||||
sudo systemctl start yavsc$${project} ; done
|
sudo systemctl start yavsc$${project} ; done
|
||||||
|
|
||||||
reinstall-prod:
|
|
||||||
make APP_INSTALL_ENV= APP_INSTALL_PREFIX=
|
|
||||||
|
|
||||||
reinstall-pre: copy-binaries
|
reinstall-pre: copy-binaries
|
||||||
@for project in $(APP_PROJECT_NAMES); do \
|
@for project in $(APP_PROJECT_NAMES); do \
|
||||||
sudo systemctl start yavscPre$${project} ; done
|
sudo systemctl start yavscPre$${project} ; done
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,73 @@ namespace Yavsc.Org.Controllers
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GET: Blog/Create
|
||||||
|
[Authorize()]
|
||||||
|
public IActionResult Create(string title)
|
||||||
|
{
|
||||||
|
var result = new BlogPostEditViewModel
|
||||||
|
(new Models.Blog.BlogPost
|
||||||
|
{
|
||||||
|
Title = title
|
||||||
|
}, true);
|
||||||
|
SetLangItems();
|
||||||
|
return View(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST: Blog/Create
|
||||||
|
[HttpPost, Authorize, ValidateAntiForgeryToken]
|
||||||
|
public IActionResult Create(Models.Blog.BlogPost blogInput)
|
||||||
|
{
|
||||||
|
if (ModelState.IsValid)
|
||||||
|
{
|
||||||
|
var uid = User.GetUserId();
|
||||||
|
Models.Blog.BlogPost post = blogSpotService.Create(uid, blogInput);
|
||||||
|
blogSpotService.AttachFiles(Request.Form.Files, uid, post.Id);
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
return View("Edit", blogInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Authorize()]
|
||||||
|
// GET: Blog/Edit/5
|
||||||
|
public async Task<IActionResult> Edit(long? id)
|
||||||
|
{
|
||||||
|
if (id == null)
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var blog = await blogSpotService.GetPostForEdition(User, id.Value);
|
||||||
|
if (blog == null)
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SetLangItems();
|
||||||
|
return View(blog);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (AuthorizationFailureException)
|
||||||
|
{
|
||||||
|
return new ChallengeResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST: Blog/Edit/5
|
||||||
|
[HttpPost]
|
||||||
|
[ValidateAntiForgeryToken, Authorize()]
|
||||||
|
public async Task<IActionResult> Edit(BlogPostEditViewModel blogEdit)
|
||||||
|
{
|
||||||
|
if (ModelState.IsValid)
|
||||||
|
{
|
||||||
|
await blogSpotService.Modify(User, blogEdit);
|
||||||
|
ViewBag.StatusMessage = "Post modified";
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
return View(blogEdit);
|
||||||
|
}
|
||||||
|
|
||||||
// GET: Blog/Delete/5
|
// GET: Blog/Delete/5
|
||||||
[ActionName("Delete"), Authorize()]
|
[ActionName("Delete"), Authorize()]
|
||||||
|
|
|
||||||
88
src/Yavsc.Org/Views/Blogspot/Create.cshtml
Normal file
88
src/Yavsc.Org/Views/Blogspot/Create.cshtml
Normal file
|
|
@ -0,0 +1,88 @@
|
||||||
|
@model BlogPostEditViewModel
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewBag.Title = "Blog post edition";
|
||||||
|
}
|
||||||
|
|
||||||
|
@section header {
|
||||||
|
|
||||||
|
<link href="~/css/main/dropzone.css" rel="stylesheet">
|
||||||
|
<link href="~/css/dropzone-basic.min.css" rel="stylesheet">
|
||||||
|
<script src="~/js/dropzone.bundle.min.js" asp-append-version="true"></script>
|
||||||
|
|
||||||
|
@{ await Html.RenderPartialAsync("_FSScriptsPartial"); }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2>Blog post</h2>
|
||||||
|
<label><input type="checkbox" id="vcbtn" />Editer le code source Markdown</label>
|
||||||
|
|
||||||
|
<div asp-validation-summary="All" class="text-danger"></div>
|
||||||
|
|
||||||
|
<img class="blogphoto" alt="" src="@Model.Photo" title="Photo associée au post">
|
||||||
|
<h2 title="Titre du post" class="blogtitle" id="titleview" >@Model.Title</h2>
|
||||||
|
|
||||||
|
<div title="Contenu du post" id="contentview">@Model.Article</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<form asp-controller="Blogspot" asp-action="Create">
|
||||||
|
<div class="form-horizontal">
|
||||||
|
|
||||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
|
|
||||||
|
<div class="form-group mdcoding">
|
||||||
|
<label asp-for="Title" class="col-md-2 control-label"></label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input asp-for="Title" class="form-control" data-from="titleview"/>
|
||||||
|
<span asp-validation-for="Title" class="text-danger" >
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Photo" class="col-md-2 control-label"></label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input asp-for="Photo" class="form-control" />
|
||||||
|
<span asp-validation-for="Photo" class="text-danger" >
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mdcoding">
|
||||||
|
<label asp-for="Article" class="col-md-2 control-label" ></label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<textarea asp-for="Article" class="form-control" id="Article" data-from="contentview">
|
||||||
|
</textarea>
|
||||||
|
<span asp-validation-for="Article" class="text-danger" >
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="ACL" class="col-md-2 control-label"></label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
@await Component.InvokeAsync("CirclesControl", Model)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Publish" class="col-md-2 control-label"></label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input asp-for="Publish" class="form-control" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-offset-2 col-md-10">
|
||||||
|
<button class="btn btn-primary" >Save</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
@await Component.InvokeAsync(name: "Directory",arguments: new {subdir="."})
|
||||||
|
<div >
|
||||||
|
@{ await Html.RenderPartialAsync("_PostFilesPartial"); }
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a asp-action="Index">Back to List</a>
|
||||||
|
</div>
|
||||||
|
|
@ -98,5 +98,8 @@ $('#commentValidation').html(
|
||||||
<p><i>Vous devez être identifié pour commenter.</i> </p>
|
<p><i>Vous devez être identifié pour commenter.</i> </p>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if ((await AuthorizationService.AuthorizeAsync(User, Model, new EditPermission())).Succeeded) {
|
||||||
|
<a asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-link">Edit</a>
|
||||||
|
}
|
||||||
<a asp-action="Index" class="btn btn-link">Back to List</a>
|
<a asp-action="Index" class="btn btn-link">Back to List</a>
|
||||||
|
|
||||||
|
|
|
||||||
120
src/Yavsc.Org/Views/Blogspot/Edit.cshtml
Normal file
120
src/Yavsc.Org/Views/Blogspot/Edit.cshtml
Normal file
|
|
@ -0,0 +1,120 @@
|
||||||
|
@model BlogPostEditViewModel
|
||||||
|
@{
|
||||||
|
ViewBag.Title = "Blog post edition";
|
||||||
|
}
|
||||||
|
|
||||||
|
@section header {
|
||||||
|
|
||||||
|
<link href="~/css/main/dropzone.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.box__dragndrop,
|
||||||
|
.box__uploading,
|
||||||
|
.box__success,
|
||||||
|
.box__error {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box.has-advanced-upload {
|
||||||
|
background-color: white;
|
||||||
|
outline: 2px dashed black;
|
||||||
|
outline-offset: -10px;
|
||||||
|
}
|
||||||
|
.box.has-advanced-upload .box__dragndrop {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
.box.is-dragover {
|
||||||
|
background-color: grey;
|
||||||
|
}
|
||||||
|
.ql-snow.ql-toolbar {
|
||||||
|
border: outset grey 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<script src="~/js/dropzone.bundle.min.js" asp-append-version="true"></script>
|
||||||
|
|
||||||
|
|
||||||
|
@{ await Html.RenderPartialAsync("_FSScriptsPartial"); }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
<h2 >Blog post</h2>
|
||||||
|
<label><input type="checkbox" id="vcbtn" />Editer le code source Markdown</label>
|
||||||
|
|
||||||
|
<div asp-validation-summary="All" class="text-danger"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="Titletoolbar" class="hidden ql-snow ql-toolbar">
|
||||||
|
<button class="ql-format-button ql-italic"></button>
|
||||||
|
<button class="ql-format-button ql-underline"></button>
|
||||||
|
<button class="ql-format-button ql-strike"></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<img class="blogphoto" alt="" src="@Model.Photo" title="Photo associée au post">
|
||||||
|
<h2 title="Titre du post" class="blogtitle" id="titleview" >@Model.Title</h2>
|
||||||
|
|
||||||
|
<form asp-action="Edit">
|
||||||
|
<div class="form-horizontal">
|
||||||
|
|
||||||
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||||
|
@Html.HiddenFor(m=>m.Id)
|
||||||
|
|
||||||
|
<div class="form-group mdcoding">
|
||||||
|
<label asp-for="Title" class="col-md-2 control-label"></label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input asp-for="Title" class="form-control" data-from="titleview"/>
|
||||||
|
<span asp-validation-for="Title" class="text-danger" >
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Photo" class="col-md-2 control-label"></label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input asp-for="Photo" class="form-control" />
|
||||||
|
<span asp-validation-for="Photo" class="text-danger" >
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group mdcoding">
|
||||||
|
<label asp-for="Article" class="col-md-2 control-label" ></label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<textarea asp-for="Article" class="form-control"
|
||||||
|
id="Article" data-from="contentview">
|
||||||
|
</textarea>
|
||||||
|
<span asp-validation-for="Article" class="text-danger" >
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="ACL" class="col-md-2 control-label"></label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
@await Component.InvokeAsync("CirclesControl", Model)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label asp-for="Publish" class="col-md-2 control-label"></label>
|
||||||
|
<div class="col-md-10">
|
||||||
|
<input type="checkbox" asp-for="Publish" class="form-control" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-offset-2 col-md-10">
|
||||||
|
<input type="submit" value="Save" class="btn btn-primary" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
@await Component.InvokeAsync("Directory","")
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div >
|
||||||
|
@{ await Html.RenderPartialAsync("_PostFilesPartial"); }
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a asp-action="Index">Back to List</a>
|
||||||
|
</div>
|
||||||
|
|
@ -39,6 +39,11 @@
|
||||||
}
|
}
|
||||||
<h2>@ViewBag.Title</h2>
|
<h2>@ViewBag.Title</h2>
|
||||||
<p class="text-success">@ViewBag.StatusMessage</p>
|
<p class="text-success">@ViewBag.StatusMessage</p>
|
||||||
|
@if (User.IsSignedIn()) {
|
||||||
|
<p>
|
||||||
|
<a asp-action="Create">Create a new article</a>
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
|
||||||
<div class="blog-index">
|
<div class="blog-index">
|
||||||
@{
|
@{
|
||||||
|
|
@ -73,6 +78,8 @@
|
||||||
}
|
}
|
||||||
@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="Delete" asp-route-id="@post.Id" class="btn btn-danger">Delete</a>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,10 @@
|
||||||
<h2 markdown="@ViewBag.Title"></h2>
|
<h2 markdown="@ViewBag.Title"></h2>
|
||||||
<p class="text-success">@ViewBag.StatusMessage</p>
|
<p class="text-success">@ViewBag.StatusMessage</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a asp-action="Create" asp-route-title="@ViewBag.Title">Poster au même titre</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
|
|
||||||
@foreach (var item in Model) {
|
@foreach (var item in Model) {
|
||||||
|
|
@ -28,7 +32,8 @@
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
@if ((await AuthorizationService.AuthorizeAsync(User, item, new EditPermission())).Succeeded) {
|
@if ((await AuthorizationService.AuthorizeAsync(User, item, new EditPermission())).Succeeded) {
|
||||||
|
<li><a asp-action="Edit" asp-route-id="@item.Id" class="btn btn-primary">Edit</a>
|
||||||
|
</li>
|
||||||
<li><a asp-action="Delete" asp-route-id="@item.Id" class="btn btn-danger">Delete</a>
|
<li><a asp-action="Delete" asp-route-id="@item.Id" class="btn btn-danger">Delete</a>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3924,7 +3924,7 @@ fieldset:disabled .btn {
|
||||||
--bs-dropdown-box-shadow: var(--bs-box-shadow);
|
--bs-dropdown-box-shadow: var(--bs-box-shadow);
|
||||||
--bs-dropdown-link-color: var(--bs-body-color);
|
--bs-dropdown-link-color: var(--bs-body-color);
|
||||||
--bs-dropdown-link-hover-color: #fff;
|
--bs-dropdown-link-hover-color: #fff;
|
||||||
--bs-dropdown-link-hover-bg: rgba(0, 0, 0, 0.4);
|
--bs-dropdown-link-hover-bg: rgba(255, 255, 255, 0.4);
|
||||||
--bs-dropdown-link-active-color: #fff;
|
--bs-dropdown-link-active-color: #fff;
|
||||||
--bs-dropdown-link-active-bg: #e83283;
|
--bs-dropdown-link-active-bg: #e83283;
|
||||||
--bs-dropdown-link-disabled-color: var(--bs-tertiary-color);
|
--bs-dropdown-link-disabled-color: var(--bs-tertiary-color);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -6,7 +6,7 @@ namespace Yavsc.Models.Blog
|
||||||
public BlogPostEditViewModel()
|
public BlogPostEditViewModel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlogPostEditViewModel(BlogPost post, bool publish)
|
public BlogPostEditViewModel(BlogPost post, bool publish)
|
||||||
{
|
{
|
||||||
Id = post.Id;
|
Id = post.Id;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue