diff --git a/NpgsqlBlogProvider/ChangeLog b/NpgsqlBlogProvider/ChangeLog index 325102b0..5b06a594 100644 --- a/NpgsqlBlogProvider/ChangeLog +++ b/NpgsqlBlogProvider/ChangeLog @@ -1,3 +1,8 @@ +2015-10-17 Paul Schneider + + * NpgsqlTagInfo.cs: + * NpgsqlBlogProvider.cs: + 2015-10-17 Paul Schneider * NpgsqlTagInfo.cs: diff --git a/NpgsqlBlogProvider/NpgsqlBlogProvider.cs b/NpgsqlBlogProvider/NpgsqlBlogProvider.cs index 24d31f67..b6d14820 100644 --- a/NpgsqlBlogProvider/NpgsqlBlogProvider.cs +++ b/NpgsqlBlogProvider/NpgsqlBlogProvider.cs @@ -738,7 +738,7 @@ namespace Npgsql.Web.Blog using (NpgsqlCommand cmd = cnx.CreateCommand ()) { cmd.CommandText = "select * " + "from blog where applicationname = :appname and visible = true " + - " order by posted desc limit :len"; + " order by modified desc limit :len"; cmd.Parameters.AddWithValue ("appname", applicationName); cmd.Parameters.AddWithValue ("len", defaultPageSize * 10); diff --git a/NpgsqlBlogProvider/NpgsqlTagInfo.cs b/NpgsqlBlogProvider/NpgsqlTagInfo.cs index 3d7d7bc6..1a829bbc 100644 --- a/NpgsqlBlogProvider/NpgsqlTagInfo.cs +++ b/NpgsqlBlogProvider/NpgsqlTagInfo.cs @@ -56,7 +56,7 @@ namespace Npgsql.Web.Blog " tag._id = tagged.tagid AND \n" + " public.tag.name = :name"; cmd.Parameters.AddWithValue ("name", tagname); - + cnx.Open (); using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) { while (rdr.Read ()) { bool truncated; diff --git a/web/ApiControllers/BlogsController.cs b/web/ApiControllers/BlogsController.cs index d987e85e..9c72be98 100644 --- a/web/ApiControllers/BlogsController.cs +++ b/web/ApiControllers/BlogsController.cs @@ -22,10 +22,9 @@ namespace Yavsc.ApiControllers public class BlogsController : YavscApiController { /// - /// Tag the specified postid and tag. + /// Tag the specified model. /// - /// Postid. - /// Tag. + /// Model. [Authorize, AcceptVerbs ("POST")] public void Tag (PostTag model) { @@ -34,6 +33,7 @@ namespace Yavsc.ApiControllers BlogManager.Tag (model.PostId, model.Tag); } } + static string [] officalTags = new string[] { "Artistes", "Accueil", "Actualités", "Mentions légales", "Admin", "Web" } ; /// /// Tags the specified pattern. /// @@ -41,7 +41,7 @@ namespace Yavsc.ApiControllers [ValidateAjaxAttribute] public IEnumerable Tags(string pattern) { - return new string[] { "Artistes", "Accueil", "Mentions juridique", "Admin", "Web" } ; + return officalTags; } /// diff --git a/web/ChangeLog b/web/ChangeLog index 5b32ed4d..a0677671 100644 --- a/web/ChangeLog +++ b/web/ChangeLog @@ -1,3 +1,14 @@ +2015-10-17 Paul Schneider + + * Web.csproj: + * Index.aspx: + * Error.aspx: + * TagPanel.ascx: + * UserPost.aspx: + * PageLinks.ascx: + * HomeController.cs: + * BlogsController.cs: + 2015-10-17 Paul Schneider * Web.csproj: diff --git a/web/Controllers/HomeController.cs b/web/Controllers/HomeController.cs index f8548685..a11d7d5a 100644 --- a/web/Controllers/HomeController.cs +++ b/web/Controllers/HomeController.cs @@ -13,6 +13,7 @@ using Npgsql.Web.Blog; using Yavsc.Helpers; using Yavsc; using System.Web.Mvc; +using Yavsc.Model.Blogs; namespace Yavsc.Controllers { @@ -84,6 +85,10 @@ namespace Yavsc.Controllers /// public ActionResult Index () { + foreach (string tagname in new string[] {"Artistes","Accueil","Actualités","Mentions légales"}) + { + ViewData [tagname] = BlogManager.GetTagInfo (tagname); + } return View (); } diff --git a/web/Views/Blogs/Error.aspx b/web/Views/Blogs/Error.aspx deleted file mode 100644 index 739b5216..00000000 --- a/web/Views/Blogs/Error.aspx +++ /dev/null @@ -1,9 +0,0 @@ -<%@ Page Title="Comptes utilisateur - Erreur" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - - -
-<%= Html.Encode(ViewData["Message"]) %>
-Your UID : -<%= Html.Encode(ViewData ["UID"]) %>
-">Retour -
diff --git a/web/Views/Blogs/PageLinks.ascx b/web/Views/Blogs/PageLinks.ascx deleted file mode 100644 index 1a3db716..00000000 --- a/web/Views/Blogs/PageLinks.ascx +++ /dev/null @@ -1,8 +0,0 @@ -<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> - -<%= (int) ViewData["ResultCount"] %> - rp1.PageSize = (int) ViewData ["PageSize"]; - rp1.PageIndex = (int) ViewData["PageIndex"]; - rp1.None = Html.Translate("no content"); - - \ No newline at end of file diff --git a/web/Views/Blogs/UserPost.aspx b/web/Views/Blogs/UserPost.aspx index 605c43b8..e0e75770 100644 --- a/web/Views/Blogs/UserPost.aspx +++ b/web/Views/Blogs/UserPost.aspx @@ -36,8 +36,6 @@ <% if (Model.Author == username || c.From == username ) { %> <%= Html.ActionLink("Supprimer","RemoveComment", new { cmtid = c.Id } , new { @class="actionlink" })%> <% } %> - - <% } %> <% if (Membership.GetUser()!=null) { if (Membership.GetUser().UserName==be.Author) diff --git a/web/Views/Home/Index.aspx b/web/Views/Home/Index.aspx index 7aec880c..892aaf6b 100644 --- a/web/Views/Home/Index.aspx +++ b/web/Views/Home/Index.aspx @@ -1,5 +1,12 @@ <%@ Page Title="Home" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master"%> +<%= Html.Partial("TagPanel",ViewData["Accueil"]) %> +<%= Html.Partial("TagPanel",ViewData["Actualités"]) %> +<%= Html.Partial("TagPanel",ViewData["Artistes"]) %> +<%= Html.Partial("TagPanel",ViewData["Mentions légales"]) %> + + +
<%= Html.ActionLink("Les articles", "Index", "Blogs", null, new { @class="actionlink" }) %> <%= Html.ActionLink("Contact", "Contact", "Home", null, new { @class="actionlink" }) %> diff --git a/web/Views/Home/TagPanel.ascx b/web/Views/Home/TagPanel.ascx new file mode 100644 index 00000000..33782b69 --- /dev/null +++ b/web/Views/Home/TagPanel.ascx @@ -0,0 +1,10 @@ +<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> +
+<%=Model.Name%> +
    +<% foreach (BasePostInfo be in Model.Titles) { %> +
  • <%= be.Title %> +<%= be.Intro %> +
  • +<% } %>
+
\ No newline at end of file diff --git a/web/Web.csproj b/web/Web.csproj index baa24842..535006a1 100644 --- a/web/Web.csproj +++ b/web/Web.csproj @@ -227,7 +227,6 @@ - @@ -433,8 +432,8 @@ - + diff --git a/yavscModel/Blogs/BlogManager.cs b/yavscModel/Blogs/BlogManager.cs index 5a9572b0..ddf659d4 100644 --- a/yavscModel/Blogs/BlogManager.cs +++ b/yavscModel/Blogs/BlogManager.cs @@ -152,7 +152,10 @@ namespace Yavsc.Model.Blogs } Provider.RemoveTitle (username, title); } - + public static TagInfo GetTagInfo(string tagname) + { + return Provider.GetTagInfo (tagname); + } /// /// Lasts the posts. /// diff --git a/yavscModel/ChangeLog b/yavscModel/ChangeLog index c97195e1..899784d3 100644 --- a/yavscModel/ChangeLog +++ b/yavscModel/ChangeLog @@ -1,3 +1,7 @@ +2015-10-17 Paul Schneider + + * BlogManager.cs: + 2015-10-17 Paul Schneider * TagInfo.cs: