Esempio n. 1
0
        public HtmlTag ToHtmlTag()
        {
            _htmlRoot = new HtmlTag("div");
            _htmlRoot.AddClass(_noClear ? "KYT_view_root_no_clear" : "KYT_view_root");

            _htmlRoot = new HtmlTag("div").AddClass("KYT_view_root");
            if (_rootId.IsNotEmpty())
            {
                _htmlRoot.Id(_rootId);
            }
            if (_rootClass.IsNotEmpty())
            {
                _htmlRoot.AddClass(_rootClass);
            }
            ViewLabelExpression <VIEWMODEL>   labelBuilder   = new ViewLabelExpression <VIEWMODEL>(_generator, _expression);
            ViewDisplayExpression <VIEWMODEL> displayBuilder = new ViewDisplayExpression <VIEWMODEL>(_generator, _expression);

            if (_displayName.IsNotEmpty())
            {
                displayBuilder.AddDisplayNameForHref(_displayName);
            }
            addInternalCssClasses(labelBuilder, displayBuilder);
            hideElements(_htmlRoot, labelBuilder, displayBuilder);
            addIds(labelBuilder, displayBuilder);
            addCustomLabel(labelBuilder);
            HtmlTag label = labelBuilder.ToHtmlTag();
            HtmlTag input = displayBuilder.ToHtmlTag();

            _htmlRoot.Child(label);
            _htmlRoot.Child(input);
            return(_htmlRoot);
        }
Esempio n. 2
0
 private void addCustomLabel(ViewLabelExpression <VIEWMODEL> label)
 {
     if (_labelDisplay.IsNotEmpty())
     {
         label.CustomLabel(_labelDisplay);
     }
 }
Esempio n. 3
0
 private void addIds(ViewLabelExpression <VIEWMODEL> label, ViewDisplayExpression <VIEWMODEL> input)
 {
     if (_inputId.IsNotEmpty())
     {
         input.ElementId(_inputId);
     }
     if (_labelId.IsNotEmpty())
     {
         label.ElementId(_labelId);
     }
 }
Esempio n. 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();
     }
 }
Esempio n. 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);
     }
 }