Added a "Type" property to form inputs.

Fixed the second "title" section found in web page heads.
This commit is contained in:
Paul Schneider 2014-10-01 15:34:00 +02:00
commit 301dbdcb6d
15 changed files with 83 additions and 24 deletions

View file

@ -7,12 +7,23 @@ namespace SalesCatalog.Model
public CheckBox () public CheckBox ()
{ {
} }
#region implemented abstract members of FormInput
public override string Type {
get {
return "checkbox";
}
}
public bool Value { get; set; } public bool Value { get; set; }
public override string ToHtml () public override string ToHtml ()
{ {
return string.Format ("<input type=\"checkbox\" id=\"{0}\" name=\"{1}\" {2}/>", Id,Name,Value?"checked":""); return string.Format ("<input type=\"checkbox\" id=\"{0}\" name=\"{1}\" {2}/>", Id,Name,Value?"checked":"");
} }
#endregion
} }
} }

View file

@ -4,6 +4,13 @@ namespace SalesCatalog.Model
{ {
public class FilesInput : FormInput public class FilesInput : FormInput
{ {
#region implemented abstract members of FormInput
public override string Type {
get {
return "file";
}
}
#endregion
public FilesInput () public FilesInput ()
{ {

View file

@ -13,6 +13,7 @@ namespace SalesCatalog.Model
public string Id { get; set; } public string Id { get; set; }
private string name=null; private string name=null;
public abstract string Type { get; }
public string Name { get { return name == null ? Id : name; } set { name = value; } } public string Name { get { return name == null ? Id : name; } set { name = value; } }
} }
} }

View file

@ -4,6 +4,16 @@ namespace SalesCatalog.Model
{ {
public class RadioButton:FormInput public class RadioButton:FormInput
{ {
#region implemented abstract members of FormInput
public override string Type {
get {
return "radio";
}
}
#endregion
public RadioButton () public RadioButton ()
{ {
} }

View file

@ -6,6 +6,16 @@ namespace SalesCatalog.Model
{ {
public class SelectInput: FormInput public class SelectInput: FormInput
{ {
#region implemented abstract members of FormInput
public override string Type {
get {
return "select";
}
}
#endregion
public Option[] Items; public Option[] Items;
public int SelectedIndex; public int SelectedIndex;
public override string ToHtml () public override string ToHtml ()

View file

@ -4,9 +4,18 @@ namespace SalesCatalog.Model
{ {
public class TextInput:FormInput public class TextInput:FormInput
{ {
#region implemented abstract members of FormInput
public override string Type {
get {
return "text";
}
}
#endregion
public TextInput () public TextInput ()
{ {
} }
public TextInput (string txt) public TextInput (string txt)
{ {
text = txt; text = txt;

View file

@ -8,9 +8,14 @@ namespace WorkFlowProvider
{ {
public static class WFManager public static class WFManager
{ {
public static Estimate GetEstimate (long estid)
{
return ContentProvider.GetEstimate (estid);
}
public static void UpdateWritting (Writting wr) public static void UpdateWritting (Writting wr)
{ {
throw new NotImplementedException (); ContentProvider.UpdateWritting (wr);
} }
public static void DropWritting (long wrid) public static void DropWritting (long wrid)

View file

@ -12,7 +12,7 @@ namespace Yavsc.Controllers
{ {
public class FileSystemController : Controller public class FileSystemController : Controller
{ {
private static string usersDir ="users"; private static string usersDir ="~/users";
public static string UsersDir { public static string UsersDir {
get { get {
@ -25,9 +25,10 @@ namespace Yavsc.Controllers
{ {
string user = Membership.GetUser ().UserName; string user = Membership.GetUser ().UserName;
ViewData ["UserName"] = user; ViewData ["UserName"] = user;
DirectoryInfo di = new DirectoryInfo ( DirectoryInfo di = new DirectoryInfo (
Path.Combine( Path.Combine(
UsersDir, Server.MapPath(UsersDir),
user)); user));
if (!di.Exists) if (!di.Exists)
di.Create (); di.Create ();

View file

@ -66,10 +66,12 @@ namespace Yavsc.ApiControllers
return result; return result;
} }
/// <summary>
/// Adds to basket, a product from the catalog, in the user's session.
/// </summary>
/// <returns>The to basket.</returns>
[HttpGet] [HttpGet]
[Authorize] public long AddToBasket (string prodref,int count, object prodparams=null)
public long AddToBasket (string title)
{ {
//TODO find the basket for Membership.GetUser().UserName //TODO find the basket for Membership.GetUser().UserName
//return WFManager.Write(estid << from the basket, desc, ucost, count, productid); //return WFManager.Write(estid << from the basket, desc, ucost, count, productid);

View file

@ -8,11 +8,18 @@ using System.Text.RegularExpressions;
using System.IO; using System.IO;
using Yavsc.Controllers; using Yavsc.Controllers;
using System.Collections.Generic; using System.Collections.Generic;
using yavscModel.WorkFlow;
using WorkFlowProvider;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
public class FrontOfficeController : Controller public class FrontOfficeController : Controller
{ {
[HttpGet]
public Estimate GetEstimate(long estid) {
return WFManager.GetEstimate (estid);
}
[AcceptVerbs("GET")] [AcceptVerbs("GET")]
public ActionResult Catalog () public ActionResult Catalog ()
{ {

View file

@ -7,18 +7,14 @@
<link rel="stylesheet" href="/style.css"/> <link rel="stylesheet" href="/style.css"/>
<link rel="icon" type="image/png" href="/favicon.png" /> <link rel="icon" type="image/png" href="/favicon.png" />
<link href='http://fonts.googleapis.com/css?family=Dancing+Script:400,700' rel='stylesheet' type='text/css'/> <link href='http://fonts.googleapis.com/css?family=Dancing+Script:400,700' rel='stylesheet' type='text/css'/>
<asp:ContentPlaceHolder id="init" runat="server"></asp:ContentPlaceHolder> <asp:ContentPlaceHolder id="init" runat="server">
<asp:ContentPlaceHolder ID="title" runat="server">
<title>
<%= Page.Title %>
<asp:Literal runat="server" Text=" - " /><%= YavscHelpers.SiteName %>
</title>
</asp:ContentPlaceHolder> </asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder>
</head> </head>
<body> <body>
<header> <header>
<div id="login"> <div id="login">
<%= Html.ActionLink( YavscHelpers.SiteName, "Index", "Home" ) %>
<% if (Membership.GetUser()==null) { %> <% if (Membership.GetUser()==null) { %>
<%= Html.ActionLink("Login", "Login", "Account", new { returnUrl=Request.Url.PathAndQuery }, null ) %> <%= Html.ActionLink("Login", "Login", "Account", new { returnUrl=Request.Url.PathAndQuery }, null ) %>
@ -31,7 +27,7 @@
<%= Html.ActionLink( "Profile", "Profile", "Account" ) %> <%= Html.ActionLink( "Profile", "Profile", "Account" ) %>
<% } %> <% } %>
<%= Html.ActionLink( "Accueil", "Index", "Home" ) %>
</div> </div>
@ -41,10 +37,9 @@
<h1><a href="<%= Html.Encode(Request.Url.AbsoluteUri.ToString()) %>"> <h1><a href="<%= Html.Encode(Request.Url.AbsoluteUri.ToString()) %>">
<%= Page.Title %> <%= Page.Title %>
</a> </a></h1>
<asp:Literal runat="server" Text=" - " />
<a href="/"> <%= YavscHelpers.SiteName %> </a>
</h1>
</asp:ContentPlaceHolder> </asp:ContentPlaceHolder>

View file

@ -11,7 +11,7 @@
</asp:Content> </asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server"> <asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<div>
<div class="blogpost"> <div class="blogpost">
<% BBCodeHelper.Init(); %> <% BBCodeHelper.Init(); %>
<%= BBCodeHelper.Parser.ToHtml(Model.Content) %> <%= BBCodeHelper.Parser.ToHtml(Model.Content) %>
@ -39,5 +39,5 @@
<input type="submit" value="Poster un commentaire"/> <input type="submit" value="Poster un commentaire"/>
<% } %> <% } %>
</div> </div>
</div>
</asp:Content> </asp:Content>

View file

@ -221,6 +221,9 @@
<Target Name=""> <Target Name="">
<FileCopier Handler="MonoDevelop.Deployment.LocalFileCopyHandler" TargetDirectory="/srv/www/lua" ctype="LocalFileCopyConfiguration" /> <FileCopier Handler="MonoDevelop.Deployment.LocalFileCopyHandler" TargetDirectory="/srv/www/lua" ctype="LocalFileCopyConfiguration" />
</Target> </Target>
<Target Name="">
<FileCopier Handler="MonoDevelop.Deployment.SshFuseFileCopyHandler" TargetDirectory="root@192.168.0.45:/srv/httpd/lua" ExtraMountArguments="" ctype="SshFuseFileCopyConfiguration" />
</Target>
</WebDeployTargets> </WebDeployTargets>
</Properties> </Properties>
</MonoDevelop> </MonoDevelop>

View file

@ -78,9 +78,7 @@ label {
font-size: small; font-size: small;
} }
.blogpost { .blogpost {
border-top: solid 0.5px; background-color: rgba(32,32,32,0.3);
border-bottom: dashed 0.5px;
padding-top: 3px;
} }
.editblog { .editblog {
width: 95%; width: 95%;