Changeset 1448


Ignore:
Timestamp:
2010-03-12 10:56:35 (3 years ago)
Author:
freya
Message:

new keuri-role 'control' introduced to define the control template itself

Location:
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/basic-controls.js

    r1447 r1448  
    4747    InputControl.prototype.initElements = function() {  
    4848    
    49         var $input = this.getElement("input"); 
     49        var $input = this.getElement(kf.ControlElements.REV_INPUT); 
    5050         
    5151        var selector = "input"; 
    5252        if(! $input){ 
    53             // does not contain an input element TODO check if this is OK 
    54             this.setElement("input", $(this.getTemplate('control'))); 
     53            // where to add? 
     54            this.setElement(kf.ControlElements.REV_INPUT, $(this.getTemplate(kf.ControlElements.REV_CONTROL))); 
    5555            $input = this.getElement(); 
    5656        } 
    5757        if(! $input.is(selector)){ 
    58             var $element = $(this.getTemplate('control')); 
     58            var $element = $(this.getTemplate(kf.ControlElements.REV_CONTROL)); 
    5959            $element.attr('kauri-idref', $input.attr('kauri-idref')); 
    6060            $input.before($element).remove(); 
    6161            kf.ControlElements.index($element, this.getForm(), true); 
    62             this.setElement("input", $input); 
    63             // hier herindexeren 
     62            this.setElement(kf.ControlElements.REV_INPUT, $input); 
    6463        } 
    6564         
     
    125124    $.extend(OutputControl.prototype.templates, kf.Control.prototype.templates); 
    126125    $.extend(OutputControl.prototype.templates, { 
    127            input : "<span/>" 
     126           control : "<span kauri-role='input'/>" 
    128127    }); 
    129128 
     
    138137        if(! $output){ 
    139138            // does not contain an input element TODO check if this is OK 
    140             this.setElement("input", $(this.getTemplate('input'))); 
     139            this.setElement(kf.ControlElements.REV_CONTROL, $(this.getTemplate(kf.ControlElements.REV_CONTROL))); 
    141140            $output = this.getElement(); 
    142141        } 
    143142        if(! $output.is(selector)){ 
    144             $output.html(this.getTemplate('input')); 
     143            $output.html(this.getTemplate(kf.ControlElements.REV_CONTROL)); 
    145144        } 
    146145         
     
    189188    $.extend(CheckBoxControl.prototype.templates, kf.Control.prototype.templates); 
    190189    $.extend(CheckBoxControl.prototype.templates, { 
    191            input : "<input type='checkbox'>" 
     190           control : "<input type='checkbox'>" 
    192191    }); 
    193192 
     
    201200        if(! $input){ 
    202201            // does not contain an input element TODO check if this is OK 
    203             this.setElement("input", $(this.getTemplate('input'))); 
     202            this.setElement(kf.ControlElements.REV_CONTROL, $(this.getTemplate(kf.ControlElements.REV_CONTROL))); 
    204203            $input = this.getElement(); 
    205204        } 
    206205        if(! $input.is(selector)) 
    207             $input.html(this.getTemplate('input')); 
     206            $input.html(this.getTemplate(kf.ControlElements.REV_CONTROL)); 
    208207         
    209208        this._input = $input; 
     
    254253    $.extend(SelectionControl.prototype.templates, kf.Control.prototype.templates); 
    255254    $.extend(SelectionControl.prototype.templates, { 
    256            input : "<select kauri-role='input'>", 
     255           control : "<select kauri-role='input'>", 
    257256           refresh: "<button class='refresh' kauri-role='refresh'>" 
    258257    }); 
     
    274273        if(! $select){ 
    275274            // does not contain an input element TODO check if this is OK 
    276             $select = $(this.getTemplate('input')) 
    277             this.setElement("input", $select); 
     275            $select = $(this.getTemplate(kf.ControlElements.REV_CONTROL)) 
     276            this.setElement(kf.ControlElements.REV_INPUT, $select); 
    278277        } 
    279278        if(! $select.is(selector)){ 
    280             $select.html(this.getTemplate('input')); 
     279            $select.html(this.getTemplate(kf.ControlElements.REV_CONTROL)); 
    281280            $select = $(selector,$select); 
    282             this.setElement("input", $select); 
     281            this.setElement(kf.ControlElements.REV_INPUT, $select); 
    283282        } 
    284283        // TODO read the options from the HTML - set them on the ready options object 
     
    439438    $.extend(TextareaControl.prototype.templates, kf.Control.prototype.templates); 
    440439    $.extend(TextareaControl.prototype.templates, { 
    441            input: "<textarea/>" 
     440           control: "<textarea/>" 
    442441    }); 
    443442     
     
    449448        if(! $textarea){ 
    450449            // does not contain an input element TODO check if this is OK 
    451             this.setElement("input", $(this.getTemplate('input'))); 
     450            this.setElement(kf.ControlElements.REV_INPUT), $(this.getTemplate(kf.ControlElements.REV_CONTROL)); 
    452451            $textarea = this.getElement(); 
    453452        } 
    454453        if(! $textarea.is(selector)) 
    455             $textarea.html(this.getTemplate('input')); 
     454            $textarea.html(this.getTemplate(kf.ControlElements.REV_CONTROL)); 
    456455         
    457456        // defaults 
  • trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/date.js

    r1443 r1448  
    320320    $.extend(DateControl.prototype.templates, kf.Control.prototype.templates); 
    321321    $.extend(DateControl.prototype.templates, { 
    322            input :"<div><input type='text' kauri-role='input'/></div>" 
     322           control :"<div><input type='text' kauri-role='input'/></div>" 
    323323    }); 
    324324    DateControl.prototype.initElements = function ( ) { 
     
    328328        if(! $input){ 
    329329            // does not contain an input element TODO check if this is OK 
    330             $input = $(this.getTemplate('input')) 
    331             this.setElement("input", $input); 
     330            $input = $(this.getTemplate(kf.ControlElements.REV_CONTROL)); 
     331            this.setElement(kf.ControlElements.REV_INPUT, $input); 
    332332        } 
    333333        if(! $input.is(selector)){ 
    334             $input.html(this.getTemplate('input')); 
     334            $input.html(this.getTemplate(kf.ControlElements.REV_CONTROL)); 
    335335            $input = $("div > input",$input); 
    336336        } 
Note: See TracChangeset for help on using the changeset viewer.