Exemple #1
0
 private void addCustomLabel(ViewLabelExpression <VIEWMODEL> label)
 {
     if (_labelDisplay.IsNotEmpty())
     {
         label.CustomLabel(_labelDisplay);
     }
 }
Exemple #2
0
        public HtmlTag ToHtmlTag()
        {
            _htmlRoot = new HtmlTag("div");
            _htmlRoot.AddClass(_noClear ? "view_root_no_clear" : "view_root");

            _htmlRoot = new HtmlTag("div").AddClass("view_root");
            if (_rootId.IsNotEmpty())
            {
                _htmlRoot.Id(_rootId);
            }
            if (_rootClasses != null && _rootClasses.Any())
            {
                _htmlRoot.AddClasses(_rootClasses);
            }
            ViewLabelExpression <VIEWMODEL>   labelBuilder   = new ViewLabelExpression <VIEWMODEL>(_generator, _expression);
            ViewDisplayExpression <VIEWMODEL> displayBuilder = new ViewDisplayExpression <VIEWMODEL>(_generator, _expression);

            addInternalCssClasses(labelBuilder, displayBuilder);
            hideElements(_htmlRoot, labelBuilder, displayBuilder);
            addIds(labelBuilder, displayBuilder);
            addCustomLabel(labelBuilder);
            addCustomAttr(displayBuilder);
            handleSpecialFormats(displayBuilder);
            HtmlTag label = labelBuilder.ToHtmlTag();
            HtmlTag input = displayBuilder.ToHtmlTag();

            if (input.Text().IsEmpty() && _hideIfEmpty)
            {
                return(null);
            }
            _htmlRoot.Append(label);
            _htmlRoot.Append(input);
            return(_htmlRoot);
        }
Exemple #3
0
 private void addIds(ViewLabelExpression <VIEWMODEL> label, ViewDisplayExpression <VIEWMODEL> input)
 {
     if (_inputId.IsNotEmpty())
     {
         input.ElementId(_inputId);
     }
     if (_labelId.IsNotEmpty())
     {
         label.ElementId(_labelId);
     }
 }
Exemple #4
0
 private void hideElements(HtmlTag root, ViewLabelExpression <VIEWMODEL> label, ViewDisplayExpression <VIEWMODEL> input)
 {
     if (_hideRoot)
     {
         root.Hide();
     }
     if (_hideLabel)
     {
         label.Hide();
     }
     if (_hideInput)
     {
         input.Hide();
     }
 }
Exemple #5
0
 private void addInternalCssClasses(ViewLabelExpression <VIEWMODEL> labelBuilder, ViewDisplayExpression <VIEWMODEL> inputBuilder)
 {
     if (_labelRootClass.IsNotEmpty())
     {
         labelBuilder.AddClassToLabelRoot(_labelRootClass);
     }
     if (_labelClass.IsNotEmpty())
     {
         labelBuilder.AddClassToLabel(_labelClass);
     }
     if (_inputRootClass.IsNotEmpty())
     {
         inputBuilder.AddClassToInputRoot(_inputRootClass);
     }
     if (_inputClass.IsNotEmpty())
     {
         inputBuilder.AddClassToInput(_inputClass);
     }
 }