MediaWiki:Form.rythm

From BITPlan Wiki
Revision as of 14:03, 4 November 2017 by Wf (talk | contribs) (Created page with "<source lang='html'> @// field definitions @def static { class Field { String name; String label_en; String label_de; String placeholder_en; String...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
@// field definitions
@def static {
  class Field {
     String name;
     String label_en;
     String label_de; 
     String placeholder_en;
     String placeholder_de;
     String icon;
     int min;

     public Field(String name,String label_en, String label_de, String placeholder_en,String placeholder_de, String icon, int min) {
        this.name=name;
        this.label_en=label_en;
        this.label_de=label_de;
        this.placeholder_de=placeholder_de;
        this.placeholder_en=placeholder_en;
        this.icon=icon;
        this.min=min;
     }

    public Field(String name,String label_en, String label_de, String icon, int min) {
      this(name,label_en,label_de,label_en,label_de,icon,min);
    }
  }
}
@// add a bootstrap field validation
@def fieldvalidate(boolean de,Field field) {
 @(field.name): @("{")
   validators:  @("{")
     stringLength: @("{")
        min: @(field.min),
     @("}"),
      notEmpty: @("{")
        message: '@(de?"Bitte "+field.label_de+" eingeben":"Please supply your "+field.label_en)'
       @("}")
     @("}")
   @("}")
}
@// add a form field
@def field(boolean de,Field field) {
<!-- Text input-->

<div class="form-group">
  <label class="col-md-4 control-label">@(de?field.label_de:field.label_en)</label>  
  <div class="col-md-4 inputGroupContainer">
  <div class="input-group">
  <span class="input-group-addon"><i class="glyphicon glyphicon-@(field.icon)"></i></span>
  <input  name="@(field.name)" placeholder="@(de?field.placeholder_de:field.placeholder_en)" class="form-control"  type="text">
    </div>
  </div>
</div>
}