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
parent 71f1cfcf20
commit 301dbdcb6d
15 changed files with 83 additions and 24 deletions

View File

@ -7,12 +7,23 @@ namespace SalesCatalog.Model
public CheckBox ()
{
}
#region implemented abstract members of FormInput
public override string Type {
get {
return "checkbox";
}
}
public bool Value { get; set; }
public override string ToHtml ()
{
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
{
#region implemented abstract members of FormInput
public override string Type {
get {
return "file";
}
}
#endregion
public FilesInput ()
{

View File

@ -13,6 +13,7 @@ namespace SalesCatalog.Model
public string Id { get; set; }
private string name=null;
public abstract string Type { get; }
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
{
#region implemented abstract members of FormInput
public override string Type {
get {
return "radio";
}
}
#endregion
public RadioButton ()
{
}

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ namespace Yavsc.Controllers
[Authorize(Roles="Admin")]
public ActionResult CreateUserBackup(DataAccess datac,string username)
{
throw new NotImplementedException();
throw new NotImplementedException();
}

View File

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

View File

@ -66,10 +66,12 @@ namespace Yavsc.ApiControllers
return result;
}
/// <summary>
/// Adds to basket, a product from the catalog, in the user's session.
/// </summary>
/// <returns>The to basket.</returns>
[HttpGet]
[Authorize]
public long AddToBasket (string title)
public long AddToBasket (string prodref,int count, object prodparams=null)
{
//TODO find the basket for Membership.GetUser().UserName
//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 Yavsc.Controllers;
using System.Collections.Generic;
using yavscModel.WorkFlow;
using WorkFlowProvider;
namespace Yavsc.Controllers
{
public class FrontOfficeController : Controller
{
[HttpGet]
public Estimate GetEstimate(long estid) {
return WFManager.GetEstimate (estid);
}
[AcceptVerbs("GET")]
public ActionResult Catalog ()
{

View File

@ -7,18 +7,14 @@
<link rel="stylesheet" href="/style.css"/>
<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'/>
<asp:ContentPlaceHolder id="init" runat="server"></asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="title" runat="server">
<title>
<%= Page.Title %>
<asp:Literal runat="server" Text=" - " /><%= YavscHelpers.SiteName %>
</title>
<asp:ContentPlaceHolder id="init" runat="server">
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder>
</head>
<body>
<header>
<div id="login">
<%= Html.ActionLink( YavscHelpers.SiteName, "Index", "Home" ) %>
<% if (Membership.GetUser()==null) { %>
<%= Html.ActionLink("Login", "Login", "Account", new { returnUrl=Request.Url.PathAndQuery }, null ) %>
@ -31,7 +27,7 @@
<%= Html.ActionLink( "Profile", "Profile", "Account" ) %>
<% } %>
<%= Html.ActionLink( "Accueil", "Index", "Home" ) %>
</div>
@ -41,10 +37,9 @@
<h1><a href="<%= Html.Encode(Request.Url.AbsoluteUri.ToString()) %>">
<%= Page.Title %>
</a>
<asp:Literal runat="server" Text=" - " />
<a href="/"> <%= YavscHelpers.SiteName %> </a>
</h1>
</a></h1>
</asp:ContentPlaceHolder>

View File

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

View File

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

View File

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