예제 #1
0
        /// <summary>
        /// Odropdown Awesome Mod
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="ahtml"></param>
        /// <param name="prop"></param>
        /// <param name="setCfg"></param>
        /// <returns></returns>
        public static AjaxRadioList <T> Odropdown <T>(this AwesomeHtmlHelper <T> ahtml, string prop, Action <OdropdownCfg> setCfg = null)
        {
            var res   = ahtml.AjaxRadioList(prop).Mod("awem.odropdown");
            var odcfg = new OdropdownCfg();

            if (setCfg != null)
            {
                setCfg(odcfg);
                res.Tag(odcfg.ToTag());
            }

            return(res);
        }
예제 #2
0
        /// <summary>
        /// Set the defaults for awem.js and jquery.validate (if present) by calling utils.init;
        /// sets date format, first day of week, decimal separator, isMobileOrTablet
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="ahtml"></param>
        /// <returns></returns>
        public static IHtmlString Init <T>(this AwesomeHtmlHelper <T> ahtml)
        {
            var isMobileOrTablet = Autil.IsMobileOrTablet(ahtml) ? 1 : 0;
            var dateFormat       = AweUtil.ConvertTojQueryDateFormat(Autil.CurrentCulture().DateTimeFormat.ShortDatePattern);
            var decimalSep       = Autil.CurrentCulture().NumberFormat.NumberDecimalSeparator;

            var sb = new StringBuilder("<script>");

            sb.AppendFormat("awem.isMobileOrTablet = function() {{ return {0}; }};", isMobileOrTablet);
            sb.AppendFormat("awem.fdw = {0};", (int)Autil.CurrentCulture().DateTimeFormat.FirstDayOfWeek);
            sb.AppendFormat("utils.init('{0}', {1}, '{2}')", dateFormat, isMobileOrTablet, decimalSep);
            sb.Append("</script>");

            return(new HtmlString(sb.ToString()));
        }
예제 #3
0
 internal static bool IsMobileOrTablet <T>(AwesomeHtmlHelper <T> ahtml)
 {
     return(MobileUtils.IsMobileOrTablet());
 }