diff --git a/src/Orchard.Web/Modules/Orchard.DevTools/Controllers/HomeController.cs b/src/Orchard.Web/Modules/Orchard.DevTools/Controllers/HomeController.cs index 0c200bd41..d0650ed2b 100644 --- a/src/Orchard.Web/Modules/Orchard.DevTools/Controllers/HomeController.cs +++ b/src/Orchard.Web/Modules/Orchard.DevTools/Controllers/HomeController.cs @@ -54,7 +54,18 @@ namespace Orchard.DevTools.Controllers { return View("Simple", new Simple { Title = "This is not themed", Quantity = 5 }); } - + public ActionResult FormShapes() { + var model = Shape.Form(Submit: Shape.FormSubmit(Text: T("Finish Setup"))) + .Fieldsets(Shape.Zone(typeof (Array), Name: "Fieldsets")); + + model.Fieldsets.Add(Shape.InputText(Name: "SiteName", Text: T("Site Name"), Value: T("some default/pre-pop value..."))); + model.Fieldsets.Add(Shape.InputText(Name: "AdminUsername", Text: T("Admin Username"))); + model.Fieldsets.Add(Shape.InputPassword(Name: "AdminPassword", Text: T("Admin Password"))); + + model.Fieldsets[0].Attributes(new {autofocus = "autofocus"}); // <-- could be applied by some other behavior - need to be able to modify attributes instead of clobbering them like this + + return View(model); + } public ActionResult UsingShapes() { diff --git a/src/Orchard.Web/Modules/Orchard.DevTools/Orchard.DevTools.csproj b/src/Orchard.Web/Modules/Orchard.DevTools/Orchard.DevTools.csproj index f74e91ce1..d11d768b7 100644 --- a/src/Orchard.Web/Modules/Orchard.DevTools/Orchard.DevTools.csproj +++ b/src/Orchard.Web/Modules/Orchard.DevTools/Orchard.DevTools.csproj @@ -125,6 +125,7 @@ + diff --git a/src/Orchard.Web/Modules/Orchard.DevTools/Views/Home/FormShapes.cshtml b/src/Orchard.Web/Modules/Orchard.DevTools/Views/Home/FormShapes.cshtml new file mode 100644 index 000000000..6cbd6510e --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.DevTools/Views/Home/FormShapes.cshtml @@ -0,0 +1,3 @@ +
+ the form -> @Display(Model) +
diff --git a/src/Orchard/Mvc/Html/Shapes.cs b/src/Orchard/Mvc/Html/Shapes.cs index 2778f5ade..878cb2784 100644 --- a/src/Orchard/Mvc/Html/Shapes.cs +++ b/src/Orchard/Mvc/Html/Shapes.cs @@ -1,6 +1,5 @@ using System.Web; using System.Web.Mvc; -using System.Web.Routing; using ClaySharp; using Orchard.DisplayManagement; @@ -19,5 +18,28 @@ namespace Orchard.Mvc.Html { tagBuilder.MergeAttribute("src", Url); return Display(new HtmlString(tagBuilder.ToString(TagRenderMode.SelfClosing))); } + + #region form and company + + public IHtmlString Form(dynamic Display, dynamic Shape, object Submit) { + return Display(new HtmlString("
" + Display(Shape.Fieldsets, Submit).ToString() + "
")); + } + + public IHtmlString FormSubmit(dynamic Display, dynamic Shape) { + return Display(new HtmlString("")); + } + + public IHtmlString InputPassword(dynamic Display, dynamic Shape) { + return Display(new HtmlString("")); + } + + public IHtmlString InputText(dynamic Display, dynamic Shape, INamedEnumerable Attributes) { + // not optimal obviously, just testing the waters + return Display(new HtmlString("" + + "")); // <- otherwise Shape.Value is "ClaySharp.Clay" + } + + #endregion } }