ViewUtils
Shared Utils shared between different Template Filters and Razor Views/Helpers
Assembly: ServiceStack.Common.dll
View Source
public static class ViewUtils
Properties
NavItemsKey
View Source
public static string NavItemsKey { get; set; }
NavItemsMapKey
View Source
public static string NavItemsMapKey { get; set; }
NavItems
View Source
public static List<NavItem> NavItems { get; }
NavItemsMap
View Source
public static Dictionary<string, List<NavItem>> NavItemsMap { get; }
Fields
ValidationSummaryCssClassNames
View Source
public static string ValidationSummaryCssClassNames
ValidationSuccessCssClassNames
View Source
public static string ValidationSuccessCssClassNames
Methods
Load(IAppSettings)
View Source
public static void Load(IAppSettings settings)
Parameters
Type | Name |
---|---|
ServiceStack.Configuration.IAppSettings | settings |
ShowNav(NavItem, HashSet<String>)
View Source
public static bool ShowNav(this NavItem navItem, HashSet<string> attributes)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.NavItem | navItem |
System.Collections.Generic.HashSet<System.String> | attributes |
GetNavItems(String)
View Source
public static List<NavItem> GetNavItems(string key)
Returns
System.Collections.Generic.List<ServiceStack.NavItem>
Parameters
Type | Name |
---|---|
System.String | key |
CssIncludes(IVirtualPathProvider, List<String>)
View Source
public static string CssIncludes(IVirtualPathProvider vfs, List<string> cssFiles)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.IO.IVirtualPathProvider | vfs |
System.Collections.Generic.List<System.String> | cssFiles |
JsIncludes(IVirtualPathProvider, List<String>)
View Source
public static string JsIncludes(IVirtualPathProvider vfs, List<string> jsFiles)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.IO.IVirtualPathProvider | vfs |
System.Collections.Generic.List<System.String> | jsFiles |
Nav(List<NavItem>, NavOptions)
Display a list of NavItem's
View Source
public static string Nav(List<NavItem> navItems, NavOptions options)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Collections.Generic.List<ServiceStack.NavItem> | navItems |
ServiceStack.NavOptions | options |
NavLink(NavItem, NavOptions)
Display a nav-link
nav-item
View Source
public static string NavLink(NavItem navItem, NavOptions options)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.NavItem | navItem |
ServiceStack.NavOptions | options |
NavLink(StringBuilder, NavItem, NavOptions)
Display a nav-link
nav-item
View Source
public static void NavLink(StringBuilder sb, NavItem navItem, NavOptions options)
Parameters
Type | Name |
---|---|
System.Text.StringBuilder | sb |
ServiceStack.NavItem | navItem |
ServiceStack.NavOptions | options |
NavButtonGroup(List<NavItem>, NavOptions)
View Source
public static string NavButtonGroup(List<NavItem> navItems, NavOptions options)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Collections.Generic.List<ServiceStack.NavItem> | navItems |
ServiceStack.NavOptions | options |
NavButtonGroup(NavItem, NavOptions)
View Source
public static string NavButtonGroup(NavItem navItem, NavOptions options)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.NavItem | navItem |
ServiceStack.NavOptions | options |
NavLinkButton(StringBuilder, NavItem, NavOptions)
View Source
public static void NavLinkButton(StringBuilder sb, NavItem navItem, NavOptions options)
Parameters
Type | Name |
---|---|
System.Text.StringBuilder | sb |
ServiceStack.NavItem | navItem |
ServiceStack.NavOptions | options |
IsNull(Object)
View Source
public static bool IsNull(object test)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Object | test |
GetDefaultCulture(DefaultScripts)
View Source
public static CultureInfo GetDefaultCulture(this DefaultScripts defaultScripts)
Returns
System.Globalization.CultureInfo
Parameters
Type | Name |
---|---|
ServiceStack.Script.DefaultScripts | defaultScripts |
GetDefaultTableClassName(DefaultScripts)
View Source
public static string GetDefaultTableClassName(this DefaultScripts defaultScripts)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Script.DefaultScripts | defaultScripts |
TextDump(Object)
View Source
public static string TextDump(this object target)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | target |
TextDump(Object, TextDumpOptions)
View Source
public static string TextDump(this object target, TextDumpOptions options)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | target |
ServiceStack.TextDumpOptions | options |
DumpTable(Object)
View Source
public static string DumpTable(this object target)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | target |
PrintDumpTable(Object)
View Source
public static void PrintDumpTable(this object target)
Parameters
Type | Name |
---|---|
System.Object | target |
DumpTable(Object, TextDumpOptions)
View Source
public static string DumpTable(this object target, TextDumpOptions options)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | target |
ServiceStack.TextDumpOptions | options |
PrintDumpTable(Object, TextDumpOptions)
View Source
public static void PrintDumpTable(this object target, TextDumpOptions options)
Parameters
Type | Name |
---|---|
System.Object | target |
ServiceStack.TextDumpOptions | options |
HtmlDump(Object)
View Source
public static string HtmlDump(object target)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | target |
HtmlDump(Object, HtmlDumpOptions)
View Source
public static string HtmlDump(object target, HtmlDumpOptions options)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Object | target |
ServiceStack.HtmlDumpOptions | options |
StyleText(String, TextStyle)
View Source
public static string StyleText(string text, TextStyle textStyle)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | text |
ServiceStack.TextStyle | textStyle |
HtmlHiddenInputs(IEnumerable<KeyValuePair<String, Object>>)
Emit HTML hidden input field for each specified Key/Value pair entry
View Source
public static string HtmlHiddenInputs(IEnumerable<KeyValuePair<string, object>> inputValues)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.Object>> | inputValues |
GetErrorStatus(IRequest)
View Source
public static ResponseStatus GetErrorStatus(IRequest req)
Returns
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
HasErrorStatus(IRequest)
View Source
public static bool HasErrorStatus(IRequest req)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
FormQuery(IRequest, String)
View Source
public static string FormQuery(IRequest req, string name)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | name |
FormQueryValues(IRequest, String)
View Source
public static string[] FormQueryValues(IRequest req, string name)
Returns
System.String[]
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | name |
FormValue(IRequest, String)
View Source
public static string FormValue(IRequest req, string name)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | name |
FormValue(IRequest, String, String)
View Source
public static string FormValue(IRequest req, string name, string defaultValue)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | name |
System.String | defaultValue |
FormValues(IRequest, String)
View Source
public static string[] FormValues(IRequest req, string name)
Returns
System.String[]
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | name |
FormCheckValue(IRequest, String)
View Source
public static bool FormCheckValue(IRequest req, string name)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | name |
GetParam(IRequest, String)
View Source
public static string GetParam(IRequest req, string name)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.String | name |
ToVarNames(String)
Comma delimited field names
View Source
public static List<string> ToVarNames(string fieldNames)
Returns
System.Collections.Generic.List<System.String>
Parameters
Type | Name |
---|---|
System.String | fieldNames |
ToStrings(String, Object)
View Source
public static IEnumerable<string> ToStrings(string filterName, object arg)
Returns
System.Collections.Generic.IEnumerable<System.String>
Parameters
Type | Name |
---|---|
System.String | filterName |
System.Object | arg |
ValidationSummary(ResponseStatus, String)
Show validation summary error message unless there's an error in exceptFor list of fields as validation errors will be displayed along side the field instead
View Source
public static string ValidationSummary(ResponseStatus errorStatus, string exceptFor)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.ResponseStatus | errorStatus |
System.String | exceptFor |
ValidationSummary(ResponseStatus, ICollection<String>, Dictionary<String, Object>)
View Source
public static string ValidationSummary(ResponseStatus errorStatus, ICollection<string> exceptFields, Dictionary<string, object> divAttrs)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.ResponseStatus | errorStatus |
System.Collections.Generic.ICollection<System.String> | exceptFields |
System.Collections.Generic.Dictionary<System.String,System.Object> | divAttrs |
ValidationSuccess(String, Dictionary<String, Object>)
Display a "Success Alert Box"
View Source
public static string ValidationSuccess(string message, Dictionary<string, object> divAttrs)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | message |
System.Collections.Generic.Dictionary<System.String,System.Object> | divAttrs |
ErrorResponseExcept(ResponseStatus, String)
Return an error message unless there's an error in fieldNames
View Source
public static string ErrorResponseExcept(ResponseStatus errorStatus, string fieldNames)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.ResponseStatus | errorStatus |
System.String | fieldNames |
ErrorResponseExcept(ResponseStatus, ICollection<String>)
View Source
public static string ErrorResponseExcept(ResponseStatus errorStatus, ICollection<string> fieldNames)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.ResponseStatus | errorStatus |
System.Collections.Generic.ICollection<System.String> | fieldNames |
ErrorResponseSummary(ResponseStatus)
Return an error message unless there are field errors
View Source
public static string ErrorResponseSummary(ResponseStatus errorStatus)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.ResponseStatus | errorStatus |
ErrorResponse(ResponseStatus, String)
Return an error for the specified field (if any)
View Source
public static string ErrorResponse(ResponseStatus errorStatus, string fieldName)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.ResponseStatus | errorStatus |
System.String | fieldName |
ToKeyValues(Object)
View Source
public static List<KeyValuePair<string, string>> ToKeyValues(object values)
Returns
System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String,System.String>>
Parameters
Type | Name |
---|---|
System.Object | values |
SplitStringList(IEnumerable)
View Source
public static List<string> SplitStringList(IEnumerable strings)
Returns
System.Collections.Generic.List<System.String>
Parameters
Type | Name |
---|---|
System.Collections.IEnumerable | strings |
ToStringList(IEnumerable)
View Source
public static List<string> ToStringList(IEnumerable strings)
Returns
System.Collections.Generic.List<System.String>
Parameters
Type | Name |
---|---|
System.Collections.IEnumerable | strings |
FormControl(IRequest, Dictionary<String, Object>, String, InputOptions)
View Source
public static string FormControl(IRequest req, Dictionary<string, object> args, string tagName, InputOptions inputOptions)
Returns
System.String
Parameters
Type | Name |
---|---|
ServiceStack.Web.IRequest | req |
System.Collections.Generic.Dictionary<System.String,System.Object> | args |
System.String | tagName |
ServiceStack.InputOptions | inputOptions |
GetBundleFiles(String, IVirtualPathProvider, IVirtualPathProvider, IEnumerable<String>, String)
View Source
public static IEnumerable<IVirtualFile> GetBundleFiles(string filterName, IVirtualPathProvider webVfs, IVirtualPathProvider contentVfs, IEnumerable<string> virtualPaths, string assetExt)
Returns
System.Collections.Generic.IEnumerable<ServiceStack.IO.IVirtualFile>
Parameters
Type | Name |
---|---|
System.String | filterName |
ServiceStack.IO.IVirtualPathProvider | webVfs |
ServiceStack.IO.IVirtualPathProvider | contentVfs |
System.Collections.Generic.IEnumerable<System.String> | virtualPaths |
System.String | assetExt |
BundleJs(String, IVirtualPathProvider, IVirtualPathProvider, ICompressor, BundleOptions)
View Source
public static string BundleJs(string filterName, IVirtualPathProvider webVfs, IVirtualPathProvider contentVfs, ICompressor jsCompressor, BundleOptions options)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | filterName |
ServiceStack.IO.IVirtualPathProvider | webVfs |
ServiceStack.IO.IVirtualPathProvider | contentVfs |
ServiceStack.ICompressor | jsCompressor |
ServiceStack.BundleOptions | options |
BundleCss(String, IVirtualPathProvider, IVirtualPathProvider, ICompressor, BundleOptions)
View Source
public static string BundleCss(string filterName, IVirtualPathProvider webVfs, IVirtualPathProvider contentVfs, ICompressor cssCompressor, BundleOptions options)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | filterName |
ServiceStack.IO.IVirtualPathProvider | webVfs |
ServiceStack.IO.IVirtualPathProvider | contentVfs |
ServiceStack.ICompressor | cssCompressor |
ServiceStack.BundleOptions | options |
BundleHtml(String, IVirtualPathProvider, IVirtualPathProvider, ICompressor, BundleOptions)
View Source
public static string BundleHtml(string filterName, IVirtualPathProvider webVfs, IVirtualPathProvider contentVfs, ICompressor htmlCompressor, BundleOptions options)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | filterName |
ServiceStack.IO.IVirtualPathProvider | webVfs |
ServiceStack.IO.IVirtualPathProvider | contentVfs |
ServiceStack.ICompressor | htmlCompressor |
ServiceStack.BundleOptions | options |