clevertech / YiiBooster

YiiBooster
BSD 2-Clause "Simplified" License
544 stars 305 forks source link

Checkbox and radio rendering mode #227

Open Ragazzo opened 11 years ago

Ragazzo commented 11 years ago

I know it is difficult decision with BC and other, but may be we will change the way of rendering checkboxes and radio. Current way for radio or checkboxes is: [x] Checckbox-label, but other dropdowns and textfields has label at the left side, and in current verison labelOptions has no affect on the output checkbox or radio, so in this way i suggest to modify it to this way: TbInput: https://github.com/clevertech/YiiBooster/blob/1.0.6-wip/widgets/input/TbInput.php#L305 delete in_array() condition. And checkbox and radio methods in TbInputHorizontal will be like this: https://github.com/clevertech/YiiBooster/blob/1.0.6-wip/widgets/input/TbInputHorizontal.php#L46

//checkbox function
    $attribute = $this->attribute;
    echo $this->getLabel(); 
    echo '<div class="controls">';
    echo $this->form->checkBox($this->model, $attribute, $this->htmlOptions) . PHP_EOL;
    echo $this->getError() . $this->getHint();
    echo '</div>';
//radio function
    $attribute = $this->attribute;
    $echo $this->getLabel(); 
    echo '<div class="controls">';
    echo $this->form->radioButton($this->model, $attribute, $this->htmlOptions) . PHP_EOL;
    echo $this->getError() . $this->getHint();
    echo '</div>';

But anyway checbox and radio **List methods need to be updated correctly too. And the same in TbInputVertical. Serious bug is that i really cant set labelOptions on checbox and the default value in for in label will be path to my namespaced models (( not good i think.

Or anyway if we dont want to break BC, i think developers can use this "hack":

    <div class="control-group ">
        <?php echo CHtml::activeLabel($form,'attributeName',array(
            'for' => 'FormName[attributeName]',
            'class'=>'control-label'
        )); ?>
        <div class="controls">
        <?php echo CHtml::activeCheckBox($form,'attributeName',array(
            'name'=>'FormName[ringing]',
        ));?>
        </div>
    </div>
Ragazzo commented 11 years ago

@tonydspaniard so what do u think? If BC problems and other, than ok, close this one.

tonydspaniard commented 11 years ago

@ragazzo will have to put this on hold till i can actually have time... it has been hectic lately, and I want to have a closer look to it and discuss it with Chris (Yii-Bootstrap) as he wishes to support YiiBooster on its library.

Ragazzo commented 11 years ago

Ok, good news that Chris will be core-developer of booster)

hijarian commented 11 years ago

@tonydspaniard did you just said that the YiiBooster is just a Decorator to the Yii-Bootstrap extension? ;)