public static IHtmlContent Column <T, TValue>(this IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp)
        {
            var id = RazorUtils.GetColumnId(exp);

            helper.AddText(StringType.Column, id);
            return(helper.Raw(TextProvider.Column(id)));
        }
        public static PageHeaderModel HeaderModel(this IHtmlHelper helper)
        {
            PageHeaderModel model = helper.GetViewData <PageHeaderModel>();

            if (model == null)
            {
                model = new PageHeaderModel
                {
                    Title     = helper.GetPageTitle(),
                    AddButton = null,
                };

                if (helper.GetViewParams().ListUrl != null)
                {
                    string id = RazorUtils.UrlToPageId(helper.GetViewParams().ListUrl);
                    model.ListBreadCrumb = new BreadCrumbModel
                    {
                        Title = helper.Page(id),
                        Link  = helper.GetViewParams().ListUrl
                    };
                }

                string addUrl = helper.GetViewParams().AddUrl;
                if (addUrl != null)
                {
                    model.AddButton         = helper.AddButton(addUrl);
                    model.EmbeddedAddButton = helper.AddButton(addUrl, "buttonGra-sm");
                    model.IsListPage        = true;
                }
                helper.SetViewData(model);
            }
            return(model);
        }
        public static PageOptions Config(this IHtmlHelper helper)
        {
            PageOptions conf = helper.GetViewData <PageOptions>();

            helper.GetModelTypeName();
            if (conf == null)
            {
                conf = new PageOptions();
                helper.SetViewData(conf);
            }
            else
            {
                if (conf.ViewParams.AddUrl != null)
                {
                    conf.ViewParams.AddUrl = RazorUtils.ApplyConvension(conf.ViewParams.AddUrl, AppParts.Route);
                }
                if (conf.ViewParams.EditUrl != null)
                {
                    conf.ViewParams.EditUrl = RazorUtils.ApplyConvension(conf.ViewParams.EditUrl, AppParts.Route);
                }
                if (conf.ViewParams.DetailsUrl != null)
                {
                    conf.ViewParams.DetailsUrl = RazorUtils.ApplyConvension(conf.ViewParams.DetailsUrl, AppParts.Route);
                }
                if (conf.ViewParams.ListUrl != null)
                {
                    conf.ViewParams.ListUrl = RazorUtils.ApplyConvension(conf.ViewParams.ListUrl, AppParts.Route);
                }
            }
            return(conf);
        }
Example #4
0
        public virtual IHtmlContent GetInputControl(string componentName)
        {
            InputModel.Attributes += AddInputControlAttributes();
            InputModel.Attributes += RazorUtils.ToAttributeString(InputModel.AttributeObject);
            InputModel.Attributes += RazorUtils.ToAttributeStringDynamic(InputModelExtraAttrs);
            string template = Helper.GetTheme().GetInputControl(componentName);

            return(Partial(template, InputModel));
        }
Example #5
0
        public Accessibility Process <T, TValue>(IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp, string cont, string extra = null)
        {
            string id = RazorUtils.GetIdentifier(exp);

            if (extra != null)
            {
                id += extra;
            }
            return(Process(helper, id, cont.ToString()));
        }
Example #6
0
        public virtual void UseExpression <T, TValue>(Expression <Func <T, TValue> > exp)
        {
            string groupName = "FG_" + RazorUtils.GetMemberName(exp).Replace(".", "_");

            InputModel = new NgInput
            {
                MemberName  = RazorUtils.GetMemberName(exp),
                NgModelName = Helper.GetModelName(),
                NgFormName  = Helper.GetFormName(),
                GroupName   = groupName
            };
        }
        public static void AddBreadCrumb <T>(this IHtmlHelper <T> helper, string url, IHtmlContent title = null)
        {
            var Provider = helper.GetService <IGeneralHelper>();

            var pageId = RazorUtils.UrlToPageId(url);
            var mod    = new BreadCrumbModel
            {
                Title = title ?? helper.Page(pageId),
                Link  = url
            };

            helper.HeaderModel().BreadCrums.Add(mod);
        }
Example #8
0
 public virtual IHtmlContent Write(string componentName, bool localizable = false)
 {
     if (InputModel != null)
     {
         InputModel.Attributes += AddInputControlAttributes();
         InputModel.Attributes += RazorUtils.ToAttributeString(InputModel.AttributeObject);
         return(Partial(Helper.GetTheme().GetTemplate(componentName), InputModel));
     }
     else if (Model != null)
     {
         return(Partial(Helper.GetTheme().GetTemplate(componentName), InputModel));
     }
     return(Partial(Helper.GetTheme().GetTemplate(componentName)));
 }
Example #9
0
        public Accessibility ProcessCell <T, TValue>(IHtmlHelper <T> helper, Expression <Func <T, TValue> > exp, string cont, MoldsterHtmlContainer parent = null)
        {
            string id = RazorUtils.GetIdentifier(exp);

            return(ProcessCell(helper, id, cont, parent));
        }
 public static string ButtonClass(this IHtmlHelper helper, BtnClass cls)
 {
     return(RazorUtils.GetButtonClass(cls));
 }
 public static IHtmlContent Property <T, TValue>(this IHtmlHelper <T> helper, Expression <Func <T, TValue> > expression, string modelName = null)
 {
     modelName = modelName ?? helper.GetModelName();
     return(new HtmlString(modelName + "." + RazorUtils.GetMemberName(expression)));
 }