Beispiel #1
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            if (OnAdd == null)
            {
                OnAdd = "dodaj";
            }
            if (OnDelete == null)
            {
                OnDelete = "obrisi";
            }
            if (Disabled == null)
            {
                Disabled = "tableDisabled";
            }
            if (Filter == null)
            {
                Filter = "true";
            }
            if (Columns == null)
            {
                Columns = "columns";
            }
            if (OnRowchanged == null)
            {
                OnRowchanged = "rowChanged";
            }

            var sb = new StringBuilder();

            var columnWidth = "col-md-6";

            //var classAttribute = output.Attributes["class"];
            //if (classAttribute != null)
            if (output.Attributes.ContainsName("class"))
            {
                columnWidth = output.Attributes["class"].Value.ToString();
            }

            sb.AppendLine($"<div class=\"{columnWidth}\">");
            sb.AppendLine($"    <bs-panel class=\"panel-body-with-table\">");
            sb.AppendLine($"        <div class=\"heading\">");
            sb.AppendLine($"            <div class=\"pull-right\">");
            sb.AppendLine($"                <button-add (add)=\"{OnAdd}()\" [disabled]=\"{Disabled}()\"></button-add>");
            sb.AppendLine($"                <button-delete (delete)=\"{OnDelete}()\" [disabled]=\"{Disabled}()\"></button-delete>");
            sb.AppendLine($"            </div>");
            sb.AppendLine("            <h4>{{title}}</h4>");
            sb.AppendLine($"        </div>");
            sb.AppendLine($"        <div class=\"body\">");
            sb.AppendLine($"            <scrollable-table [filter]=\"{Filter}\"");
            sb.AppendLine($"                  [columns]=\"{Columns}\"");
            sb.AppendLine($"                  (rowChanged)=\"{OnRowchanged}($event)\"");
            sb.AppendLine($"                  [disabled]=\"{Disabled}()\">");
            sb.AppendLine($"            </scrollable-table>");
            sb.AppendLine($"        </div>");
            sb.AppendLine($"    </bs-panel>");
            sb.AppendLine($"</div>");

            TagHelperUtil.Output(output, sb);
        }
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            var sb = new StringBuilder();

            var labelText = TagHelperUtil.DisplayName(For);
            var fieldName = TagHelperUtil.FieldName(For);

            sb.AppendLine($"<field  label=\"{labelText}\" [inputControl]=\"formGroup.controls.{fieldName}\" >");
            sb.AppendLine($"    <input formControlName=\"{fieldName}\" />");
            //sb.AppendLine($"    <input formControlName=\"{fieldName}\" [(ngModel)]=\"formRow.{fieldName}\" />");
            sb.AppendLine($"</field>");

            TagHelperUtil.Output(output, sb);
        }