There's now a project FubuMVC.UI in the reboot branch for HTML
generation and conventions. For Dovetail work, we are starting to
move away from our original "TextboxFor" / "DropdownFor" semi-
hardcoded expressions to something more like Jimmy Bogard's
"InputFor" / "LabelFor" / "DisplayFor" convention driven HTML
helpers. To that end, I've started work on the the barebones
architecture for this in Fubu.
The key point is that the Fubu mechanics work by progressively
building up the HtmlTag model.
Here's a quick sample of what the HTML convention definition may look
like:
public class TestHtmlConventions : HtmlConventionRegistry
{
public TestHtmlConventions()
{
Editors.IfPropertyIs<string>().UseTextbox();
Editors.IfPropertyIs<bool>().BuildBy(req => new CheckboxTag
(req.Value<bool>()));
Editors.AddClassForAttribute<FakeRequiredAttribute>
("required");
Editors.ModifyForAttribute<FakeMaximumStringLength>((tag,
att) => tag.Attr("maxlength", att.MaxLength));
Labels.Always.BuildBy(req => new HtmlTag("span").Text
(req.Accessor.Name));
Labels.Always.AddClass("label");
Displays.Always.BuildBy(req => new HtmlTag("span").Text
(req.StringValue()));
}
}
I need a blog post on this stuff, but I think I'm ready for some
feedback on the approach.
--
You received this message because you are subscribed to the Google Groups "FubuMVC Development Group" group.
To post to this group, send email to fubumv...@googlegroups.com.
To unsubscribe from this group, send email to fubumvc-deve...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fubumvc-devel?hl=en.