bug fixes
This commit is contained in:
parent
9aa7b3c77d
commit
852020f98f
28 changed files with 261 additions and 234 deletions
85
src/Yavsc/Views/Blogspot/Create.cshtml
Normal file
85
src/Yavsc/Views/Blogspot/Create.cshtml
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
@model Yavsc.ViewModels.Blog.BlogPostInputViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Blog post edition";
|
||||
}
|
||||
|
||||
@section header {
|
||||
|
||||
<link href="~/css/main/dropzone.css" rel="stylesheet">
|
||||
|
||||
<script src="~/js/dropzone.js"></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.Content</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="Content" class="col-md-2 control-label" ></label>
|
||||
<div class="col-md-10">
|
||||
<textarea asp-for="Content" class="form-control" id="Content" data-from="contentview">
|
||||
</textarea>
|
||||
<span asp-validation-for="Content" class="text-danger" >
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Visible" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Visible" class="form-control"/>
|
||||
</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">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button class="btn btn-primary" >Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@await Component.InvokeAsync("Directory","")
|
||||
<div >
|
||||
@{ await Html.RenderPartialAsync("_PostFilesPartial"); }
|
||||
</div>
|
||||
<div>
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
||||
|
|
@ -112,7 +112,7 @@ $('span.field-validation-valid[data-valmsg-for="Content"]').html(
|
|||
}
|
||||
|
||||
</div>
|
||||
@if ((await AuthorizationService.AuthorizeAsync(User, Model, new EditRequirement())).Succeeded) {
|
||||
@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>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@model BlogPost
|
||||
@model Yavsc.ViewModels.Blog.BlogPostInputViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Blog post edition";
|
||||
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
@section header {
|
||||
|
||||
<link href="~/css/main/quill.snow.css" rel="stylesheet">
|
||||
<link href="~/css/main/dropzone.css" rel="stylesheet">
|
||||
|
||||
<style>
|
||||
|
|
@ -34,90 +33,12 @@
|
|||
|
||||
</style>
|
||||
<script src="~/js/dropzone.js"></script>
|
||||
<script src="~/js/quill.js"></script>
|
||||
<script src="~/js/to-markdown.js"></script>
|
||||
|
||||
|
||||
@{ await Html.RenderPartialAsync("_FSScriptsPartial"); }
|
||||
@{ await Html.RenderPartialAsync("_FSScriptsPartial"); }
|
||||
|
||||
}
|
||||
|
||||
@section scripts {
|
||||
<script src="~/js/showdown.js" asp-append-version="true"></script>
|
||||
<script src="~/js/md-helpers.js" asp-append-version="true"></script>
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
if (typeof(allowCircleToBlog) !== 'undefined') {
|
||||
$('input.Blogcirle[type=checkbox]').on('change', allowCircleToBlog);
|
||||
}
|
||||
$(".mdcoding").addClass('hidden');
|
||||
$("#contentview").on('drop', function(){drop(event);});
|
||||
$("#contentview").on('dragover', function(){allowDrop(event);});
|
||||
var onchange = function(){
|
||||
var nv = $(this).val();
|
||||
var tid = $(this).data('from');
|
||||
$('#'+tid).html(htmlize(nv));
|
||||
};
|
||||
|
||||
$("#Content").change(onchange);
|
||||
$("#Title").change(onchange);
|
||||
$('#vcbtn').change(function(){
|
||||
var vc = $(this).prop('checked');
|
||||
if (vc) {
|
||||
$("#contentview").addClass('hidden');
|
||||
$("#titleview").addClass('hidden');
|
||||
$(".mdcoding").removeClass('hidden');
|
||||
} else {
|
||||
$("#contentview").removeClass('hidden');
|
||||
$("#titleview").removeClass('hidden');
|
||||
$(".mdcoding").addClass('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
var initQuill = function() {
|
||||
var editortitre = new Quill('#titleview', {
|
||||
modules: { toolbar: '#Titletoolbar' },
|
||||
theme: 'snow'
|
||||
});
|
||||
var editorcontenu = new Quill('#contentview', {
|
||||
modules: { toolbar: '#contentbar' },
|
||||
theme: 'snow'
|
||||
});
|
||||
editortitre.on('selection-change', function(range) {
|
||||
if (range) {
|
||||
$('#contentbar').addClass('hidden');
|
||||
$('#Titletoolbar').removeClass('hidden');
|
||||
}
|
||||
});
|
||||
editortitre.on('text-change',function(delta,source){
|
||||
if (source=='user')
|
||||
{
|
||||
updateMD('Title',$('#ql-editor-1').html())
|
||||
}
|
||||
});
|
||||
editorcontenu.on('selection-change', function(range) {
|
||||
if (range) {
|
||||
$('#contentbar').removeClass('hidden');
|
||||
$('#Titletoolbar').addClass('hidden');
|
||||
}
|
||||
});
|
||||
editorcontenu.on('text-change',function(delta,source){
|
||||
if (source=='user')
|
||||
{
|
||||
updateMD('Content',$('#ql-editor-2').html())
|
||||
}
|
||||
});
|
||||
};
|
||||
initQuill();
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
@Html.Partial("_ValidationScriptsPartial")
|
||||
|
||||
}
|
||||
<h2 > Blog post edition </h2>
|
||||
<label><input type="checkbox" id="vcbtn" />Editer le code source Markdown</label>
|
||||
|
||||
|
|
@ -131,47 +52,17 @@
|
|||
</div>
|
||||
|
||||
<img class="blogphoto" alt="" src="@Model.Photo" title="Photo associée au post">
|
||||
<h2 title="Titre du post" class="blogtitle" id="titleview" ismarkdown>@Model.Title</h2>
|
||||
<h2 title="Titre du post" class="blogtitle" id="titleview" >@Model.Title</h2>
|
||||
|
||||
<div id="contentbar" class="hidden ql-snow ql-toolbar">
|
||||
<span class="ql-format-group">
|
||||
<button class="ql-format-button ql-bold"></button>
|
||||
<button class="ql-format-button ql-italic"></button>
|
||||
<button class="ql-format-button ql-underline"></button>
|
||||
<button class="ql-format-button ql-strike"></button>
|
||||
<environment names="Development">
|
||||
<button class="ql-format-button ql-link"></button>
|
||||
<button class="ql-format-button ql-image"></button>
|
||||
<button class="ql-format-button ql-video"></button>
|
||||
<button class="ql-format-button ql-file"></button>
|
||||
</environment>
|
||||
</span>
|
||||
<span class="ql-format-group">
|
||||
<span title="List" class="ql-format-button ql-list"></span>
|
||||
<span class="ql-format-separator"></span>
|
||||
<span title="Bullet" class="ql-format-button ql-bullet"></span>
|
||||
<span class="ql-format-separator"></span>
|
||||
<select title="Text Alignment" class="ql-align">
|
||||
<option value="left" label="Left" selected=""></option>
|
||||
<option value="center" label="Center"></option>
|
||||
<option value="right" label="Right"></option>
|
||||
<option value="justify" label="Justify"></option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div title="Contenu du post" id="contentview" markdown="@Model.Content"></div>
|
||||
<div title="Contenu du post" id="contentview">@Model.Content</div>
|
||||
|
||||
<hr>
|
||||
<form asp-action="@ViewData["PostTarget"]">
|
||||
<form>
|
||||
<div class="form-horizontal">
|
||||
|
||||
<hr />
|
||||
<p class="text-success">@ViewData["StatusMessage"]</p>
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<input type="hidden" asp-for="Id" />
|
||||
<input type="hidden" asp-for="AuthorId" />
|
||||
|
||||
|
||||
|
||||
<div class="form-group mdcoding">
|
||||
<label asp-for="Title" class="col-md-2 control-label"></label>
|
||||
|
|
@ -182,17 +73,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="Lang" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<select asp-for="Lang" class="form-control" asp-items="@ViewBag.LangItems" >
|
||||
</select>
|
||||
<span asp-validation-for="Lang" 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">
|
||||
|
|
@ -230,9 +110,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
@await Component.InvokeAsync("Directory","")
|
||||
<div >
|
||||
@{ await Html.RenderPartialAsync("_PostFilesPartial"); }
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
<a asp-action="Details" asp-route-id="@item.Id" class="btn btn-lg">Details</a>
|
||||
</li>
|
||||
}
|
||||
@if ((await AuthorizationService.AuthorizeAsync(User, item, new EditRequirement())).Succeeded) {
|
||||
@if ((await AuthorizationService.AuthorizeAsync(User, item, new EditPermission())).Succeeded) {
|
||||
<li><a asp-action="Edit" asp-route-id="@item.Id" class="btn btn-default">Edit</a>
|
||||
</li>
|
||||
<li><a asp-action="Delete" asp-route-id="@item.Id" class="btn btn-danger">Delete</a>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue