This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CustomSparkActivator: IActivator | |
| { | |
| private readonly ISparkViewEngine _engine; | |
| public AlsSparkActivator(ISparkViewEngine engine) | |
| { | |
| _engine = engine; | |
| } | |
| public void Activate(IEnumerable<IPackageInfo> packages, IPackageLog log) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SparkPolicyRunner : IActivator | |
| { | |
| private readonly ISparkViewEngine _engine; | |
| private readonly IEnumerable<ISparkPolicy> _policies; | |
| public SparkPolicyRunner(ISparkViewEngine engine, IEnumerable<ISparkPolicy> policies) | |
| { | |
| _engine = engine; | |
| _policies = policies; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ShortCircuitFieldRule : IFieldValidationRule | |
| { | |
| private readonly IFieldValidationRule _inner; | |
| public ShortCircuitFieldRule(IFieldValidationRule inner) | |
| { | |
| _inner = inner; | |
| } | |
| public void Validate(Accessor accessor, ValidationContext context) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function ($) { | |
| $.fubuvalidation.Processor.findElementsWith(function(context) { | |
| if (context.element) { | |
| return; | |
| } | |
| var element = $("#" + context.key, context.form); | |
| if (element.size() == 0) { | |
| return; | |
| } | |
| context.element = element; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.fn.activateAjaxForms = $.fn.activateAjaxForms || function () { | |
| return this.each(function () { | |
| var container = $(this); | |
| $('form.validated-form', container).each(function () { | |
| var mode = $(this).data('validationMode'); | |
| $(this).validate({ | |
| ajax: mode == 'ajax', | |
| continuationSuccess: function (continuation) { | |
| continuation.form.trigger('validation:success', continuation); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AlterSettings<ValidationSettings>(e => | |
| { | |
| e.ForInputTypesMatching(x => true, | |
| x => | |
| { | |
| x.Clear(); | |
| x.RegisterStrategy(RenderingStrategies.Highlight); | |
| // TODO: PLUG IN CUSTOM STRATEGIES | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class FormValidationSummaryModifier : ITagModifier<FormRequest> | |
| { | |
| public bool Matches(FormRequest token) | |
| { | |
| return token.Chain.ValidationNode().Contains(RenderingStrategies.Summary); | |
| } | |
| public void Modify(FormRequest request) | |
| { | |
| var summary = request.Services.GetInstance<IPartialInvoker>().Invoke<ValidationSummary>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| context.Notification.RegisterMessage(accessor, ValidationKeys.Required); |