public static IHtmlString ParsleyMessage(this System.Web.WebPages.Html.HtmlHelper htmlHelper, string category, string key, string dataParsleyKey, params object[] args) { var message = Localize(category, key); if (string.IsNullOrEmpty(message)) { return(new HtmlString("")); } if (args.Length > 0) { message = Format(message, category, key, args); } message = string.Format("data-parsley-{0}=\"{1}\"", dataParsleyKey, message); return(new HtmlString(HttpUtility.HtmlDecode(message))); }
public static IHtmlString HelpBubble(this System.Web.WebPages.Html.HtmlHelper htmlHelper, string category, string key, params object[] args) { var helpText = Localize(category, key); if (string.IsNullOrEmpty(helpText)) { return(new HtmlString("")); } if (args.Length > 0) { helpText = Format(helpText, category, key, args); } return(new HtmlString(string.Format(@"data-toggle=""popover"" data-container=""body"" data-trigger=""focus"" data-content=""<div class='multiline-message'><span class='multiline-message-icon fa fa-comment-o fa-lg'></span>{0}</div>""", helpText))); }
public static IHtmlString Markdown(this System.Web.WebPages.Html.HtmlHelper helper, string text) { var hash = text.GetHashCode().ToString(); var cachedEntry = WebCache.Get(hash) as HtmlString; if (cachedEntry != null) { return(cachedEntry); } // Transform the supplied text (Markdown) into HTML. string html = MarkdownTransformer.Transform(text); // Wrap the html in an MvcHtmlString otherwise it'll be HtmlEncoded and displayed to the user as HTML :( var result = new HtmlString(html); WebCache.Set(hash, result); return(result); }
public static IHtmlString LazyFunction(this System.Web.WebPages.Html.HtmlHelper htmlHelper, string name, object parameters, string className = null, string loaderClassName = null) { //TODO: add function that collect all current razor function parameters and pass to lazy. ? //TODO: render directly in preview mode var lazyPartialProvider = ServiceLocator.GetService <ILazyFunctionCallDataProvider>(); Debug.Assert(lazyPartialProvider != null, nameof(lazyPartialProvider) + " != null"); var protectedFunctionCall = lazyPartialProvider.ProtectFunctionCall(name, Functions.ObjectToDictionary(parameters) .Where(d => d.Value != null) .ToDictionary(d => d.Key, d => d.Value.ToString())); return(new HtmlString( new XElement("div", new XAttribute("class", className ?? "text-center text-muted js-loading"), new XAttribute("data-oc-controller", "General.Lazy"), new XAttribute("data-request", protectedFunctionCall), new XElement("span", new XAttribute("class", loaderClassName ?? "fa fa-spin fa-circle-o-notch fa-2x")) ).ToString())); }
/// <summary> /// Localizes the strings from Razor using specified key. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="htmlHelper"></param> /// <param name="category">The category.</param> /// <param name="key">The key.</param> /// <param name="args"></param> /// <returns></returns> public static string Localized(this System.Web.WebPages.Html.HtmlHelper htmlHelper, string category, string key, params object[] args) { return(Localized(category, key, args)); }
/// <summary> /// Localizes the strings from Razor using specified key. /// </summary> /// <param name="htmlHelper"></param> /// <param name="category">The category.</param> /// <param name="key">The key.</param> /// <returns></returns> public static string Localize(this System.Web.WebPages.Html.HtmlHelper htmlHelper, string category, string key) { return(Localize(category, key)); }
public static IHtmlString LazyFunction(this System.Web.WebPages.Html.HtmlHelper htmlHelper, string name, string className = null, string loaderClassName = null) { return(LazyFunction(htmlHelper, name, new { }, className, loaderClassName)); }
public static HtmlHelper GetMvcHtmlHelper(this System.Web.WebPages.Html.HtmlHelper html) { return(((System.Web.Mvc.WebViewPage)WebPageContext.Current.Page).Html); }
public static HtmlHelper <TModel> GetPageHelper <TModel>(this System.Web.WebPages.Html.HtmlHelper html) { return(((System.Web.Mvc.WebViewPage <TModel>)WebPageContext.Current.Page).Html); }
public static UrlHelper GetUrlHelper(this System.Web.WebPages.Html.HtmlHelper html) { return(((WebViewPage)WebPageContext.Current.Page).Url); }
public static HtmlHelper <object> GetPageHelper(this System.Web.WebPages.Html.HtmlHelper html) { return(((WebViewPage)WebPageContext.Current.Page).Html); }
/// <summary> /// Localizes the strings from Razor using specified key. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="htmlHelper"></param> /// <param name="category">The category.</param> /// <param name="key">The key.</param> /// <param name="args"></param> /// <returns></returns> public static string Localized(this System.Web.WebPages.Html.HtmlHelper htmlHelper, string category, string key, params object[] args) { var formatter = Localize(htmlHelper, category, key); return(Format(formatter, category, key, args)); }
public static string UniqueId(this System.Web.WebPages.Html.HtmlHelper html) { //Contract.Ensures( !String.IsNullOrEmpty( //Contract.Result<string>() ) ); return(uniqueid()); }