2amigos / yii2-date-picker-widget

Bootstrap DatePicker Widget for Yii2
https://2amigos.us
Other
130 stars 77 forks source link

Html is broken in DateRangePicker #9

Closed SDKiller closed 9 years ago

SDKiller commented 9 years ago

Not sure when exactly it happened - maybe after bootstrap updated to 3.3.4

See screen - seems that class form-control for container is excessive (after removing it input takes its place, but also input-group-addon height need to be adjusted):

qip shot - screen 612 31 03 15

After removing:

qip shot - screen 613 31 03 15

tonydspaniard commented 9 years ago

did you run composer update? what is the version you use?

SDKiller commented 9 years ago
        "name": "2amigos/yii2-date-picker-widget",
        "version": "dev-master",
        "version_normalized": "9999999-dev",
        "source": {
            "type": "git",
            "url": "https://github.com/2amigos/yii2-date-picker-widget.git",
            "reference": "c61989074044185f35cb47379e8715b9729c5674"
        },
tonydspaniard commented 9 years ago

I have found the issue. Will fix it tonight asap: https://github.com/2amigos/yii2-date-picker-widget/blob/master/src/DateRangePicker.php#L74 and https://github.com/2amigos/yii2-date-picker-widget/blob/master/src/DateRangePicker.php#L84

Mind removing the ones on the L84 and check if that fixes the issue?

SDKiller commented 9 years ago

Also had to remove from https://github.com/2amigos/yii2-date-picker-widget/blob/master/src/DateRangePicker.php#L91 and https://github.com/2amigos/yii2-date-picker-widget/blob/master/src/DateRangePicker.php#L99

SDKiller commented 9 years ago

I suppose input-group should be in lines 91 and 99 instead, this fixed everything:

        if ($this->form) {
            Html::addCssClass($this->options, 'datepicker-from');
            Html::addCssClass($this->optionsTo, 'datepicker-to');
            $inputFrom = $this->form->field(
                $this->model,
                $this->attribute,
                [
                    'template' => '{input}{error}',
                    'options' => ['class' => 'input-group datepicker-range'],
                ]
            )->textInput($this->options);
            $inputTo = $this->form->field(
                $this->model,
                $this->attributeTo,
                [
                    'template' => '{input}{error}',
                    'options' => ['class' => 'input-group datepicker-range'],
                ]
            )->textInput($this->optionsTo);
        } else {

qip shot - screen 614 31 03 15

SDKiller commented 9 years ago

Ah, sorry, forgot about .form-control:first-child. My fix results rounded corners for $inputTo

tonydspaniard commented 9 years ago

@SDKiller mind showing the fix?

tonydspaniard commented 9 years ago

i have pushed some changes... mind checking if that fixed it? I want to know prior updating tags.

SDKiller commented 9 years ago

As I said earlier - it fixes position, but adding input-group affects corners of $inputTo:

qip shot - screen 615 01 04 15

Had to adjust css also (nesessary only if form is specified in widget config):

.input-group > .datepicker-to.form-control:first-child {
    border-radius: 0 4px 4px 0;
}

Without form widget plays well without css adjustments.

tonydspaniard commented 9 years ago

The problem was on the assets not on the style. I have fixed, will update the version tag soon.

tonydspaniard commented 9 years ago

done... Fixed on 1.0.5 Thanks for the help!