Exemple #1
0
 private void addCustomAttr(ViewDisplayExpression <VIEWMODEL> display)
 {
     if (_url.IsNotEmpty())
     {
         display.AddUrlToAnchor(_url);
     }
 }
Exemple #2
0
 private void handleSpecialFormats(ViewDisplayExpression <VIEWMODEL> displayBuilder)
 {
     if (_dateFormat.IsNotEmpty())
     {
         displayBuilder.DateFormat(_dateFormat);
     }
 }
Exemple #3
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 #4
0
 private void addIds(ViewLabelExpression <VIEWMODEL> label, ViewDisplayExpression <VIEWMODEL> input)
 {
     if (_inputId.IsNotEmpty())
     {
         input.ElementId(_inputId);
     }
     if (_labelId.IsNotEmpty())
     {
         label.ElementId(_labelId);
     }
 }
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);
     }
 }
Exemple #6
0
 private void hideElements(HtmlTag root, ViewLabelExpression <VIEWMODEL> label, ViewDisplayExpression <VIEWMODEL> input)
 {
     if (_hideRoot)
     {
         root.Hide();
     }
     if (_hideLabel)
     {
         label.Hide();
     }
     if (_hideInput)
     {
         input.Hide();
     }
 }