diff --git a/src/Yavsc.Org/Controllers/Communicating/BlogspotController.cs b/src/Yavsc.Org/Controllers/Communicating/BlogspotController.cs index b55171879..31142cd60 100644 --- a/src/Yavsc.Org/Controllers/Communicating/BlogspotController.cs +++ b/src/Yavsc.Org/Controllers/Communicating/BlogspotController.cs @@ -90,73 +90,6 @@ 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 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 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 [ActionName("Delete"), Authorize()] diff --git a/src/Yavsc.Org/Views/Blogspot/Create.cshtml b/src/Yavsc.Org/Views/Blogspot/Create.cshtml deleted file mode 100644 index 6831b0461..000000000 --- a/src/Yavsc.Org/Views/Blogspot/Create.cshtml +++ /dev/null @@ -1,88 +0,0 @@ -@model BlogPostEditViewModel - -@{ - ViewBag.Title = "Blog post edition"; -} - -@section header { - - - - - - @{ await Html.RenderPartialAsync("_FSScriptsPartial"); } - -} - -

Blog post

- - -
- - -

@Model.Title

- -
@Model.Article
- -
-
-
- -
- -
- -
- - - -
-
- -
- -
- - - -
-
- -
- -
- - - -
-
- -
- -
- @await Component.InvokeAsync("CirclesControl", Model) -
-
- -
- -
- -
-
- -
-
- -
-
-
-
-@await Component.InvokeAsync(name: "Directory",arguments: new {subdir="."}) -
- @{ await Html.RenderPartialAsync("_PostFilesPartial"); } -
-
- Back to List -
diff --git a/src/Yavsc.Org/Views/Blogspot/Details.cshtml b/src/Yavsc.Org/Views/Blogspot/Details.cshtml index c41f6bac0..a78964c5e 100644 --- a/src/Yavsc.Org/Views/Blogspot/Details.cshtml +++ b/src/Yavsc.Org/Views/Blogspot/Details.cshtml @@ -98,8 +98,5 @@ $('#commentValidation').html(

Vous devez être identifié pour commenter.

} - @if ((await AuthorizationService.AuthorizeAsync(User, Model, new EditPermission())).Succeeded) { - Edit - } Back to List diff --git a/src/Yavsc.Org/Views/Blogspot/Edit.cshtml b/src/Yavsc.Org/Views/Blogspot/Edit.cshtml deleted file mode 100644 index 4645d45db..000000000 --- a/src/Yavsc.Org/Views/Blogspot/Edit.cshtml +++ /dev/null @@ -1,120 +0,0 @@ -@model BlogPostEditViewModel -@{ - ViewBag.Title = "Blog post edition"; -} - -@section header { - - - - - - - - @{ await Html.RenderPartialAsync("_FSScriptsPartial"); } - -} - -

Blog post

- - -
- - - - - -

@Model.Title

- -
-
- -
- @Html.HiddenFor(m=>m.Id) - -
- -
- - - -
-
- -
- -
- - - -
-
-
- -
- - - -
-
-
- -
- @await Component.InvokeAsync("CirclesControl", Model) -
-
- -
- -
- -
-
- -
-
- -
-
-
-
-@await Component.InvokeAsync("Directory","") - - -
- -
- @{ await Html.RenderPartialAsync("_PostFilesPartial"); } -
-
- Back to List -
diff --git a/src/Yavsc.Org/Views/Blogspot/Index.cshtml b/src/Yavsc.Org/Views/Blogspot/Index.cshtml index 9d27798ee..1179dba53 100644 --- a/src/Yavsc.Org/Views/Blogspot/Index.cshtml +++ b/src/Yavsc.Org/Views/Blogspot/Index.cshtml @@ -39,11 +39,6 @@ }

@ViewBag.Title

@ViewBag.StatusMessage

-@if (User.IsSignedIn()) { -

- Create a new article -

-}
@{ @@ -78,8 +73,6 @@ } @if ((await AuthorizationService.AuthorizeAsync(User, post, new EditPermission())).Succeeded) { - Edit - Delete } diff --git a/src/Yavsc.Org/Views/Blogspot/Title.cshtml b/src/Yavsc.Org/Views/Blogspot/Title.cshtml index 3a4dd8886..9421a5b01 100644 --- a/src/Yavsc.Org/Views/Blogspot/Title.cshtml +++ b/src/Yavsc.Org/Views/Blogspot/Title.cshtml @@ -3,10 +3,6 @@

@ViewBag.StatusMessage

-

- Poster au même titre -

- @foreach (var item in Model) { @@ -32,8 +28,7 @@ } @if ((await AuthorizationService.AuthorizeAsync(User, item, new EditPermission())).Succeeded) { -
  • Edit -
  • +
  • Delete
  • } diff --git a/src/Yavsc.Server/Models/Blog/BlogPostEditViewModel.cs b/src/Yavsc.Server/Models/Blog/BlogPostEditViewModel.cs index 152e2e9a6..5c3c1e225 100644 --- a/src/Yavsc.Server/Models/Blog/BlogPostEditViewModel.cs +++ b/src/Yavsc.Server/Models/Blog/BlogPostEditViewModel.cs @@ -6,7 +6,7 @@ namespace Yavsc.Models.Blog public BlogPostEditViewModel() { } - + public BlogPostEditViewModel(BlogPost post, bool publish) { Id = post.Id;