Merge commit 'acd2a473bb'
Conflicts: ChangeLog ITContentProvider/ChangeLog Makefile NpgsqlBlogProvider/ChangeLog NpgsqlContentProvider/ChangeLog NpgsqlMRPProviders/ChangeLog TestAPI/ChangeLog web/App_Themes/style.css web/ChangeLog web/Helpers/YavscHelpers.cs web/Models/App.master web/Views/Blogs/UserPosts.aspx
This commit is contained in:
commit
303e4fa57b
21 changed files with 143 additions and 1330 deletions
28
ChangeLog
28
ChangeLog
|
|
@ -1,28 +0,0 @@
|
||||||
2015-10-04 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* Makefile: cleaner code
|
|
||||||
|
|
||||||
2015-08-20 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* Yavsc.sln: Adds the `Presta` project
|
|
||||||
|
|
||||||
2015-08-14 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* README.md: blanked: not clear enough
|
|
||||||
|
|
||||||
2015-07-17 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* Yavsc.sln:
|
|
||||||
|
|
||||||
2015-06-09 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* Yavsc.sln: creates a packaging project
|
|
||||||
|
|
||||||
2015-06-07 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* Makefile: cleans the StyleCop cache
|
|
||||||
|
|
||||||
2015-06-06 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* Yavsc.sln: modifies the Version control integration
|
|
||||||
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
2015-10-01 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* packages.config:
|
|
||||||
* ITContentProvider.csproj:
|
|
||||||
|
|
||||||
2015-07-15 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* ITContentProvider.csproj: Moves to Mono framework
|
|
||||||
|
|
||||||
2015-06-10 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* ITContentProvider.csproj:
|
|
||||||
|
|
||||||
2015-06-09 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* ITContentProvider.csproj: Helps to fix packaging, and cleans
|
|
||||||
dependencies
|
|
||||||
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
2015-10-01 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* packages.config:
|
|
||||||
* NpgsqlBlogProvider.csproj:
|
|
||||||
|
|
||||||
2015-09-27 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlBlogProvider.cs: Fixes the sql command preparation
|
|
||||||
|
|
||||||
2015-09-23 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlBlogProvider.cs: refactoring: The `UserName` property
|
|
||||||
from the `BlogEntry` class is renamed to `Author`
|
|
||||||
|
|
||||||
2015-08-04 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlBlogProvider.cs: * Remove post by id
|
|
||||||
* Manage collections of entries on a couple (user,title), not
|
|
||||||
a single post
|
|
||||||
|
|
||||||
|
|
||||||
2015-07-15 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlBlogProvider.csproj: Moves to Mono framework
|
|
||||||
|
|
||||||
2015-07-02 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlBlogProvider.cs:
|
|
||||||
* NpgsqlBlogProvider.csproj:
|
|
||||||
|
|
||||||
2015-06-09 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlBlogProvider.csproj: Helps to fix packaging, and
|
|
||||||
cleans dependencies
|
|
||||||
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
2015-10-01 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* packages.config:
|
|
||||||
* NpgsqlContentProvider.csproj:
|
|
||||||
|
|
||||||
2015-09-27 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlCircleProvider.cs: Fixes the sql command preparation
|
|
||||||
|
|
||||||
2015-09-10 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlCircleProvider.cs:
|
|
||||||
|
|
||||||
2015-09-10 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlCircleProvider.cs: * refactoring
|
|
||||||
* updates the circle
|
|
||||||
|
|
||||||
2015-08-20 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlCircleProvider.cs: circle members are now stored in bd
|
|
||||||
upon their user's name
|
|
||||||
|
|
||||||
2015-08-04 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlCircleProvider.cs: Fixes the "Match" method.
|
|
||||||
|
|
||||||
* NpgsqlContentProvider.cs: refactoring
|
|
||||||
|
|
||||||
2015-07-15 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlCircleProvider.cs: Makes Circles private, or not
|
|
||||||
|
|
||||||
* NpgsqlContentProvider.cs: Impacts htmldoc
|
|
||||||
|
|
||||||
* NpgsqlContentProvider.csproj: Moves to Mono framework
|
|
||||||
|
|
||||||
2015-07-02 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlCircleProvider.cs:
|
|
||||||
|
|
||||||
2015-06-18 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlCircleProvider.cs: Fixes the Circle creation
|
|
||||||
|
|
||||||
* NpgsqlContentProvider.cs: code formatting
|
|
||||||
|
|
||||||
2015-06-10 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlCircleProvider.cs:
|
|
||||||
|
|
||||||
2015-06-10 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlCircleProvider.cs: implements a Circle provider
|
|
||||||
|
|
||||||
* NpgsqlContentProvider.csproj: new circle provider
|
|
||||||
|
|
||||||
2015-06-09 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlContentProvider.csproj: Helps to fix packaging, and
|
|
||||||
cleans dependencies
|
|
||||||
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
2015-10-01 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* packages.config:
|
|
||||||
* NpgsqlProfileProvider.cs:
|
|
||||||
* NpgsqlMRPProviders.csproj:
|
|
||||||
* NpgsqlMembershipProvider.cs:
|
|
||||||
|
|
||||||
2015-08-04 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlMRPProviders.csproj: new NpgsqlUserName provider
|
|
||||||
|
|
||||||
* NpgsqlRoleProvider.cs: simpler init method
|
|
||||||
|
|
||||||
* NpgsqlUserNameProvider.cs: impements a UserNameProvider
|
|
||||||
|
|
||||||
2015-08-01 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlMembershipProvider.cs: Fixes the membership update.
|
|
||||||
|
|
||||||
2015-07-15 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlMRPProviders.csproj: Moves to Mono framework
|
|
||||||
|
|
||||||
* NpgsqlMembershipProvider.cs: Makes possible to change the
|
|
||||||
UserName
|
|
||||||
|
|
||||||
* NpgsqlRoleProvider.cs: Drops this SQL code, which is
|
|
||||||
actually maintained in Web/instdbws.sql
|
|
||||||
|
|
||||||
2015-06-18 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlMembershipProvider.cs: should fix a bug at resetting
|
|
||||||
the password
|
|
||||||
|
|
||||||
2015-06-10 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlMembershipProvider.cs: Fixes the Google registration
|
|
||||||
since usage of NuGet for Npgsql
|
|
||||||
|
|
||||||
2015-06-09 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* NpgsqlCircleProvider.cs: Refactoring: Npgsql prefix
|
|
||||||
|
|
||||||
* NpgsqlMRPProviders.csproj: Helps to fix packaging, and
|
|
||||||
cleans dependencies
|
|
||||||
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
2015-10-01 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* TestAPI.csproj:
|
|
||||||
* packages.config:
|
|
||||||
|
|
||||||
2015-07-17 Paul Schneider <paul@pschneider.fr>
|
|
||||||
|
|
||||||
* TestAPI.csproj:
|
|
||||||
* AssemblyInfo.cs:
|
|
||||||
|
|
||||||
* TestAutomate.cs: Tests an Automate
|
|
||||||
|
|
||||||
* packages.config: using Machine.Specifications
|
|
||||||
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
2015-10-04 Paul Schneider <paul@pschneider.fr>
|
||||||
|
|
||||||
|
* ResultPages.cs: .
|
||||||
|
|
||||||
2015-09-23 Paul Schneider <paul@pschneider.fr>
|
2015-09-23 Paul Schneider <paul@pschneider.fr>
|
||||||
|
|
||||||
* InputUserName.cs: formatting
|
* InputUserName.cs: formatting
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using System.Security.Permissions;
|
||||||
using System.Web.UI;
|
using System.Web.UI;
|
||||||
using System.Web.UI.WebControls;
|
using System.Web.UI.WebControls;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
namespace Yavsc.WebControls
|
namespace Yavsc.WebControls
|
||||||
{
|
{
|
||||||
|
|
@ -29,19 +30,16 @@ namespace Yavsc.WebControls
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the results per page.
|
/// Gets or sets the results per page.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The results per page.</value>
|
/// <value>The results per page.</value>
|
||||||
[Bindable (true)]
|
public int PageSize {
|
||||||
[DefaultValue(10)]
|
|
||||||
public int ResultsPerPage {
|
|
||||||
get {
|
get {
|
||||||
return (int)( ViewState["ResultsPerPage"]==null?10:ViewState["ResultsPerPage"]);
|
return (int)( ViewState["PageSize"]==null?10:ViewState["PageSize"]);
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
ViewState["ResultsPerPage"]=value;
|
ViewState["PageSize"]=value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,11 +48,8 @@ namespace Yavsc.WebControls
|
||||||
/// Gets or sets the result count.
|
/// Gets or sets the result count.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The result count.</value>
|
/// <value>The result count.</value>
|
||||||
[Bindable (true)]
|
|
||||||
[DefaultValue(0)]
|
|
||||||
public int ResultCount {
|
public int ResultCount {
|
||||||
get {
|
get {
|
||||||
|
|
||||||
return (int)( ViewState["ResultCount"]==null?0:ViewState["ResultCount"]);
|
return (int)( ViewState["ResultCount"]==null?0:ViewState["ResultCount"]);
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
|
|
@ -66,7 +61,6 @@ namespace Yavsc.WebControls
|
||||||
/// Gets or sets the text.
|
/// Gets or sets the text.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The text.</value>
|
/// <value>The text.</value>
|
||||||
[Bindable (true)]
|
|
||||||
[DefaultValue("Pages:")]
|
[DefaultValue("Pages:")]
|
||||||
[Localizable(true)]
|
[Localizable(true)]
|
||||||
public string Text {
|
public string Text {
|
||||||
|
|
@ -85,25 +79,27 @@ namespace Yavsc.WebControls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The action.</value>
|
/// <value>The action.</value>
|
||||||
[Bindable (true)]
|
[Bindable (true)]
|
||||||
[DefaultValue("")]
|
[DefaultValue("?pageIndex=")]
|
||||||
public string Action {
|
public string Action {
|
||||||
get {
|
get {
|
||||||
|
|
||||||
string s = (string)ViewState["Action"];
|
string s = (string)ViewState["Action"];
|
||||||
return (s == null) ? String.Empty : s;
|
return (s == null) ? "?pageIndex=" : s;
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
ViewState["Action"] = value;
|
ViewState["Action"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the none.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The none.</value>
|
||||||
[Bindable (true)]
|
[Bindable (true)]
|
||||||
[DefaultValue("none")]
|
[DefaultValue("none")]
|
||||||
public string None {
|
public string None {
|
||||||
get {
|
get {
|
||||||
|
return (string) ViewState["None"];
|
||||||
string s = (string) ViewState["None"];
|
|
||||||
return (s == null) ? String.Empty : s;
|
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
ViewState["None"] = value;
|
ViewState["None"] = value;
|
||||||
|
|
@ -116,41 +112,42 @@ namespace Yavsc.WebControls
|
||||||
/// <value>The current page.</value>
|
/// <value>The current page.</value>
|
||||||
[Bindable (true)]
|
[Bindable (true)]
|
||||||
[DefaultValue(0)]
|
[DefaultValue(0)]
|
||||||
public int CurrentPage {
|
public int PageIndex {
|
||||||
get {
|
get {
|
||||||
int i = (int)(ViewState["CurrentPage"]==null?0:ViewState["CurrentPage"]);
|
int i = (int)(ViewState["PageIndex"]==null?0:ViewState["PageIndex"]);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
ViewState["CurrentPage"] = value;
|
ViewState["PageIndex"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Renders the contents as the list of links to pages of results.
|
/// Renders the contents as the list of links to pages of results.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="writer">Writer.</param>
|
/// <param name="writer">Writer.</param>
|
||||||
protected override void RenderContents (HtmlTextWriter writer)
|
protected override void RenderContents (HtmlTextWriter writer)
|
||||||
{
|
{
|
||||||
if (ResultCount > 0 && ResultCount > ResultsPerPage ) {
|
if (ResultCount > 0 && ResultCount > PageSize ) {
|
||||||
writer.WriteEncodedText (Text);
|
writer.WriteEncodedText (Text);
|
||||||
int pageCount = ((ResultCount-1) / ResultsPerPage) + 1;
|
int pageCount = ((ResultCount-1) / PageSize) + 1;
|
||||||
for (int pi = (CurrentPage < 5) ? 0 : CurrentPage - 5; pi < pageCount && pi < CurrentPage + 5; pi++) {
|
if ( pageCount > 1 ) {
|
||||||
if (CurrentPage == pi)
|
for (int pi = (PageIndex < 5) ? 0 : PageIndex - 5; pi < pageCount && pi < PageIndex + 5; pi++) {
|
||||||
writer.RenderBeginTag ("b");
|
if (PageIndex == pi)
|
||||||
else {
|
writer.RenderBeginTag ("b");
|
||||||
writer.AddAttribute (HtmlTextWriterAttribute.Href,
|
else {
|
||||||
string.Format (Action, pi));
|
writer.AddAttribute (HtmlTextWriterAttribute.Href,
|
||||||
writer.RenderBeginTag ("a");
|
string.Format (Action, pi));
|
||||||
|
writer.RenderBeginTag ("a");
|
||||||
|
}
|
||||||
|
writer.Write (pi + 1);
|
||||||
|
writer.RenderEndTag ();
|
||||||
|
writer.Write (" ");
|
||||||
}
|
}
|
||||||
writer.Write (pi+1);
|
|
||||||
writer.RenderEndTag ();
|
|
||||||
writer.Write (" ");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ResultCount == 0) {
|
if (ResultCount == 0) {
|
||||||
writer.Write ("(");
|
|
||||||
writer.Write (None);
|
writer.Write (None);
|
||||||
writer.Write (")");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ aside {
|
||||||
max-width: 40em;
|
max-width: 40em;
|
||||||
padding: .5em;
|
padding: .5em;
|
||||||
margin: .5em;
|
margin: .5em;
|
||||||
background-color: rgba(32,32,64,0.8);
|
background-color: rgba(32,32,32,0.8);
|
||||||
border-radius:10px;
|
border-radius:10px;
|
||||||
}
|
}
|
||||||
.postpreview video, .postpreview img {
|
.postpreview video, .postpreview img {
|
||||||
|
|
@ -107,11 +107,11 @@ aside {
|
||||||
display:block;
|
display:block;
|
||||||
margin:1em;
|
margin:1em;
|
||||||
padding:1em;
|
padding:1em;
|
||||||
background-color: rgba(32,32,64,0.8);
|
background-color: rgba(32,32,32,0.8);
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
border-radius:10px;
|
border-radius:10px;
|
||||||
}
|
}
|
||||||
.hiddenpost { background-color: rgba(16,16,16,0.7); }
|
.hiddenpost { background-color: rgba(16,16,16,0.5); }
|
||||||
.fullwidth { width: 100%; }
|
.fullwidth { width: 100%; }
|
||||||
|
|
||||||
textarea.fullwidth { min-height:10em; }
|
textarea.fullwidth { min-height:10em; }
|
||||||
|
|
@ -125,7 +125,7 @@ textarea.fullwidth { min-height:10em; }
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel,.bshpanel, aside {
|
.panel,.bshpanel, aside {
|
||||||
background-color: rgba(32,16,16,0.8);
|
background-color: rgba(32,32,16,0.8);
|
||||||
border-radius:5px;
|
border-radius:5px;
|
||||||
margin:.5em;
|
margin:.5em;
|
||||||
padding: .5em;
|
padding: .5em;
|
||||||
|
|
@ -147,11 +147,13 @@ content: ")";
|
||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #B0B080;
|
color: #B0B080;
|
||||||
|
background-color:rgba(20,20,20,0.5);
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
.usertitleref {
|
.usertitleref {
|
||||||
color: #B0B080;
|
color: #B0B080;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
background-color:rgba(0,0,32,0.8);
|
background-color:rgba(0,0,32,0.6);
|
||||||
font-family: 'Arial', cursive;
|
font-family: 'Arial', cursive;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
}
|
}
|
||||||
|
|
@ -167,19 +169,19 @@ label {
|
||||||
|
|
||||||
.message, #message {
|
.message, #message {
|
||||||
font-size: large;
|
font-size: large;
|
||||||
background-color: rgba(0,64,0,0.1);
|
background-color: rgba(64,64,0,0.5);
|
||||||
}
|
}
|
||||||
.dirty {
|
.dirty {
|
||||||
background-color: rgba(128,128,0,0.3);
|
background-color: rgba(128,128,0,0.5);
|
||||||
}
|
}
|
||||||
.error, #error {
|
.error, #error {
|
||||||
color: #f88;
|
color: #f88;
|
||||||
font-size: large;
|
font-size: large;
|
||||||
background-color: rgba(128,0,0,0.3);
|
background-color: rgba(256,0,0,0.5);
|
||||||
}
|
}
|
||||||
.validation-summary-errors{
|
.validation-summary-errors{
|
||||||
color: #f88;
|
color: #f88;
|
||||||
background-color: rgba(64,0,0,0.3);
|
background-color: rgba(256,0,0,0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -201,7 +203,7 @@ ul.preview li:nth-child(n) {
|
||||||
.actionlink {
|
.actionlink {
|
||||||
color: #B0B080;
|
color: #B0B080;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
background-color:rgba(0,0,32,0.8);
|
background-color:rgba(0,0,32,0.5);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-family: 'Arial', cursive;
|
font-family: 'Arial', cursive;
|
||||||
padding: .2em;
|
padding: .2em;
|
||||||
|
|
|
||||||
1018
web/ChangeLog
1018
web/ChangeLog
File diff suppressed because it is too large
Load diff
|
|
@ -82,11 +82,10 @@ namespace Yavsc.Controllers
|
||||||
/// <param name="pageSize">Page size.</param>
|
/// <param name="pageSize">Page size.</param>
|
||||||
public ActionResult BlogList (int pageIndex = 0, int pageSize = 10)
|
public ActionResult BlogList (int pageIndex = 0, int pageSize = 10)
|
||||||
{
|
{
|
||||||
ViewData ["SiteName"] = sitename;
|
|
||||||
int totalRecords;
|
int totalRecords;
|
||||||
var bs = BlogManager.LastPosts (pageIndex, pageSize, out totalRecords);
|
var bs = BlogManager.LastPosts (pageIndex, pageSize, out totalRecords);
|
||||||
ViewData ["RecordCount"] = totalRecords;
|
ViewData ["ResultCount"] = totalRecords;
|
||||||
ViewData ["pageSize"] = pageSize;
|
ViewData ["PageSize"] = pageSize;
|
||||||
ViewData ["PageIndex"] = pageIndex;
|
ViewData ["PageIndex"] = pageIndex;
|
||||||
return View ("Index", new BlogEntryCollection(bs) );
|
return View ("Index", new BlogEntryCollection(bs) );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ using System.Web.Mvc;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using MarkdownDeep;
|
using MarkdownDeep;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
|
using Yavsc.Model.Blogs;
|
||||||
|
|
||||||
namespace Yavsc.Formatters
|
namespace Yavsc.Formatters
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -171,10 +171,9 @@ namespace Yavsc.Helpers
|
||||||
/// <param name="username">Username.</param>
|
/// <param name="username">Username.</param>
|
||||||
public static string AvatarUrl (this HtmlHelper helper, string username) {
|
public static string AvatarUrl (this HtmlHelper helper, string username) {
|
||||||
ProfileBase pr = ProfileBase.Create (username);
|
ProfileBase pr = ProfileBase.Create (username);
|
||||||
var avpath = pr.GetPropertyValue("Avatar") ;
|
var a = pr.GetPropertyValue("Avatar") ;
|
||||||
if (avpath != null)
|
if (a == null || a is DBNull) return "/avatars/" + helper.Encode(username)+".png";
|
||||||
return helper.Encode (avpath);
|
return helper.Encode ((string)a);
|
||||||
return "/avatars/" + helper.Encode(username)+".png";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="postpreview">
|
<div class="postpreview">
|
||||||
<%= Html.ActionLink(p.Title, "UserPost",
|
<%= Html.ActionLink(p.Title, "UserPost",
|
||||||
new { user = g.Key, title = p.Title }, new { @class = "usertitleref" } ) %>
|
new { user = g.Key, title = p.Title }, new { @class = "usertitleref" } ) %>
|
||||||
|
<p><%= Html.Markdown(p.Intro,"/bfiles/"+p.Id+"/") %></p>
|
||||||
<aside>
|
<aside>
|
||||||
(Posté le <%=p.Posted.ToString("D") %>)
|
(Posté le <%=p.Posted.ToString("D") %>)
|
||||||
|
|
||||||
|
|
@ -24,14 +24,15 @@
|
||||||
</div> <% } %>
|
</div> <% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
|
<form runat="server" id="form1" method="GET">
|
||||||
<form runat="server" id="form1" method="GET">
|
<% rp1.ResultCount = (int) ViewData["ResultCount"];
|
||||||
<% rp1.ResultCount = Model.Count; rp1.ResultsPerPage = 50; %>
|
rp1.PageSize = (int) ViewData ["PageSize"];
|
||||||
<% rp1.CurrentPage = (int) ViewData["PageIndex"]; %>
|
rp1.PageIndex = (int) ViewData["PageIndex"];
|
||||||
<% rp1.None = Html.Translate("no content"); %>
|
rp1.None = Html.Translate("no content");
|
||||||
<yavsc:ResultPages id="rp1" Action = "?pageIndex={0}" runat="server" >
|
%>
|
||||||
|
<yavsc:ResultPages id="rp1" runat="server" >
|
||||||
|
<None>Aucun résultat</None>
|
||||||
</yavsc:ResultPages>
|
</yavsc:ResultPages>
|
||||||
|
</form>
|
||||||
</form>
|
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,24 +33,23 @@
|
||||||
<%= Html.ActionLink("Editer","Edit", new { id = e.Id }, new { @class="actionlink" }) %>
|
<%= Html.ActionLink("Editer","Edit", new { id = e.Id }, new { @class="actionlink" }) %>
|
||||||
<%= Html.ActionLink("Supprimer","RemovePost", new { id = e.Id }, new { @class="actionlink" } ) %>
|
<%= Html.ActionLink("Supprimer","RemovePost", new { id = e.Id }, new { @class="actionlink" } ) %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</aside>
|
|
||||||
|
|
||||||
|
</aside>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
<aside>
|
||||||
<form runat="server" id="form1" method="GET">
|
<form runat="server" id="form1" method="GET">
|
||||||
<%
|
<%
|
||||||
rp1.ResultCount = (int) ViewData["RecordCount"];
|
rp1.ResultCount = (int) ViewData["RecordCount"];
|
||||||
rp1.CurrentPage = (int) ViewData["PageIndex"];
|
rp1.CurrentPage = (int) ViewData["PageIndex"];
|
||||||
user.Value = (string) ViewData["BlogUser"];
|
rp1.PageIndex = (int) ViewData["PageIndex"];
|
||||||
|
|
||||||
%>
|
%>
|
||||||
<aside>
|
<yavsc:ResultPages id="rp1" Action = "?pageIndex={0}" runat="server">
|
||||||
<yavsc:ResultPages id="rp1" Action = "?pageIndex={0}" runat="server">
|
|
||||||
<None><i>Pas de contenu</i></None>
|
<None><i>Pas de contenu</i></None>
|
||||||
</yavsc:ResultPages>
|
</yavsc:ResultPages>
|
||||||
</aside>
|
</form>
|
||||||
<asp:HiddenField id="user" runat="server"></asp:HiddenField>
|
</aside>
|
||||||
</form>
|
|
||||||
|
|
||||||
|
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
@ -188,7 +188,6 @@
|
||||||
<Compile Include="IValueProvider.cs" />
|
<Compile Include="IValueProvider.cs" />
|
||||||
<Compile Include="Formatters\EstimToPdfFormatter.MSAN.cs" />
|
<Compile Include="Formatters\EstimToPdfFormatter.MSAN.cs" />
|
||||||
<Compile Include="Helpers\TemplateException.cs" />
|
<Compile Include="Helpers\TemplateException.cs" />
|
||||||
<Compile Include="Helpers\MarkdownHelper.cs" />
|
|
||||||
<Compile Include="Formatters\FormatterException.cs" />
|
<Compile Include="Formatters\FormatterException.cs" />
|
||||||
<Compile Include="NUnitTestClass.cs" />
|
<Compile Include="NUnitTestClass.cs" />
|
||||||
<Compile Include="TestExec.cs" />
|
<Compile Include="TestExec.cs" />
|
||||||
|
|
|
||||||
|
|
@ -56,51 +56,50 @@ namespace Yavsc.Model.Blogs
|
||||||
{
|
{
|
||||||
return this.Where (x => x.Title == title).ToArray ();
|
return this.Where (x => x.Title == title).ToArray ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Base post info.
|
||||||
|
/// </summary>
|
||||||
|
public class BasePostInfo {
|
||||||
|
/// <summary>
|
||||||
|
/// The identifier.
|
||||||
|
/// </summary>
|
||||||
|
public long Id;
|
||||||
|
/// <summary>
|
||||||
|
/// The posted.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime Posted;
|
||||||
|
/// <summary>
|
||||||
|
/// The modified.
|
||||||
|
/// </summary>
|
||||||
|
public DateTime Modified;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The intro.
|
||||||
|
/// </summary>
|
||||||
|
public string Intro;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Post info.
|
/// Post info.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public struct PostInfoByTitle {
|
public class PostInfoByTitle : BasePostInfo {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The name of the user.
|
/// The name of the user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Author;
|
public string Author;
|
||||||
/// <summary>
|
|
||||||
/// The identifier.
|
|
||||||
/// </summary>
|
|
||||||
public long Id;
|
|
||||||
/// <summary>
|
|
||||||
/// The posted.
|
|
||||||
/// </summary>
|
|
||||||
public DateTime Posted;
|
|
||||||
/// <summary>
|
|
||||||
/// The modified.
|
|
||||||
/// </summary>
|
|
||||||
public DateTime Modified;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Post info by user.
|
/// Post info by user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public struct PostInfoByUser {
|
public class PostInfoByUser : BasePostInfo {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The name of the user.
|
/// The name of the user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Title;
|
public string Title;
|
||||||
/// <summary>
|
|
||||||
/// The identifier.
|
|
||||||
/// </summary>
|
|
||||||
public long Id;
|
|
||||||
/// <summary>
|
|
||||||
/// The posted.
|
|
||||||
/// </summary>
|
|
||||||
public DateTime Posted;
|
|
||||||
/// <summary>
|
|
||||||
/// The modified.
|
|
||||||
/// </summary>
|
|
||||||
public DateTime Modified;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -108,11 +107,12 @@ namespace Yavsc.Model.Blogs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<IGrouping<string,PostInfoByTitle>> GroupByTitle()
|
public IEnumerable<IGrouping<string,PostInfoByTitle>> GroupByTitle()
|
||||||
{
|
{
|
||||||
|
bool truncated;
|
||||||
return from be in this
|
return from be in this
|
||||||
orderby be.Posted descending
|
orderby be.Posted descending
|
||||||
group
|
group
|
||||||
new PostInfoByTitle { Author=be.Author, Id=be.Id,
|
new PostInfoByTitle { Author=be.Author, Id=be.Id,
|
||||||
Posted=be.Posted, Modified=be.Modified }
|
Posted=be.Posted, Modified=be.Modified, Intro = MarkdownHelper.MarkdownIntro(be.Content, out truncated) }
|
||||||
by be.Title
|
by be.Title
|
||||||
into titlegroup
|
into titlegroup
|
||||||
select titlegroup;
|
select titlegroup;
|
||||||
|
|
@ -123,11 +123,12 @@ namespace Yavsc.Model.Blogs
|
||||||
/// <returns>The by user.</returns>
|
/// <returns>The by user.</returns>
|
||||||
public IEnumerable<IGrouping<string,PostInfoByUser>> GroupByUser()
|
public IEnumerable<IGrouping<string,PostInfoByUser>> GroupByUser()
|
||||||
{
|
{
|
||||||
|
bool truncated;
|
||||||
return from be in this
|
return from be in this
|
||||||
orderby be.Posted descending
|
orderby be.Posted descending
|
||||||
group
|
group
|
||||||
new PostInfoByUser { Title=be.Title, Id=be.Id,
|
new PostInfoByUser { Title=be.Title, Id=be.Id,
|
||||||
Posted=be.Posted, Modified=be.Modified }
|
Posted=be.Posted, Modified=be.Modified, Intro = MarkdownHelper.MarkdownIntro(be.Content, out truncated) }
|
||||||
by be.Author
|
by be.Author
|
||||||
into usergroup
|
into usergroup
|
||||||
select usergroup;
|
select usergroup;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using MarkdownDeep;
|
using MarkdownDeep;
|
||||||
|
|
||||||
namespace Yavsc.Helpers
|
namespace Yavsc.Model.Blogs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper class for transforming Markdown.
|
/// Helper class for transforming Markdown.
|
||||||
|
|
@ -44,27 +44,47 @@ namespace Yavsc.Helpers
|
||||||
return new MvcHtmlString(html);
|
return new MvcHtmlString(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IHtmlString MarkdownToHtmlIntro(this HtmlHelper helper, out bool truncated, string text, string urlBaseLocation="")
|
public static string MarkdownIntro(string markdown, out bool truncated) {
|
||||||
{
|
|
||||||
int maxLen = 250;
|
int maxLen = 250;
|
||||||
// Transform the supplied text (Markdown) into HTML.
|
if (markdown.Length < maxLen) {
|
||||||
var markdownTransformer = new Markdown();
|
|
||||||
markdownTransformer.ExtraMode = true;
|
|
||||||
markdownTransformer.UrlBaseLocation = urlBaseLocation;
|
|
||||||
if (text.Length < maxLen) {
|
|
||||||
truncated = false;
|
truncated = false;
|
||||||
return new MvcHtmlString(markdownTransformer.Transform(text));
|
return markdown;
|
||||||
}
|
}
|
||||||
string intro = text.Remove (maxLen);
|
string intro = markdown.Remove (maxLen);
|
||||||
truncated = true;
|
truncated = true;
|
||||||
int inl = intro.LastIndexOf ("\n");
|
int inl = intro.LastIndexOf ("\n");
|
||||||
if (inl > 20)
|
if (inl > 20)
|
||||||
intro = intro.Remove (inl);
|
intro = intro.Remove (inl);
|
||||||
intro += " ...";
|
intro += " ...";
|
||||||
|
return intro;
|
||||||
string html = markdownTransformer.Transform(intro);
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Markdowns to html intro.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The to html intro.</returns>
|
||||||
|
/// <param name="truncated">Truncated.</param>
|
||||||
|
/// <param name="text">Text.</param>
|
||||||
|
/// <param name="urlBaseLocation">URL base location.</param>
|
||||||
|
public static string MarkdownToHtmlIntro(out bool truncated, string text, string urlBaseLocation="") {
|
||||||
|
var md = MarkdownIntro(text, out truncated);
|
||||||
|
var markdownTransformer = new Markdown();
|
||||||
|
markdownTransformer.ExtraMode = true;
|
||||||
|
markdownTransformer.UrlBaseLocation = urlBaseLocation;
|
||||||
|
string html = markdownTransformer.Transform(md);
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Markdowns to html intro.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The to html intro.</returns>
|
||||||
|
/// <param name="helper">Helper.</param>
|
||||||
|
/// <param name="truncated">Truncated.</param>
|
||||||
|
/// <param name="text">Text.</param>
|
||||||
|
/// <param name="urlBaseLocation">URL base location.</param>
|
||||||
|
public static IHtmlString MarkdownToHtmlIntro(this HtmlHelper helper, out bool truncated, string text, string urlBaseLocation="")
|
||||||
|
{
|
||||||
// Wrap the html in an MvcHtmlString otherwise it'll be HtmlEncoded and displayed to the user as HTML :(
|
// Wrap the html in an MvcHtmlString otherwise it'll be HtmlEncoded and displayed to the user as HTML :(
|
||||||
return new MvcHtmlString(html);
|
return new MvcHtmlString(MarkdownToHtmlIntro (out truncated, text, urlBaseLocation));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -1,3 +1,11 @@
|
||||||
|
2015-10-04 Paul Schneider <paul@pschneider.fr>
|
||||||
|
|
||||||
|
* MarkdownHelper.cs:
|
||||||
|
* BlogEntryCollection.cs: refactoring + extract an intro from
|
||||||
|
Markdown for PostInfo*
|
||||||
|
|
||||||
|
* YavscModel.csproj: MarkdownHelper integration
|
||||||
|
|
||||||
2015-10-01 Paul Schneider <paul@pschneider.fr>
|
2015-10-01 Paul Schneider <paul@pschneider.fr>
|
||||||
|
|
||||||
* Profile.cs: refactoring
|
* Profile.cs: refactoring
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,9 @@
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Net.Http.Formatting" />
|
<Reference Include="System.Net.Http.Formatting" />
|
||||||
<Reference Include="System.Web.ApplicationServices" />
|
<Reference Include="System.Web.ApplicationServices" />
|
||||||
|
<Reference Include="MarkdownDeep">
|
||||||
|
<HintPath>..\web\lib\MarkdownDeep.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|
@ -167,6 +170,7 @@
|
||||||
<Compile Include="RolesAndMembers\ChangeUserNameProvider.cs" />
|
<Compile Include="RolesAndMembers\ChangeUserNameProvider.cs" />
|
||||||
<Compile Include="RolesAndMembers\UserManager.cs" />
|
<Compile Include="RolesAndMembers\UserManager.cs" />
|
||||||
<Compile Include="Circles\CircleBase.cs" />
|
<Compile Include="Circles\CircleBase.cs" />
|
||||||
|
<Compile Include="Blogs\MarkdownHelper.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue