public override void Process(TagHelperContext?context, TagHelperOutput output)
        {
            Url ??= $"~/Lookup/{Handler}";
            Title ??= Resource.ForLookup(Handler !);

            base.Process(context, output);
        }
Example #2
0
        public override void Process(TagHelperContext?context, TagHelperOutput output)
        {
            output.TagName = null;

            Int32? accountId  = ViewContext?.HttpContext.User.Id();
            String?area       = Area ?? ViewContext?.RouteData.Values["area"] as String;
            String?action     = Action ?? ViewContext?.RouteData.Values["action"] as String;
            String?controller = Controller ?? ViewContext?.RouteData.Values["controller"] as String;

            if (Authorization?.IsGrantedFor(accountId, area, controller, action) == false)
            {
                output.SuppressOutput();
            }
        }
Example #3
0
        public override void Process(TagHelperContext?context, TagHelperOutput output)
        {
            if (output.Attributes["autocomplete"] == null)
            {
                output.Attributes.Add("autocomplete", "off");
            }

            if (output.Attributes["class"] == null)
            {
                output.Attributes.Insert(0, new TagHelperAttribute("class", "form-control"));
            }
            else
            {
                output.Attributes.SetAttribute("class", $"form-control {output.Attributes["class"].Value}");
            }
        }
        public override void Process(TagHelperContext?context, TagHelperOutput output)
        {
            Url = Url?.StartsWith("~") == true?UrlFactory(ViewContext).Content(Url) : Url;

            For = LookupName ?? Lookup?.Name;
            Value ??= Lookup?.Model;

            WriteAttributes(output);
            WriteValues(output);
            WriteControl(output);

            if (Browser != false)
            {
                WriteBrowser(output);
            }
        }
Example #5
0
        public override void Process(TagHelperContext?context, TagHelperOutput output)
        {
            String  treeClasses = "mvc-tree";
            MvcTree tree        = For?.Model as MvcTree ?? new MvcTree();

            if (Readonly)
            {
                treeClasses += " mvc-tree-readonly";
            }

            output.Content.AppendHtml(IdsFor(tree));
            output.Content.AppendHtml(ViewFor(tree));

            output.Attributes.SetAttribute("data-for", $"{For?.Name}.SelectedIds");
            output.Attributes.SetAttribute("class", $"{treeClasses} {output.Attributes["class"]?.Value}".Trim());
        }
Example #6
0
        public override void Process(TagHelperContext?context, TagHelperOutput output)
        {
            TagBuilder require = new TagBuilder("span");

            require.Attributes["class"] = "require";

            if (Required == true)
            {
                require.InnerHtml.Append("*");
            }

            if (Required == null && For?.Metadata.IsRequired == true && For?.Metadata.ModelType != typeof(Boolean))
            {
                require.InnerHtml.Append("*");
            }

            output.Content.AppendHtml(require);
        }
Example #7
0
        public override void Process(TagHelperContext?context, TagHelperOutput output)
        {
            if (For?.Metadata.ModelType == typeof(Boolean))
            {
                return;
            }

            if (output.Attributes["autocomplete"] == null)
            {
                output.Attributes.Add("autocomplete", "off");
            }

            if (output.Attributes["class"] == null)
            {
                output.Attributes.Insert(0, new TagHelperAttribute("class", "form-control"));
            }
            else
            {
                output.Attributes.SetAttribute("class", $"form-control {output.Attributes["class"].Value}");
            }
        }
        public override void Process(TagHelperContext?context, TagHelperOutput output)
        {
            String path = FormPath();

            if (!Styles.ContainsKey(path))
            {
                Styles[path] = null;

                if (ScriptsAvailable(path))
                {
                    Styles[path] = UrlFactory(ViewContext).Content($"~/css/application/{path}");
                }
            }

            if (Styles[path] == null)
            {
                output.TagName = null;
            }
            else
            {
                output.Attributes.SetAttribute("href", Styles[path]);
            }
        }
 public override void Process(TagHelperContext?context, TagHelperOutput output)
 {
     output.Attributes.Add("placeholder", For?.Metadata.DisplayName);
 }