Example #1
0
        private HtmlTag renderInlineReverse()
        {
            _htmlRoot = new HtmlTag("div").AddClass("CC_editor_root");
            if (_rootId.IsNotEmpty())
            {
                _htmlRoot.Id(_rootId);
            }
            if (_rootClasses != null && _rootClasses.Any())
            {
                _htmlRoot.AddClasses(_rootClasses);
            }
            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.Children.Add(input);
            _htmlRoot.Children.Add(label);
            return(_htmlRoot);
        }
Example #2
0
 private void addCustomLabel(EditorLabelExpression <VIEWMODEL> label)
 {
     if (_labelDisplay.IsNotEmpty())
     {
         label.CustomLabel(_labelDisplay);
     }
 }
Example #3
0
 private void addIds(EditorLabelExpression <VIEWMODEL> label, IEditorInputExpression <VIEWMODEL> input)
 {
     if (_inputId.IsNotEmpty())
     {
         input.ElementId(_inputId);
     }
     if (_labelId.IsNotEmpty())
     {
         label.ElementId(_labelId);
     }
 }
Example #4
0
 private void hideElements(HtmlTag root, EditorLabelExpression <VIEWMODEL> label, IEditorInputExpression <VIEWMODEL> input)
 {
     if (_hideRoot)
     {
         root.Hide();
     }
     if (_hideLabel)
     {
         label.Hide();
     }
     if (_hideInput)
     {
         input.Hide();
     }
 }
Example #5
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);
     }
 }
Example #6
0
//        private bool checkAuthentication()
//        {
//            _authorizationService = ObjectFactory.Container.GetInstance<IAuthorizationService>();
//            _sessionContext = ObjectFactory.Container.GetInstance<ICCSessionContext>();
//            var user = _sessionContext.GetCurrentUser();
//            return _authorizationService.IsAllowed(user, _operation);
//        }

        private HtmlTag renderStandard()
        {
            _htmlRoot = new HtmlTag("div");
            _htmlRoot.AddClass(_noClear ? "editor_root_no_clear" : "editor_root");
            if (_rootId.IsNotEmpty())
            {
                _htmlRoot.Id(_rootId);
            }
            if (_rootClasses != null && _rootClasses.Any())
            {
                _htmlRoot.AddClasses(_rootClasses);
            }
            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);
            if (_readOnly)
            {
                inputBuilder.ReadOnly();
            }
            HtmlTag input = inputBuilder.ToHtmlTag();
            HtmlTag label = labelBuilder.ToHtmlTag();

            _htmlRoot.Children.Add(label);
            _htmlRoot.Children.Add(input);
            addFlagToHtmlRoot(input.FirstChild());
            return(_htmlRoot);
        }