示例#1
0
        public bool Matches(ElementRequest subject)
        {
            var overrides = subject.Get<FubuCore.Reflection.AccessorRules>();


            throw new NotImplementedException();
        }
        public virtual AccessRight RightsFor(ElementRequest request, IEnumerable<IFieldAccessRule> securityRules, IEnumerable<IFieldAccessRule> logicRules)
        {
            var securityRights = getSecurityRights(request, securityRules);
            var logicRights = getLogicRights(request, logicRules);

            return AccessRight.Least(logicRights, securityRights);
        }
 public AccessRight RightsFor(ElementRequest request)
 {
     var matchingRules = _rules.Where(x => x.Matches(request.Accessor));
     var authorizationRules = matchingRules.Where(x => x.Category == FieldAccessCategory.Authorization);
     var logicRules = matchingRules.Where(x => x.Category == FieldAccessCategory.LogicCondition);
     return _accessRightsExecutor.RightsFor(request, authorizationRules, logicRules);
 }
        public override HtmlTag Build(ElementRequest request)
        {
            PhoneNumber p = request.Accessor.GetValue(request.Model) as PhoneNumber;
            string str = string.Format("({0}) {1}-{2}", p.AreaCode, p.Prefix, p.Suffix);

            return new HtmlTag("span").Text(str);
        }
 public override void Build(ElementRequest request, HtmlTag tag)
 {
     tag
         .AllTags()
         .Where(t => t.IsInputElement())
         .ForEach(t => t.AddClass("email"));
 }
        public override HtmlTag Build(ElementRequest request)
        {
            Action<SelectTag> action = x =>
            {
                var value = request.RawValue;
                Enumeration enumeration = request.Accessor.InnerProperty.GetEnumeration("");
                if (enumeration == null) return;

                IEnumerable<Enumeration> enumerations = Enumeration.GetAllActive(enumeration);
                if (enumerations == null) return;
                enumerations = enumerations.OrderBy(item => item.Key);
                foreach (Enumeration option in enumerations)
                {
                    x.Option(option.Key,
                             option.Value ?? option.Key);
                }
                if (value != null && value.ToString().IsNotEmpty())
                {
                    x.SelectByValue(value);
                }
                else
                {
                    Enumeration defaultOption = enumerations.FirstOrDefault(o => o.IsDefault);
                    if (defaultOption != null)
                    {
                        x.SelectByValue(defaultOption.Value.IsEmpty() ? defaultOption.Key : defaultOption.Value);
                    }
                }
            };
            return new SelectTag(action);
        }
 public override void Build(ElementRequest request, HtmlTag tag)
 {
     // todo can we narrow down for numbers that it's a whole number (probably need a regex to allow commas too)
     tag.AllTags()
         .Where(t => t.IsInputElement())
         .ForEach(t => t.AddClass("number"));
 }
 public static void AddElementName(ElementRequest request, HtmlTag tag)
 {
     if (tag.IsInputElement())
     {
         tag.Attr(HtmlAttributeConstants.Name, request.ElementId);
     }
 }
 public ITagBuilder BuilderFor(ElementRequest subject)
 {
     return
         _rules.AllRulesFor<IElementTagOverride>(subject.Accessor)
               .First(x => x.Category == _category && x.Profile == _profile)
               .Builder();
 }
        public static HtmlTag Build(ElementRequest request)
        {
            var numberOfRows = 6;
            int? numberOfColumns = null;
            var attribute = request.Accessor.GetAttribute<MultilineAttribute>();
            if (attribute != null)
            {
                if (attribute.NumberOfRows.HasValue)
                {
                    numberOfRows = attribute.NumberOfRows.Value;
                }
                if (attribute.NumberOfColumns.HasValue)
                {
                    numberOfColumns = attribute.NumberOfColumns.Value;
                }
            }
            var textArea = new TextAreaTag()
                .Rows(numberOfRows);

            if (numberOfColumns.HasValue)
            {
                textArea.Cols(numberOfColumns.Value);
            }

            return textArea
                .Id(request.ElementId)
                .Attr(HtmlAttributeConstants.Name, request.ElementId)
                .Text(request.StringValue());
        }
        protected override HtmlTag BuildTag(ElementRequest request)
        {
            var attribute = GetCheckBoxListAttribute(request);
            var tag = attribute.Horizontal ? Tags.Span : Tags.Div;

            var optionPairs = GetOptionPairs(request, attribute);
            var checkedOptions = request.Value<IList<int>>().Cast<object>();
            var groupName = request.ElementId;
            foreach (var option in optionPairs)
            {
                var isChecked = checkedOptions.Contains(option.Value);
                var label = Tags.Label.For(groupName).Text(option.Text);
                var checkBox = Tags.Checkbox(isChecked).Name(groupName).Value(option.Value);

                tag.Nest(
                    Tags.Div.Nest(
                        Tags.Span
                            .AddClass(OptionSpanClass)
                            .AddClass(attribute.Horizontal ? OptionHorizontalSpanClass : string.Empty)
                            .Nest(
                                label,
                                checkBox
                            )));
            }

            return tag
                .AddClass(CheckBoxesClass);
        }
        protected override HtmlTag BuildTag(ElementRequest request)
        {
            var label = LabelingConvention.GetLabelText(request.Accessor);

            return Tags.Span
                .Text(label);
        }
 private static void SetSelectedValue(ElementRequest request, SelectTag select)
 {
     if (!request.ValueIsEmpty())
     {
         select.SelectByValue(request.Value<int>().ToString());
     }
 }
        public override HtmlTag Build(ElementRequest request)
        {
            var attr = request.Accessor.GetAttribute<ValueOfAttribute>();

            var value = ValueObjectRegistry.GetValueObjectHolder(attr.Name);

            if (value == null) return new TextboxTag(request.ElementId, request.Value<string>());

            var defaultValue = "";
            if (request.RawValue != null)
            {
                defaultValue = request.RawValue.ToString();
            }
            if (defaultValue.IsEmpty())
            {
                ValueObject @default = value.Values.FirstOrDefault(x => x.IsDefault);
                if (@default != null) defaultValue = @default.Key;
            }

            return new SelectTag(tag =>
                                     {
                                         tag.TopOption(string.Format("-- Select {0} --", value.GetKey()), null);
                                         value.Values.Each(vo => tag.Option(vo.Value, vo.Key));
                                         tag.SelectByValue(defaultValue);
                                     });
        }
 public static void AddElementName(ElementRequest request, HtmlTag tag)
 {
     if (tag.IsInputElement())
     {
         tag.Attr("name", request.ElementId);
     }
 }
示例#16
0
        public override HtmlTag Build(ElementRequest request)
        {
            var tag = new HtmlTag("div").Text(request.StringValue()).AddClass("editable").Id(request.Accessor.Name);

            var options = new EditOptions();

            if (request.Accessor.HasAttribute<MarkdownAttribute>())
            {
                tag.UnEncoded().Text(new Markdown().Transform(request.RawValue== null ? "" : request.RawValue.ToString()));
                options.Markdown = true;
            }

            options.MultiLine = request.Accessor.Name == "Details";
            options.RequiresExplicitUserActionForSave = true;

            options.MaximumLength = request.Accessor.PropertyType.Equals(typeof(string)) ? Entity.UnboundedStringLength : 0;
            options.IsDate = request.Accessor.PropertyType.IsDateTime();
            options.IsTime = request.Accessor.Name.ToLower().Contains("time");
            options.IsNumber = request.Accessor.PropertyType.IsIntegerBased() || request.Accessor.PropertyType.IsFloatingPoint();
            options.Required = request.Accessor.HasAttribute<RequiredAttribute>();
            options.PlaceholderText = "Double-Click to edit " + request.Accessor.Name.ToLower() + ".";

            var data = options.ToJson();

            tag.Attr("data", "{editoptions:"+data+"}");
            return tag;
        }
 public void should_Build_properly()
 {
     var def = AccessorDef.For<PickupOrder>(x => x.PhoneNumber);
     var services = MockRepository.GenerateStub<IServiceLocator>();
     ElementRequest request = new ElementRequest(new PickupOrder(), ReflectionHelper.GetAccessor<PickupOrder>(m => m.PhoneNumber), services);
     builder.Build(request).ShouldNotBeNull();
 }
        protected override void modify(ElementRequest request)
        {
            var rules = request.Get<ValidationGraph>().FieldRulesFor(request.Accessor);
            var modifier = request.Get<IFieldValidationModifier>();

            rules.Each(x => modifier.ModifyFor(x, request));
        }
		public override HtmlTag Build(ElementRequest request)
		{
			return
				TagActionExpression.BuildTextbox(request)
					.Id(request.ElementId)
					.Attr(HtmlAttributeConstants.Type, InputTypeConstants.Password);
		}
示例#20
0
        public ITagPlan PlanFor(ElementRequest subject, string profile = null, string category = null)
        {
            profile = profile ?? TagConstants.Default;
            category = category ?? TagConstants.Default;

            return _categories[category].PlanFor(subject, profile);
        }
        public override HtmlTag Build(ElementRequest request)
        {
            Action<SelectTag> action = x =>
            {
                var value = request.RawValue;
                var valueType = request.Accessor.PropertyType;
                var repository = ObjectFactory.Container.GetInstance<IRepository>();
                var getIdsFromPrincipal = ObjectFactory.Container.GetInstance<ISessionContext>();
                repository.DisableFilter("TenantConditionFilter");
                repository.DisableFilter("OrgConditionFilter");
                var findAll = typeof(Repository).GetMethod("FindAll");
                var genericFindAll = findAll.MakeGenericMethod(new []{valueType});
                var lookupTypes = (IEnumerable<ILookupType>)genericFindAll.Invoke(repository, new object[] { });

                var selectListItemService = ObjectFactory.Container.GetInstance<ISelectListItemService>();
                var selectListItems = selectListItemService.CreateLookupList(lookupTypes, l => l.Name, l => l.EntityId, true);
                repository.EnableFilter("OrgConditionFilter", "OrgId", getIdsFromPrincipal.GetOrgId());
                //if (selectListItems == null) return;

                selectListItems.Each(option => x.Option(option.Text, option.Value.IsNotEmpty() ? option.Value : ""));

                if (value != null && value.ToString().IsNotEmpty())
                {
                    var lookupType = value as ILookupType;
                    x.SelectByValue(lookupType.EntityId.ToString());
                }
                x.AddClass("mf_fixedWidthDropdown");
                x.AddClass("fixedWidthDropdown");

            };
            return new SelectTag(action);
        }
        public override HtmlTag Build(ElementRequest request)
        {
            var name = request.Accessor.Name;
            var pair = request.Value<AutoCompleteInput>();

            var textBoxId = name + "Text";
            var textBox = Tags.Input
                .Attr(HtmlAttributeConstants.Type, "Text")
                .Id(textBoxId)
                .Value(pair.Text)
                .Attr(HtmlAttributeConstants.Name, textBoxId);

            var valueBoxId = name + "Value";
            var valueBox = Tags.Hidden
                .Id(valueBoxId)
                .Value(pair.Value)
                .Attr(HtmlAttributeConstants.Name, valueBoxId);

            var createScript = GetCreateScript(textBoxId, pair.Url);

            var resultScript = GetResultScript(textBoxId, valueBoxId);

            return Tags.Span.Nest(
                textBox,
                valueBox,
                createScript,
                resultScript
                );
        }
        public static string AwesomeDisplay(this IFubuPage page, object model)
        {
            var type = model.GetType();
            var result = new StringBuilder();
            var tags = page.Tags(model);
            var sl = page.Get<IServiceLocator>();

            tags.SetProfile(AwesomeConfiguration.TagProfile);
            var tr = new HtmlTag("tr");
            foreach (var prop in getProperties(type))
            {

                var p = new SingleProperty(prop, type);
                var elementRequest = new ElementRequest(model, p, sl);
                var accessRight = page.Get<IFieldAccessService>().RightsFor(elementRequest);

                HtmlTag display = tags.DisplayFor(elementRequest).Authorized(accessRight.Read);
                var td = new HtmlTag("td").Append(display);
                tr.Append(td);

            }
            var editLink = new LinkTag("Edit", page.EditUrlFor(model));
            tr.Append(new HtmlTag("td").Append(editLink));
            var deleteLink = new LinkTag("Delete", page.DeleteUrlFor(model));
            tr.Append(new HtmlTag("td").Append(deleteLink));
            result.Append(tr.ToString());

            return result.ToString();
        }
		protected override HtmlTag BuildTag(ElementRequest req)
		{
			var attrib = GetCheckBoxListAttribute(req);
			var optionPairs = GetOptionPairs(req, attrib);
			var checkedOptions = req.Value<IList<int>>().Cast<object>();
			var groupName = req.ElementId;

			var div = attrib.Horizontal ? Tags.Span : Tags.Div;
			foreach (var item in optionPairs)
			{
				var isChecked = checkedOptions.Contains(item.Value);
				var label = Tags.Label.For(groupName).Text(item.Text);
				var checkBox = Tags.Checkbox(isChecked).Name(groupName).Value(item.Value);

				div.Nest(
					Tags.Div.Nest(
						Tags.Span
							.AddClass("option")
							.AddClass(attrib.Horizontal ? "horizontalOption" : "")
							.Nest(
								label,
								checkBox
							)));
			}
			return div.AddClass("checkboxes");
		}
 public override void Build(ElementRequest request, HtmlTag tag)
 {
     var range = request.Accessor.GetAttribute<RangeAttribute>();
     tag.AllTags()
         .Where(t => t.IsInputElement())
         .ForEach(t => AddRangeValidation(t, range));
 }
        //returning a string is DUMB
        public static string AwesomeFields(this IFubuPage page, object model)
        {
            var type = model.GetType();
            var result = new StringBuilder();
            var tags = page.Tags<AwesomeEditModel>();
            var sl = page.Get<IServiceLocator>();

            tags.SetProfile(AwesomeConfiguration.TagProfile);

            foreach(var prop in getProperties(type))
            {

                var p = new SingleProperty(prop, type);
                var elementRequest = new ElementRequest(model, p, sl);
                var accessRight = page.Get<IFieldAccessService>().RightsFor(elementRequest);

                var line = new FormLineExpression<AwesomeEditModel>(tags, tags.NewFieldLayout(), elementRequest)
                    .Access(accessRight)
                    .Editable(true);

                result.Append(line.ToString());
            }

            return result.ToString();
        }
        public HtmlTag Build(ElementRequest request)
        {
            if (_url.IsEmpty())
            {
                _url = request.Get<IUrlRegistry>().UrlFor(_lookupType);
            }

            request.Get<IAssetRequirements>().Require("fubu.autocomplete.js");

            var label = request.Get<IDisplayFormatter>().GetDisplayForValue(request.Accessor, request.RawValue);
            var hidden = new HiddenTag()
                .Id(request.ElementId)
                .Name(request.ElementId)
                .AddClass("lookup")
                .Attr("value", request.RawValue == null ? string.Empty : request.RawValue.ToString());

            var textboxId = "{0}Value".ToFormat(request.ElementId);
            var textbox = new TextboxTag(textboxId, label)
                .Id(textboxId)
                .Data("lookup-url", _url)
                .Data("value-for", request.ElementId)
                .AddClass("autocomplete");

            hidden.After(textbox);
            
            return hidden;
        }
 public static void AddElementName(ElementRequest request, HtmlTag tag)
 {
     if (tag.IsInputElement())
     {
         tag.Attr("name", request.ElementId);
         tag.Attr("id", idRegex.Replace(request.ElementId, "_"));
     }
 }
 public override HtmlTag Build(ElementRequest request)
 {
     return new SelectTag(tag =>
     {
         buildOptions(request, tag);
         tag.AddClass("form-list");
     });
 }
 public static void AddElementName(ElementRequest request)
 {
     if (request.OriginalTag.IsInputElement())
     {
         //request.CurrentTag.Attr("name", request.ElementId);
         request.CurrentTag.Attr("id", idRegex.Replace(request.ElementId, "_"));
     }
 }
        public override HtmlTag Build(ElementRequest request)
        {
            var results = Source(request);

            var selectTag = new SelectTag(t =>
            {
                t.Option(string.Empty, string.Empty); // blank default option
                foreach (var result in results)
                {
                    BuildOptionTag(t, result, request);
                }
            });

            var entity = request.Value <T>();

            if (entity != null)
            {
                selectTag.SelectByValue(GetValue(entity));
            }

            return(selectTag);
        }
        public override HtmlTag Build(ElementRequest request)
        {
            Action <RadioButtonListTag> action = x =>
            {
                var         value       = request.RawValue;
                Enumeration enumeration = request.Accessor.InnerProperty.GetAltEnumeration("");
                if (enumeration == null)
                {
                    return;
                }

                IEnumerable <Enumeration> enumerations = Enumeration.GetAllActive(enumeration);
                if (enumerations == null)
                {
                    return;
                }

                foreach (Enumeration option in enumerations)
                {
                    x.AddRadioButton(option.Key,
                                     option.Value.IsEmpty() ? option.Key : option.Value, request.ElementId);
                }
                if (value != null && value.ToString().IsNotEmpty())
                {
                    x.SelectByValue(value);
                }
                else
                {
                    Enumeration defaultOption = enumerations.FirstOrDefault(o => o.IsDefault);
                    if (defaultOption != null)
                    {
                        x.SelectByValue(defaultOption.Value.IsEmpty() ? defaultOption.Key : defaultOption.Value);
                    }
                }
            };

            return(new RadioButtonListTag(action));
        }
示例#33
0
        public static void Execute(ElementRequest request)
        {
            var turnamentId = Guid.Parse(request.Txt);
            var command     = DbHelper.GetCommandForTurnament(turnamentId, false);

            if (command.Count < 3)
            {
                throw new ApplicationException("Ошибка: Минимальное колличество комманд для проведения турнира 4");
            }

            for (int i = command.Count - 1; i >= 1; i--)
            {
                Random rand = new Random();
                int    j    = rand.Next(i + 1);
                var    temp = command[j];
                command[j] = command[i];
                command[i] = temp;
            }

            DbHelper.CreatePositionCommand(command, turnamentId);

            CreateTour(turnamentId);
        }
示例#34
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            var request = new ElementRequest(new OnlyModelAccessor(ViewContext.ViewData.Model))
            {
                Model = ViewContext.ViewData.Model
            };

            var library = ViewContext.HttpContext.RequestServices.GetService <HtmlConventionLibrary>();

            object ServiceLocator(Type t) => ViewContext.HttpContext.RequestServices.GetService(t);

            var tagGenerator = new TagGenerator(library.TagLibrary, new ActiveProfile(), ServiceLocator);

            var tag = tagGenerator.Build(request, Category);

            foreach (var attribute in output.Attributes)
            {
                tag.Attr(attribute.Name, attribute.Value);
            }

            output.TagName = null;
            output.PreElement.AppendHtml(tag);
        }
        public override HtmlTag Build(ElementRequest request)
        {
            var container      = new HtmlTag("div").AddClass("imageInputContainer");
            var imageContainer = new HtmlTag("div").AddClass("imageContainer");
            var name           = CCHtmlConventionsKO.DeriveElementName(request);
            var thumb          = new HtmlTag("img").Attr("data-bind", "attr: { src: " + name + " }").Id("image").Attr("alt", request.Accessor.FieldName);
            var linkImage      = new HtmlTag("img").Attr("src", @"/content/images/document.png").Attr("alt", request.Accessor.FieldName);
            var link           = new HtmlTag("a").Attr("data-bind", "attr: { href: " + name + "} ").Id("link").Attr("target", "_blank");

            link.Children.Add(linkImage);
            var delete = new HtmlTag("input").Attr("type", "button").AddClass("deleteImage").Attr("value", "Delete");

            var inputContainer = new HtmlTag("div").AddClass("inputContainer");
            var file           = new HtmlTag("input").Attr("type", "file").Attr("size", 45).Attr("id", name).Attr("name", name);

            imageContainer.Children.Add(thumb);
            imageContainer.Children.Add(link);
            imageContainer.Children.Add(delete);
            inputContainer.Children.Add(file);
            container.Children.Add(imageContainer);
            container.Children.Add(inputContainer);
            return(container);
        }
        public override HtmlTag Build(ElementRequest request)
        {
            Action <SelectTag> action = x =>
            {
                var value = request.RawValue is DomainEntity ? ((DomainEntity)request.RawValue).EntityId : request.RawValue;

                var propertyName     = request.ToAccessorDef().Accessor.FieldName;
                var listPropertyInfo = request.ToAccessorDef().ModelType.GetProperty(propertyName + "List");
                var selectListItems  = listPropertyInfo.GetValue(request.Model, null) as IEnumerable <SelectListItem>;
                if (selectListItems == null)
                {
                    return;
                }

                selectListItems.Each(option => x.Option(option.Text, option.Value.IsNotEmpty() ? option.Value: ""));

                if (value != null && value.ToString().IsNotEmpty())
                {
                    x.SelectByValue(value.ToString());
                }
            };

            return(new SelectTag(action));
        }
示例#37
0
        public void StringValue_delegates_to_Stringifier()
        {
            var stringifier = new Stringifier();

            stringifier.AddStrategy(new StringifierStrategy {
                Matches        = r => true,
                StringFunction = r => "*" + r.RawValue + "*"
            });

            var services = new InMemoryServiceLocator();

            services.Add(stringifier);
            services.Add <IDisplayFormatter>(new DisplayFormatter(services, stringifier));

            var request = ElementRequest.For <Model1>(new Model1 {
                Child = new Model2 {
                    Name = "Little Lindsey"
                }
            }, x => x.Child.Name);

            request.Attach(services);

            request.StringValue().ShouldEqual("*Little Lindsey*");
        }
示例#38
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            if (For == null)
            {
                throw new InvalidOperationException(
                          "Missing or invalid 'for' attribute value. Specify a valid model expression for the 'for' attribute value.");
            }

            var request = new ElementRequest(new ModelMetadataAccessor(For))
            {
                Model = For.Model
            };

            var library = ViewContext.HttpContext.RequestServices.GetService <HtmlConventionLibrary>();

            var additionalServices = new object[]
            {
                For.ModelExplorer,
                ViewContext,
                new ElementName(For.Name)
            };

            object ServiceLocator(Type t) => additionalServices.FirstOrDefault(t.IsInstanceOfType) ?? ViewContext.HttpContext.RequestServices.GetService(t);

            var tagGenerator = new TagGenerator(library.TagLibrary, new ActiveProfile(), ServiceLocator);

            var tag = tagGenerator.Build(request, Category);

            foreach (var attribute in output.Attributes)
            {
                tag.Attr(attribute.Name, attribute.Value);
            }

            output.TagName = null;
            output.PreElement.AppendHtml(tag);
        }
示例#39
0
        public static string AwesomeFields(this IFubuPage page, object model)
        {
            var type   = model.GetType();
            var result = new StringBuilder();
            var tags   = page.Tags <AwesomeEditModel>();
            var sl     = page.Get <IServiceLocator>();

            tags.SetProfile(AwesomeConfiguration.TagProfile);

            foreach (var prop in getProperties(type))
            {
                var p = new SingleProperty(prop, type);
                var elementRequest = new ElementRequest(model, p, sl);
                var accessRight    = page.Get <IFieldAccessService>().RightsFor(elementRequest);

                var line = new FormLineExpression <AwesomeEditModel>(tags, tags.NewFieldLayout(), elementRequest)
                           .Access(accessRight)
                           .Editable(true);

                result.Append(line.ToString());
            }

            return(result.ToString());
        }
        public static string DeriveElementName(ElementRequest request)
        {
            var name = request.Accessor.Name;

            if (request.Accessor is PropertyChain)
            {
                name = ((PropertyChain)(request.Accessor)).PropertyNames.Aggregate((current, next) => current + "." + next);
                var isDomainEntity = false;
                var de             = request.Accessor.PropertyType.BaseType;
                while (de.Name != "Object")
                {
                    if (de.Name == "DomainEntity")
                    {
                        isDomainEntity = true;
                    }
                    de = de.BaseType;
                }
                if (isDomainEntity)
                {
                    name += ".EntityId";
                }
            }
            return(name);
        }
示例#41
0
        private AccessRight RightsFor <T>(T model, Expression <Func <T, object> > expression)
        {
            var request = ElementRequest.For(model, expression);

            return(_service.RightsFor(request));
        }
示例#42
0
 public AccessRight RightsFor(ElementRequest request)
 {
     return(_filter(request.Model.As <T>()) ? _limitation : AccessRight.All);
 }
示例#43
0
 public HtmlTag Build(ElementRequest request)
 {
     return(new HtmlTag("span").Text(request.StringValue()).Id(request.ElementId));
 }
示例#44
0
 public HtmlTag Build(ElementRequest request)
 {
     return(new TextboxTag().Attr("value", (request.RawValue ?? string.Empty).ToString()));
 }
        public static HtmlTag BuildTextbox2(ElementRequest request)
        {
            var date = DateTime.Parse(request.StringValue()).ToShortDateString();

            return(new TextboxTag().Attr("value", date).AddClass("datePicker"));
        }
 public override HtmlTag Build(ElementRequest request)
 {
     return(new TextboxTag().Attr("data-bind", "timeString:" + CCHtmlConventionsKO.DeriveElementName(request)).AddClass("timePicker"));
 }
 protected virtual IEnumerable <T> Source(ElementRequest request)
 {
     return(request.Get <SchoolContext>().Set <T>());
 }
 public bool Matches(ElementRequest subject)
 {
     return(true);
 }
示例#49
0
        public override HtmlTag Build(ElementRequest request)
        {
            var date = request.StringValue().IsNotEmpty() ? DateTime.Parse(request.StringValue()).ToShortTimeString() : "";

            return(new TextboxTag().Attr("value", date).AddClass("timePicker"));
        }
 public override HtmlTag Build(ElementRequest request)
 {
     return(new PasswordTag().Attr("data-bind", "value:" + CCHtmlConventionsKO.DeriveElementName(request)));
 }
 public override HtmlTag Build(ElementRequest request)
 {
     return(new CheckboxTag(false).Attr("data-bind",
                                        "checked:" + CCHtmlConventionsKO.DeriveElementName(request)));
 }
 public override HtmlTag Build(ElementRequest request)
 {
     return(new HtmlTag("img").Attr("data-bind",
                                    " attr: { src: " + CCHtmlConventionsKO.DeriveElementName(request) + " }")
            .Attr("alt", request.Accessor.FieldName));
 }
 public HtmlTag Build(ElementRequest request)
 {
     return(new HtmlTag("div").AddClass("blue"));
 }
示例#54
0
 public HtmlTag Build(ElementRequest request)
 {
     return(_creators[request.ToAccessorDef()](request));
 }
示例#55
0
        public override HtmlTag Build(ElementRequest request)
        {
            var isChecked = request.RawValue != null && (bool)request.RawValue;

            return(new CheckboxTag(isChecked));
        }
 public override HtmlTag Build(ElementRequest request)
 {
     return(new TextboxTag().Id(request.Accessor.Name).AddClass("multiSelect").Attr("data-bind", "MultiSelect:" + CCHtmlConventionsKO.DeriveElementName(request)));
 }
示例#57
0
 public override HtmlTag Build(ElementRequest request)
 {
     return(new HtmlTag("img").Attr("src", request.StringValue()).Attr("alt", request.Accessor.FieldName));
 }
 protected virtual HtmlTag BuildOptionTag(SelectTag select, T model, ElementRequest request)
 {
     return(select.Option(GetDisplayValue(model), GetValue(model)));
 }
 public HtmlTag Build(ElementRequest request)
 {
     return(new HtmlTag("").NoTag().Text(BreakUpCamelCase(request.Accessor.Name)));
 }
 public override bool Matches(ElementRequest subject)
 {
     return(typeof(T).IsAssignableFrom(subject.Accessor.PropertyType));
 }