HTML Conventions

31 views
Skip to first unread message

Jeremy Miller

unread,
Jan 10, 2010, 1:03:23 PM1/10/10
to FubuMVC Development Group
Everybody,

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.

Rob G

unread,
Jan 10, 2010, 1:24:49 PM1/10/10
to fubumvc-devel
I'll give it a spin on the work I'm doing and let you know how it goes. Not that you'll be able to change it yet (given your upcoming week), but from my side at least, it looks pretty good on the face of it.

Cheers,
Rob

--
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.




Marcos Matos

unread,
Jan 10, 2010, 7:40:56 PM1/10/10
to fubumv...@googlegroups.com
I really like the ideia of using a set of conventions to configure the way the html helpers works is really cool! It allows the fine tuning of the way your views work without losing the tersenes of the editor/display helpers. Fubu is looking pretty good =)

--
Marcos Castilho da Costa Matos
Reply all
Reply to author
Forward
0 new messages