* BlogsController.cs: cleans unused code
and drops the server side "Preview" notion, made obsolete by client side MarkdownDeep js * Edit.aspx: no more server side preview action * YavscModel.csproj: no more server side preview action * BlogEditEntryModel.cs: made osolete by MarkDown js * BlogEditCommentModel.cs: made osolete by MarkDown js
This commit is contained in:
parent
282b750d53
commit
a7f5f399ed
7 changed files with 28 additions and 90 deletions
|
|
@ -1,3 +1,11 @@
|
||||||
|
2015-06-09 Paul Schneider <paul@pschneider.fr>
|
||||||
|
|
||||||
|
* BlogsController.cs: - cleans unused code
|
||||||
|
- drops the server side "Preview" notion, made obsolete by
|
||||||
|
client side MarkdownDeep js
|
||||||
|
|
||||||
|
* Edit.aspx: no more server side preview action
|
||||||
|
|
||||||
2015-06-09 Paul Schneider <paul@pschneider.fr>
|
2015-06-09 Paul Schneider <paul@pschneider.fr>
|
||||||
|
|
||||||
* CircleController.cs: adds a Circle controller
|
* CircleController.cs: adds a Circle controller
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,6 @@ namespace Yavsc.Controllers
|
||||||
return UserPost (BlogManager.GetPost (postid));
|
return UserPost (BlogManager.GetPost (postid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string prevstr = LocalizedText.Preview;
|
|
||||||
return UserPost (BlogManager.GetPost (user, title));
|
return UserPost (BlogManager.GetPost (user, title));
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -209,7 +208,7 @@ namespace Yavsc.Controllers
|
||||||
if (String.IsNullOrEmpty (title))
|
if (String.IsNullOrEmpty (title))
|
||||||
title = "";
|
title = "";
|
||||||
ViewData ["UserName"] = un;
|
ViewData ["UserName"] = un;
|
||||||
return View ("Edit", new BlogEditEntryModel { Title = title });
|
return View ("Edit", new BlogEntry { Title = title });
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Validates the post.
|
/// Validates the post.
|
||||||
|
|
@ -218,17 +217,15 @@ namespace Yavsc.Controllers
|
||||||
/// <param name="model">Model.</param>
|
/// <param name="model">Model.</param>
|
||||||
[Authorize,
|
[Authorize,
|
||||||
ValidateInput(false)]
|
ValidateInput(false)]
|
||||||
public ActionResult ValidatePost (BlogEditEntryModel model)
|
public ActionResult ValidatePost (BlogEntry model)
|
||||||
{
|
{
|
||||||
string username = Membership.GetUser ().UserName;
|
string username = Membership.GetUser ().UserName;
|
||||||
ViewData ["SiteName"] = sitename;
|
ViewData ["SiteName"] = sitename;
|
||||||
ViewData ["BlogUser"] = username;
|
ViewData ["BlogUser"] = username;
|
||||||
if (ModelState.IsValid) {
|
if (ModelState.IsValid) {
|
||||||
if (!model.Preview) {
|
|
||||||
BlogManager.Post (username, model.Title, model.Content, model.Visible);
|
BlogManager.Post (username, model.Title, model.Content, model.Visible);
|
||||||
return UserPost (username, model.Title);
|
return UserPost (username, model.Title);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return View ("Post", model);
|
return View ("Post", model);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -238,19 +235,17 @@ namespace Yavsc.Controllers
|
||||||
/// <param name="model">Model.</param>
|
/// <param name="model">Model.</param>
|
||||||
[Authorize,
|
[Authorize,
|
||||||
ValidateInput(false)]
|
ValidateInput(false)]
|
||||||
public ActionResult ValidateEdit (BlogEditEntryModel model)
|
public ActionResult ValidateEdit (BlogEntry model)
|
||||||
{
|
{
|
||||||
ViewData ["SiteName"] = sitename;
|
ViewData ["SiteName"] = sitename;
|
||||||
ViewData ["BlogUser"] = Membership.GetUser ().UserName;
|
ViewData ["BlogUser"] = Membership.GetUser ().UserName;
|
||||||
if (ModelState.IsValid) {
|
if (ModelState.IsValid) {
|
||||||
if (!model.Preview) {
|
|
||||||
if (model.Id != 0)
|
if (model.Id != 0)
|
||||||
BlogManager.UpdatePost (model.Id, model.Title, model.Content, model.Visible);
|
BlogManager.UpdatePost (model.Id, model.Title, model.Content, model.Visible);
|
||||||
else
|
else
|
||||||
BlogManager.Post (model.UserName, model.Title, model.Content, model.Visible);
|
BlogManager.Post (model.UserName, model.Title, model.Content, model.Visible);
|
||||||
return UserPost(model.UserName, model.Title);
|
return UserPost(model.UserName, model.Title);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return View ("Edit", model);
|
return View ("Edit", model);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -259,7 +254,7 @@ namespace Yavsc.Controllers
|
||||||
/// <param name="model">Model.</param>
|
/// <param name="model">Model.</param>
|
||||||
[Authorize,
|
[Authorize,
|
||||||
ValidateInput(false)]
|
ValidateInput(false)]
|
||||||
public ActionResult Edit (BlogEditEntryModel model)
|
public ActionResult Edit (BlogEntry model)
|
||||||
{
|
{
|
||||||
if (model != null) {
|
if (model != null) {
|
||||||
string user = Membership.GetUser ().UserName;
|
string user = Membership.GetUser ().UserName;
|
||||||
|
|
@ -275,7 +270,9 @@ namespace Yavsc.Controllers
|
||||||
if (e.UserName != user) {
|
if (e.UserName != user) {
|
||||||
return View ("TitleNotFound");
|
return View ("TitleNotFound");
|
||||||
}
|
}
|
||||||
model = new BlogEditEntryModel(e);
|
model = e;
|
||||||
|
ModelState.Clear ();
|
||||||
|
TryValidateModel (model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return View (model);
|
return View (model);
|
||||||
|
|
@ -286,15 +283,13 @@ namespace Yavsc.Controllers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model">Model.</param>
|
/// <param name="model">Model.</param>
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public ActionResult Comment (BlogEditCommentModel model) {
|
public ActionResult Comment (Comment model) {
|
||||||
string username = Membership.GetUser ().UserName;
|
string username = Membership.GetUser ().UserName;
|
||||||
ViewData ["SiteName"] = sitename;
|
ViewData ["SiteName"] = sitename;
|
||||||
if (ModelState.IsValid) {
|
if (ModelState.IsValid) {
|
||||||
if (!model.Preview) {
|
|
||||||
BlogManager.Comment(username, model.PostId, model.CommentText, model.Visible);
|
BlogManager.Comment(username, model.PostId, model.CommentText, model.Visible);
|
||||||
return UserPost (model.PostId);
|
return UserPost (model.PostId);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return UserPost (model.PostId);
|
return UserPost (model.PostId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEditEntryModel>" MasterPageFile="~/Models/App.master" %>
|
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEntry>" MasterPageFile="~/Models/App.master" %>
|
||||||
<asp:Content ContentPlaceHolderID="head" ID="HeadContent1" runat="server">
|
<asp:Content ContentPlaceHolderID="head" ID="HeadContent1" runat="server">
|
||||||
<link rel="stylesheet" href="<%=Url.Content("~/Theme/mdd_styles.css")%>">
|
<link rel="stylesheet" href="<%=Url.Content("~/Theme/mdd_styles.css")%>">
|
||||||
<script type="text/javascript" src="<%=Url.Content("~/Scripts/MarkdownDeepLib.min.js")%>">
|
<script type="text/javascript" src="<%=Url.Content("~/Scripts/MarkdownDeepLib.min.js")%>">
|
||||||
|
|
@ -8,9 +8,7 @@
|
||||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||||
<% if (Model != null ) if (Model.Content != null ) { %>
|
<% if (Model != null ) if (Model.Content != null ) { %>
|
||||||
<%= Html.ActionLink(Model.Title,"UserPost",new{user=Model.UserName,title=Model.Title}) %>
|
<%= Html.ActionLink(Model.Title,"UserPost",new{user=Model.UserName,title=Model.Title}) %>
|
||||||
<div class="blogpost">
|
|
||||||
<%= Html.Markdown(Model.Content) %>
|
|
||||||
</div>
|
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<%= Html.ValidationSummary("Edition du billet") %>
|
<%= Html.ValidationSummary("Edition du billet") %>
|
||||||
|
|
@ -23,17 +21,12 @@
|
||||||
<%= Html.LabelFor(model => model.Content) %>:<br/>
|
<%= Html.LabelFor(model => model.Content) %>:<br/>
|
||||||
<div class="mdd_toolbar"></div>
|
<div class="mdd_toolbar"></div>
|
||||||
<%= Html.TextArea( "Content" , new { @class="mdd_editor"}) %>
|
<%= Html.TextArea( "Content" , new { @class="mdd_editor"}) %>
|
||||||
<div class="mdd_resizer"></div>
|
|
||||||
<div class="mdd_preview"></div>
|
|
||||||
<%= Html.ValidationMessage("Content", "*") %>
|
<%= Html.ValidationMessage("Content", "*") %>
|
||||||
<br/>
|
<br/>
|
||||||
<%= Html.CheckBox( "Visible" ) %>
|
<%= Html.CheckBox( "Visible" ) %>
|
||||||
<%= Html.LabelFor(model => model.Visible) %>
|
<%= Html.LabelFor(model => model.Visible) %>
|
||||||
<%= Html.ValidationMessage("Visible", "*") %>
|
<%= Html.ValidationMessage("Visible", "*") %>
|
||||||
<br/>
|
|
||||||
<%= Html.CheckBox( "Preview" ) %>
|
|
||||||
<%= Html.LabelFor(model => model.Preview) %>
|
|
||||||
<%= Html.ValidationMessage("Preview", "*") %>
|
|
||||||
<%= Html.Hidden("Id") %>
|
<%= Html.Hidden("Id") %>
|
||||||
<%= Html.Hidden("UserName") %>
|
<%= Html.Hidden("UserName") %>
|
||||||
|
|
||||||
|
|
@ -58,4 +51,7 @@
|
||||||
</div>
|
</div>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
|
<asp:Content ContentPlaceHolderID="MASContent" ID="masContent1" runat="server">
|
||||||
|
|
||||||
|
<div class="mdd_preview"></div>
|
||||||
|
</asp:Content>
|
||||||
|
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace Yavsc.Model.Blogs
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Blog edit comment model.
|
|
||||||
/// </summary>
|
|
||||||
public class BlogEditCommentModel:Comment
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Blogs.BlogEditCommentModel"/> is preview.
|
|
||||||
/// </summary>
|
|
||||||
/// <value><c>true</c> if preview; otherwise, <c>false</c>.</value>
|
|
||||||
[DisplayName("Prévisualiser")]
|
|
||||||
[Required]
|
|
||||||
public bool Preview { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace Yavsc.Model.Blogs
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Blog edit entry model.
|
|
||||||
/// </summary>
|
|
||||||
public class BlogEditEntryModel:BlogEntry
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.Model.Blogs.BlogEditEntryModel"/> is preview.
|
|
||||||
/// </summary>
|
|
||||||
/// <value><c>true</c> if preview; otherwise, <c>false</c>.</value>
|
|
||||||
[DisplayName("Prévisualiser")]
|
|
||||||
[Required]
|
|
||||||
public bool Preview { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="Yavsc.Model.Blogs.BlogEditEntryModel"/> class.
|
|
||||||
/// </summary>
|
|
||||||
public BlogEditEntryModel ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="Yavsc.Model.Blogs.BlogEditEntryModel"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="be">Be.</param>
|
|
||||||
public BlogEditEntryModel(BlogEntry be) {
|
|
||||||
this.Preview = true;
|
|
||||||
this.Content = be.Content;
|
|
||||||
this.Title = be.Title;
|
|
||||||
this.Posted = be.Posted;
|
|
||||||
this.Modified = be.Modified;
|
|
||||||
this.Visible = be.Visible;
|
|
||||||
this.UserName = be.UserName;
|
|
||||||
this.Id = be.Id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
6
yavscModel/ChangeLog
Normal file
6
yavscModel/ChangeLog
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
2015-06-09 Paul Schneider <paul@pschneider.fr>
|
||||||
|
|
||||||
|
* YavscModel.csproj:
|
||||||
|
* BlogEditEntryModel.cs:
|
||||||
|
* BlogEditCommentModel.cs:
|
||||||
|
|
||||||
|
|
@ -49,11 +49,9 @@
|
||||||
<Compile Include="RolesAndMemebers\NewAdminModel.cs" />
|
<Compile Include="RolesAndMemebers\NewAdminModel.cs" />
|
||||||
<Compile Include="RolesAndMemebers\NewRoleModel.cs" />
|
<Compile Include="RolesAndMemebers\NewRoleModel.cs" />
|
||||||
<Compile Include="RolesAndMemebers\RegisterViewModel.cs" />
|
<Compile Include="RolesAndMemebers\RegisterViewModel.cs" />
|
||||||
<Compile Include="Blogs\BlogEditEntryModel.cs" />
|
|
||||||
<Compile Include="Admin\RestoreQuery.cs" />
|
<Compile Include="Admin\RestoreQuery.cs" />
|
||||||
<Compile Include="Admin\DataAccess.cs" />
|
<Compile Include="Admin\DataAccess.cs" />
|
||||||
<Compile Include="RolesAndMemebers\Profile.cs" />
|
<Compile Include="RolesAndMemebers\Profile.cs" />
|
||||||
<Compile Include="Blogs\BlogEditCommentModel.cs" />
|
|
||||||
<Compile Include="FileSystem\FileInfoCollection.cs" />
|
<Compile Include="FileSystem\FileInfoCollection.cs" />
|
||||||
<Compile Include="WorkFlow\Writting.cs" />
|
<Compile Include="WorkFlow\Writting.cs" />
|
||||||
<Compile Include="WorkFlow\Estimate.cs" />
|
<Compile Include="WorkFlow\Estimate.cs" />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue