Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create inline helper overloads for IFieldConfiguration methods that take a IHtmlString #136

Closed
fsateler opened this issue Nov 10, 2015 · 1 comment

Comments

@fsateler
Copy link
Contributor

For example, for Append, OverrideFieldHtml, InlineLabel and others it can be very useful to use the following:

s.FieldFor(p => p.Prop).OverrideFieldHtml(@<span>Inline html <u>here</u>!</span>)

The implementation is simple:

public IFieldConfiguration OverrideFieldHtml(this IFieldConfiguration src, Func<object,IHtmlString> genHtml) {
    return src.OverrideFieldHtml(genHtml(null));
}
@fsateler fsateler changed the title Wish: Provide Func<object, IHtmlString> overloads/extensions for methods taking an IHtmlString Wish: Provide Func<object, IHtmlString> overloads/extensions for methods taking an IHtmlString Nov 10, 2015
@robdmoore
Copy link
Member

Cool idea! More than happy to accept pull requests for this.

@robdmoore robdmoore changed the title Wish: Provide Func<object, IHtmlString> overloads/extensions for methods taking an IHtmlString Create inline helper overloads for IFieldConfiguration methods that take a IHtmlString Nov 10, 2015
fsateler added a commit to fsateler/ChameleonForms that referenced this issue Sep 30, 2016
…lString>

This allows using constructs like:

    section.FieldFor(a => a.Property).WithHint(@<span>Inline html <u>here</u>!</span>)

Fixes: MRCollective#136
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants