Exemplo n.º 1
0
 private void addCustomLabel(EditorLabelExpression <VIEWMODEL> label)
 {
     if (_labelDisplay.IsNotEmpty())
     {
         label.CustomLabel(_labelDisplay);
     }
 }
Exemplo n.º 2
0
        private HtmlTag renderStandard()
        {
            _htmlRoot = new HtmlTag("div");
            _htmlRoot.AddClass(_noClear ? "KYT_editor_root_no_clear" : "KYT_editor_root");
            if (_rootId.IsNotEmpty())
            {
                _htmlRoot.Id(_rootId);
            }
            if (_rootClass.IsNotEmpty())
            {
                _htmlRoot.AddClass(_rootClass);
            }
            EditorLabelExpression <VIEWMODEL>  labelBuilder = new EditorLabelExpression <VIEWMODEL>(_generator, _expression);
            IEditorInputExpression <VIEWMODEL> inputBuilder;

            if (_dropdown)
            {
                inputBuilder = new DropdownInputExpression <VIEWMODEL>(_generator, _expression, _dropdownWithItems);
            }
            else
            {
                inputBuilder = new EditorInputExpression <VIEWMODEL>(_generator, _expression);
            }
            addInternalCssClasses(labelBuilder, inputBuilder);
            hideElements(_htmlRoot, labelBuilder, inputBuilder);
            addIds(labelBuilder, inputBuilder);
            addCustomLabel(labelBuilder);
            HtmlTag input = inputBuilder.ToHtmlTag();
            HtmlTag label = labelBuilder.ToHtmlTag();

            _htmlRoot.Child(label);
            _htmlRoot.Child(input);
            return(_htmlRoot);
        }
Exemplo n.º 3
0
        private HtmlTag renderInlineReverse()
        {
            _htmlRoot = new HtmlTag("div").AddClass("KYT_editor_root");
            if (_rootId.IsNotEmpty())
            {
                _htmlRoot.Id(_rootId);
            }
            if (_rootClass.IsNotEmpty())
            {
                _htmlRoot.AddClass(_rootClass);
            }
            EditorLabelExpression <VIEWMODEL> labelBuilder = new EditorLabelExpression <VIEWMODEL>(_generator, _expression);
            EditorInputExpression <VIEWMODEL> inputBuilder = new EditorInputExpression <VIEWMODEL>(_generator, _expression);

            addInternalCssClasses(labelBuilder, inputBuilder);
            hideElements(_htmlRoot, labelBuilder, inputBuilder);
            addIds(labelBuilder, inputBuilder);
            addCustomLabel(labelBuilder);
            HtmlTag label = labelBuilder.LeadingColon().ToHtmlTag();
            HtmlTag input = inputBuilder.ToHtmlTag();

            _htmlRoot.Child(input);
            _htmlRoot.Child(label);
            return(_htmlRoot);
        }
Exemplo n.º 4
0
 private void addIds(EditorLabelExpression <VIEWMODEL> label, IEditorInputExpression <VIEWMODEL> input)
 {
     if (_inputId.IsNotEmpty())
     {
         input.ElementId(_inputId);
     }
     if (_labelId.IsNotEmpty())
     {
         label.ElementId(_labelId);
     }
 }
Exemplo n.º 5
0
 private void hideElements(HtmlTag root, EditorLabelExpression <VIEWMODEL> label, IEditorInputExpression <VIEWMODEL> input)
 {
     if (_hideRoot)
     {
         root.Hide();
     }
     if (_hideLabel)
     {
         label.Hide();
     }
     if (_hideInput)
     {
         input.Hide();
     }
 }
Exemplo n.º 6
0
 private void addInternalCssClasses(EditorLabelExpression <VIEWMODEL> labelBuilder, IEditorInputExpression <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);
     }
 }