HElement StandardForm(Expression <Action> action, ChainFunc <HAttributes.form> extraAttributes, IEnumerable <HInput> inputs)
 {
     return
         (H.form(a => a.method("post")
                 .action(H.Url(action))
                 .Merge(extraAttributes),
                 H.table(
                     from input in inputs
                     select H.tr
                     (
                         H.td(input is HiddenInput ? null : H.label(a => a.@for(input.Id), input.Label)),
                         H.td(input.ToElement())
                     )
                     ),
                 H.p(H.input(a => a.type("submit").value("OK")))
                 ));
 }
Exemple #2
0
 HElement StandardForm(Expression<Action> action, ChainFunc<HAttributes.form> extraAttributes, IEnumerable<HInput> inputs)
 {
     return
         H.form(a => a.method("post")
                      .action(H.Url(action))
                      .Merge (extraAttributes),
             H.table(
                from input in inputs
                select H.tr
                (
                    H.td(input is HiddenInput ? null : H.label(a => a.@for(input.Id), input.Label)),
                    H.td(input.ToElement())
                )
             ),
             H.p (H.input(a => a.type("submit").value("OK")))
     );
 }
Exemple #3
0
        // this can be improved in the future to intelligently merge other types of attributes.
        // css is however the most common case.

        /// <summary>
        /// Merges two attribute chains with css-awareness. Unlike Join, which merely concatenate two chains,
        /// Merge merges multiple css attributes into a single css attribute.
        /// </summary>
        public static IChain <T> Merge <T> (this IChain <T> x, ChainFunc <T> func) where T : HAttribute, new()
        {
            return(x.Join(func).MergeCssAttributes());
        }
Exemple #4
0
 public static IChain <T> Join <T> (this IChain <T> x, ChainFunc <T> func)
 {
     return(x.Join(func == null ? null : func(null)));
 }
Exemple #5
0
 public TextInput(Expression <Func <object> > idExpression, object label = null, ChainFunc <HAttributes.input> attributes = null)
     : base(idExpression, label, attributes)
 {
 }
Exemple #6
0
 public HiddenInput(Expression <Func <object> > idExpression, ChainFunc <HAttributes.input> attributes = null)
     : base(idExpression, null, attributes)
 {
 }
Exemple #7
0
 public DropDownInput(Expression <Func <object> > idExpression, object label = null, ChainFunc <HAttributes.select> attributes = null,
                      IEnumerable <KeyValuePair <object, string> > options   = null)
     : base(idExpression, label, attributes)
 {
     this.options = options;
 }