a tag panel

vnext
Paul Schneider 9 years ago
parent bb5e34a61d
commit 352a950755
14 changed files with 53 additions and 28 deletions

@ -1,3 +1,8 @@
2015-10-17 Paul Schneider <paul@pschneider.fr>
* NpgsqlTagInfo.cs:
* NpgsqlBlogProvider.cs:
2015-10-17 Paul Schneider <paul@pschneider.fr>
* NpgsqlTagInfo.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);

@ -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;

@ -22,10 +22,9 @@ namespace Yavsc.ApiControllers
public class BlogsController : YavscApiController
{
/// <summary>
/// Tag the specified postid and tag.
/// Tag the specified model.
/// </summary>
/// <param name="id">Postid.</param>
/// <param name="tag">Tag.</param>
/// <param name="model">Model.</param>
[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" } ;
/// <summary>
/// Tags the specified pattern.
/// </summary>
@ -41,7 +41,7 @@ namespace Yavsc.ApiControllers
[ValidateAjaxAttribute]
public IEnumerable<string> Tags(string pattern)
{
return new string[] { "Artistes", "Accueil", "Mentions juridique", "Admin", "Web" } ;
return officalTags;
}
/// <summary>

@ -1,3 +1,14 @@
2015-10-17 Paul Schneider <paul@pschneider.fr>
* Web.csproj:
* Index.aspx:
* Error.aspx:
* TagPanel.ascx:
* UserPost.aspx:
* PageLinks.ascx:
* HomeController.cs:
* BlogsController.cs:
2015-10-17 Paul Schneider <paul@pschneider.fr>
* Web.csproj:

@ -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
/// </summary>
public ActionResult Index ()
{
foreach (string tagname in new string[] {"Artistes","Accueil","Actualités","Mentions légales"})
{
ViewData [tagname] = BlogManager.GetTagInfo (tagname);
}
return View ();
}

@ -1,9 +0,0 @@
<%@ Page Title="Comptes utilisateur - Erreur" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<div>
<%= Html.Encode(ViewData["Message"]) %></div>
Your UID :
<%= Html.Encode(ViewData ["UID"]) %> </br>
<a class="actionlink" href="<%=ViewData["returnUrl"]%>">Retour</a>
</asp:Content>

@ -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");

@ -36,8 +36,6 @@
<% if (Model.Author == username || c.From == username ) { %>
<%= Html.ActionLink("Supprimer","RemoveComment", new { cmtid = c.Id } , new { @class="actionlink" })%>
<% } %>
</div><% } %>
<% if (Membership.GetUser()!=null) {
if (Membership.GetUser().UserName==be.Author)

@ -1,5 +1,12 @@
<%@ Page Title="Home" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master"%>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<%= Html.Partial("TagPanel",ViewData["Accueil"]) %>
<%= Html.Partial("TagPanel",ViewData["Actualités"]) %>
<%= Html.Partial("TagPanel",ViewData["Artistes"]) %>
<%= Html.Partial("TagPanel",ViewData["Mentions légales"]) %>
</asp:Content>
<asp:Content ContentPlaceHolderID="MASContent" ID="MASContentContent" runat="server">
<div>
<%= Html.ActionLink("Les articles", "Index", "Blogs", null, new { @class="actionlink" }) %>
<%= Html.ActionLink("Contact", "Contact", "Home", null, new { @class="actionlink" }) %>

@ -0,0 +1,10 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TagInfo>" %>
<div class="panel">
<i class="fa fa-tag"><%=Model.Name%></i>
<ul>
<% foreach (BasePostInfo be in Model.Titles) { %>
<li><%= be.Title %>
<span><%= be.Intro %></span>
</li>
<% } %></ul>
</div>

@ -227,7 +227,6 @@
<Content Include="Views\Blogs\UserPosts.aspx" />
<Content Include="Views\Blogs\UserPost.aspx" />
<Content Include="Views\Blogs\Edit.aspx" />
<Content Include="Views\Blogs\Error.aspx" />
<Content Include="Views\Account\RegistrationPending.aspx" />
<Content Include="Views\Account\Validate.aspx" />
<Content Include="Views\FrontOffice\Catalog.aspx" />
@ -433,8 +432,8 @@
<Content Include="Views\Blogs\TagControl.ascx" />
<Content Include="Scripts\knockout-jqAutocomplete.js" />
<Content Include="Scripts\knockout-jqAutocomplete.min.js" />
<Content Include="Views\Blogs\PageLinks.ascx" />
<Content Include="Views\Blogs\TagPanel.ascx" />
<Content Include="Views\Home\TagPanel.ascx" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

@ -152,7 +152,10 @@ namespace Yavsc.Model.Blogs
}
Provider.RemoveTitle (username, title);
}
public static TagInfo GetTagInfo(string tagname)
{
return Provider.GetTagInfo (tagname);
}
/// <summary>
/// Lasts the posts.
/// </summary>

@ -1,3 +1,7 @@
2015-10-17 Paul Schneider <paul@pschneider.fr>
* BlogManager.cs:
2015-10-17 Paul Schneider <paul@pschneider.fr>
* TagInfo.cs:

Loading…