Skip to content

Instantly share code, notes, and snippets.

public static class RequestDataHelper
{
[MarkedForTermination("Use FubuMVC.Core.AjaxExtensions.IsAjaxRequest when updating FubuMVC.Core to latest or kill this when support for IE7 gets dropped.")]
public static bool IsAjaxRequest(IRequestData requestData)
{
var result = false;
requestData.Value(AjaxExtensions.XRequestedWithHeader, delegate(BindingValue value)
{
result = value.RawValue.isAjaxRequest();
});
(function ($) {
$.fubuvalidation.Processor.findElementsWith(function(context) {
var element = $("#" + context.key, context.form);
if (element.size() == 0) {
return;
}
context.element = element;
});
$.fubuvalidation.Processor.findElementsWith(function(context) {
var element = $("[name=" + context.key + "]", context.form);
(function ($) {
$.fubuvalidation.Processor.findElementsWith(function(context) {
if (context.element) {
return;
}
var element = $("#" + context.key, context.form);
if (element.size() == 0) {
return;
}
context.element = element;
public class ShortCircuitFieldRule : IFieldValidationRule
{
private readonly IFieldValidationRule _inner;
public ShortCircuitFieldRule(IFieldValidationRule inner)
{
_inner = inner;
}
public void Validate(Accessor accessor, ValidationContext context)
public class SparkPolicyRunner : IActivator
{
private readonly ISparkViewEngine _engine;
private readonly IEnumerable<ISparkPolicy> _policies;
public SparkPolicyRunner(ISparkViewEngine engine, IEnumerable<ISparkPolicy> policies)
{
_engine = engine;
_policies = policies;
public class CustomSparkActivator: IActivator
{
private readonly ISparkViewEngine _engine;
public AlsSparkActivator(ISparkViewEngine engine)
{
_engine = engine;
}
public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log)
public class AppHtmlConventions : HtmlConventionRegistry
{
public AppHtmlConventions()
{
//...
Editors
.If(def => // Condition)
.Modify((e, tag) => tag.Attr("value", e.RawValue.ToString()));
//...
}
public class AppRegistry : FubuRegistry
{
public AppRegistry()
{
//..
HtmlConvention(x =>
{
x.Editors
.If(def => // Condition)
using System;
using System.Collections.Generic;
using FubuCore.Reflection;
using FubuMVC.Core.UI.Configuration;
using HtmlTags;
using MyProject.Core.Infrastructure.Extensions;
namespace MyProject.Core.Infrastructure.Fubu.HtmlConventions
{
public class EnumRadioButtonListEditor : ElementBuilder
public class SomeRule : IValidationRule
{
private readonly ISomeService _service;
public SomeRule(ISomeService service)
{
_service = service;
}