Giter Site home page Giter Site logo

yiisoft / yii2-bootstrap4 Goto Github PK

View Code? Open in Web Editor NEW
216.0 38.0 105.0 10.32 MB

Yii 2 Bootstrap 4 Extension

Home Page: https://www.yiiframework.com/

License: BSD 3-Clause "New" or "Revised" License

PHP 99.70% Makefile 0.30%
yii yii2 bootstrap bootstrap4 css hacktoberfest

yii2-bootstrap4's People

Contributors

arhell avatar bwoester avatar cebe avatar creocoder avatar crtlib avatar egorpromo avatar ext4yii avatar gevik avatar gonimar avatar kartik-v avatar klimov-paul avatar larryullman avatar lucianobaraglia avatar machour avatar marcovtwout avatar mohorev avatar pana1990 avatar pmoust avatar qiangxue avatar ragazzo avatar resurtm avatar samdark avatar schmunk42 avatar sensorario avatar simialbi avatar slavcodev avatar softark avatar suralc avatar tarasio avatar tonydspaniard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-bootstrap4's Issues

use both bs3 and bs4 in the same project but different modules

I would like to use in my project both bs3 and bs4 widgets but in different modules.

Because each extension requires the same package (bower-asset/bootstrap) in different version constraints, it is impossible.

What do you think about to use npm-asset/bootstrap package in yii2-bootstrap4 and keep the bower-asset/bootstrap use twbs/bootstrap in yii2-bootstrap?

ActiveField checkbox with horizontal layout

What steps will reproduce the problem?

<?php $form = ActiveForm::begin([
    'layout' => 'horizontal',
]); ?>
<?= $form->field($model, 'email')->textInput() ?>
<?= $form->field($model, 'password')->passwordInput() ?>
<?= $form->field($model, 'rememberMe')->checkbox() ?>

What's expected?

Render checkbox under text inputs

What do you get instead?

Checkbox rendered under labels

Additional info

Q A
Yii vesion 2.0.15.1
PHP version 7.1.23
Operating system ubuntu 16.04

Installing on Yii2-starter-kit

On Yii2 starter kit I can`t install this package.
Message «bower-asset/bootstrap ~4.0 -> no matching package found.» are showed

"minimum stability" set to "dev"
current YII-version - 2.0.15.1

How can I install this package?

Update composer.json branch yii2 3.0.

Yii vesion: 3.0.x-dev
PHP version: 7.1.17.
Operating system: Centos7.

Hi, please update composer.json:

it would be nice to update the composer.json to keep trying yii2-boostrap4 with yii2 branch 3.0.x-dev.

"require": { "yiisoft/yii2": "~2.0.15|~2.1.0|~3.0.0", },

A more user friendly implementation

Something that was already bugging me with yii2-bootstrap, and is now even "worse", is the developer experience when using the Yii2 bootstrap packages.

Take for instance the Progress component.

Even with bootstrap3, creating a successful animating stripped progress at 70% is painful:

// striped animated
echo Progress::widget([
   'percent' => 70,
   'barOptions' => ['class' => 'progress-bar-success'],
   'options' => ['class' => 'active progress-striped']
]);

Here, I need to remember the class names and what class should go on what part of the Progress element, etc.

You end up most of the time consulting the bootstrap documentation to remember the syntax, and there, you just have the plain HTML snippet sitting in front of you, that you could copy/paste and be done with.

I think that we need to care more about DX here, and that creating a progress element should be as straight forward as:

Progress::widget(['percent' => 20, 'color' => Bootstrap::SUCCESS, 'striped' => true, 'animated' => true]);

options would be kept for a more advanced usage, when the developer really wants to stray out of bootstrap path.

Removal of Progress::$barOptions

With yii2-bootstrap, we were able to colorize a Progress bar like this:

echo Progress::widget([
     'percent' => 65,
     'barOptions' => ['class' => 'progress-bar-danger']
]);

screen shot 2019-01-16 at 12 36 06 am

The adapted syntax for bootstrap4, with barOptions removed from the API looks like this:

echo Progress::widget([
     'bars' => [
         [
             'percent' => 65,
             'options' => ['class' => 'progress-bar-danger']
         ]
     ],
]);

I feel like we've lost some syntactic sugar here. What was the reason for the removal of barOptions ?

Installation problem - Can only install one of bootstrap v4 or v3.

There is a problem with installation if you want to use a bootstrap v3.3.7 for other parts of app.
During composer installation I got an error and package was not installed.

What steps will reproduce the problem?

Try to install package on project created based on advanced yii2 template.

What's expected?

Make that package installed.

What do you get instead?

G:\Web\root-users\studios>..\.tools\Composer\composer.bat require yiisoft/yii2-bootstrap4
Using version ^1.0@dev for yiisoft/yii2-bootstrap4
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for yiisoft/yii2-bootstrap4 ^1.0@dev -> satisfiable by yiisoft/yii2-bootstrap4[1.0.x-dev].
    - Conclusion: remove bower-asset/bootstrap v3.3.7
    - Conclusion: don't install bower-asset/bootstrap v3.3.7
    - yiisoft/yii2-bootstrap4 1.0.x-dev requires bower-asset/bootstrap ^4.1.0 -> satisfiable by bower-asset/bootstrap[v4.1.3, v4.1.2, v4.1.1, v4.1.0].
    - Can only install one of: bower-asset/bootstrap[v4.1.3, v3.3.7].
    - Can only install one of: bower-asset/bootstrap[v4.1.2, v3.3.7].
    - Can only install one of: bower-asset/bootstrap[v4.1.1, v3.3.7].
    - Can only install one of: bower-asset/bootstrap[v4.1.0, v3.3.7].
    - Installation request for bower-asset/bootstrap (locked at v3.3.7) -> satisfiable by bower-asset/bootstrap[v3.3.7].
Installation failed, reverting ./composer.json to its original content.

Additional info

Q A
Yii vesion 2.0.15.1
PHP version 7.2
Operating system Windows 10 (CBB)

Modal title documentation suggests unnecessary header tag

What steps will reproduce the problem?

Folow Modal documentation , i.e. do:

Modal::begin([
    'title' => '<h2>Hello world</h2>',
    'toggleButton' => ['label' => 'click me'],
]);

What's expected?

A single <h2> header tag as the modal title element.

What do you get instead?

A <h2> wrapped inside a <h5>.

Additional info

Previous version's (BS3) Modal required the title (a header property actually) to be wrapped in a tag with modal-title so that the title displayed properly. That's not the case anymore in Yii2-bs4 as an <h5> is provided automatically, which is nice.

Version: 2.0.0

"nav" class is always added to Nav element

Even if I add a custom class to my Nav element, the "nav" class is always added, which can cause certain problems.

This code:

Nav::widget([
    'options' => ['class' => 'navbar-nav mr-auto'],
    'items' => [
        ['label' => 'Home', 'url' => ['/site/index']],
        ['label' => 'Folder', 'url' => ['/folder/index']],
        ...
    ],
]);

will generate this HTML:

<ul id="w1" class="navbar-nav mr-auto nav">...</ul>

I can see that the nav class is always added here:

Html::addCssClass($this->options, ['widget' => 'nav']);

If the Nav element is inside a Navbar element then it will make some padding issues. Removing the nav class would solve the issue.

Resetting widget counter has no effect

I'm currently trying to fix the tests and it seems that resetting the widget counter has no effect. Taking ToggleButtonGroupTest as example, neither \yii\base\Widget::$counter = 0; nor ToggleButtonGroup::$counter = 0; change the actual result of the test (see below).
The big problem is that even if I would test against an incremented counter ID, tests would break instantly if the order of the tests change.
Does someone of the core team have an idea why a public static property behaves like this?

What steps will reproduce the problem?

Execute the tests and look for the ID's in ToggleButtonGroupTest::testRadio (second test in the class)

What's expected?

Two inputs with the ID's i1 and i2

What do you get instead?

ID's i3 and i4

Additional info

Q A
Yii version ~2.0
PHP version 7.1
Operating system Win10x64

[docs] Improve "Compiling from the .sass files"

https://github.com/yiisoft/yii2-bootstrap4/blob/master/docs/guide/assets-setup.md#compiling-from-the-sass-files

Here we're implying that in order to be able to modify bootstrap CSS, we should not install bootstrap from npm, and that we should maintain it manually instead.

The statement is obviously wrong, and I think that we might want to recommend a more modern approach, like using bootstrap from npm and properly customizing its variable in your site.scss file:

// Customize any bootstrap variable before including the main file from npm
// @see https://github.com/twbs/bootstrap/blob/v4.1.2/scss/_variables.scss

$primary: "#ffcc00"; 
@import "~node_modules/bootstrap/dist/bootstrap.scss"

.customer-area {
   // your own CSS
}

Would that be okay ?

Proposal/Question: Input wrapping

In order to be able to submit the fixed tests regarding #60, I wanted to ask something beforehand:
To make ToggleButtonGroup work in the frontend, input need to be wrapped by label. That makes them toggleable and hides the actual input. Currently there is no way to achieve this.

My proposal in BaseHtml::booleanInput:

    protected static function booleanInput($type, $name, $checked = false, $options = [])
    {
        $options['checked'] = (bool)$checked;
        $value = array_key_exists('value', $options) ? $options['value'] : '1';
        if (isset($options['uncheck'])) {
            // add a hidden field so that if the checkbox is not selected, it still submits a value
            $hiddenOptions = [];
            if (isset($options['form'])) {
                $hiddenOptions['form'] = $options['form'];
            }
            $hidden = static::hiddenInput($name, $options['uncheck'], $hiddenOptions);
            unset($options['uncheck']);
        } else {
            $hidden = '';
        }
        if (isset($options['label'])) {
            $label = $options['label'];
            $labelOptions = isset($options['labelOptions']) ? $options['labelOptions'] : [];
            unset($options['label'], $options['labelOptions']);

            if (!isset($options['id'])) {
                $options['id'] = static::getId();
            }

-            $content = static::input($type, $name, $value, $options) . "\n";
-            $content .= static::label($label, $options['id'], $labelOptions);
+            $input = static::input($type, $name, $value, $options);
+
+            if (isset($labelOptions['wrapInput']) && $labelOptions['wrapInput']) {
+                unset($labelOptions['wrapInput']);
+                $content = static::label($input . $label, $options['id'], $labelOptions);
+            } else {
+                $content = $input . "\n" . static::label($label, $options['id'], $labelOptions);
+            }
            return $hidden . $content;
        }

        return $hidden . static::input($type, $name, $value, $options);
    }

Additional info

Q A
Yii vesion ~2.0
PHP version 7.1
Operating system Win10x64

ActiveField not show validation error message with custom inputTemplate

If you use custom inputTemplate and place {input} into any html tag then validation error messages not showing.

Works:

<?= $form->field($model, 'test',[
                    'inputTemplate' => '<span>@</span>{input}',
                ])->textInput() ?>

Not works:

<?= $form->field($model, 'test',[
                    'inputTemplate' => '<div>{input}</div>',
                ])->textInput() ?>

Additional info

Q A
Yii vesion 2.0.16-dev
PHP version 7.1.7
as

Installing on yii2 advanced template

Can this be used with yii2 advanced template.
I get the following errors while trying to do composer update

Problem 1
- Conclusion: remove bower-asset/bootstrap v3.3.7
- Conclusion: don't install bower-asset/bootstrap v4.1.3
- Conclusion: don't install bower-asset/bootstrap v3.3.6
- Conclusion: remove yiisoft/yii2-bootstrap 2.0.8|install bower-asset/bootstrap v3.3.6
- Conclusion: don't install bower-asset/bootstrap v4.1.2
- Conclusion: don't install bower-asset/bootstrap v3.3.7|install bower-asset/bootstrap v4.1.3|install bower-asset/bootstrap v4.1.2
- Conclusion: don't install bower-asset/bootstrap v3.3.5
- Conclusion: don't install bower-asset/bootstrap v4.1.1
- Conclusion: don't install bower-asset/bootstrap v3.3.4
- Installation request for yiisoft/yii2-gii ~2.0.0 -> satisfiable by yiisoft/yii2-gii[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- Installation request for yiisoft/yii2-bootstrap4 ~1.0.0@dev -> satisfiable by yiisoft/yii2-bootstrap4[1.0.x-dev].
- yiisoft/yii2-debug 2.0.13 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.9 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.8 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.7 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.6 requires yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.5 requires yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.4 requires yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.3 requires yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.2 requires yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.13 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.12 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.11 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.10 requires yiisoft/yii2-bootstrap ~2.0.0 -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.1 requires yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-debug 2.0.0 requires yiisoft/yii2-bootstrap * -> satisfiable by yiisoft/yii2-bootstrap[2.0.8, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
- yiisoft/yii2-bootstrap 2.0.8 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.1 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.2 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.3 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.4 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.5 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.6 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.7 requires bower-asset/bootstrap 3.3.* | 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.3.7, v3.3.6, v3.3.5, v3.3.4, v3.3.2, v3.3.1, v3.3.0, v3.2.0, v3.1.1, v3.1.0].
- yiisoft/yii2-bootstrap 2.0.0 requires bower-asset/bootstrap 3.2.* | 3.1.* -> satisfiable by bower-asset/bootstrap[v3.2.0, v3.1.1, v3.1.0].
- Can only install one of: bower-asset/bootstrap[v3.3.2, v4.0.0].
- Can only install one of: bower-asset/bootstrap[v3.3.1, v4.0.0].
- Can only install one of: bower-asset/bootstrap[v3.3.0, v4.0.0].
- Can only install one of: bower-asset/bootstrap[v3.2.0, v4.0.0].
- Can only install one of: bower-asset/bootstrap[v3.1.1, v4.0.0].
- Can only install one of: bower-asset/bootstrap[v3.1.0, v4.0.0].
- yiisoft/yii2-bootstrap4 1.0.x-dev requires bower-asset/bootstrap ~4.0 -> satisfiable by bower-asset/bootstrap[v4.1.3, v4.1.2, v4.1.1, v4.1.0, v4.0.0].
- Conclusion: don't install bower-asset/bootstrap v4.1.0
- Installation request for yiisoft/yii2-debug ~2.0.0 -> satisfiable by yiisoft/yii2-debug[2.0.0, 2.0.1, 2.0.10, 2.0.11, 2.0.12, 2.0.13, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9].

Eliminate dependency popper BootstrapPluginAsset.php

We must eliminate the dependency of the package popper, since bootstrap deleted it from its repository and uses it as an independent dependency, we must create a new extension for pooper or add the package again without depending on BootstrapPluginAsset.php, but independent PopperAsset.

Q A
Yii vesion 3.0@dev
PHP version 7.1.17
Operating system Centos 7.0

How to use bootstrap-theme?

class BootstrapThemeAsset extends AssetBundle
{
    public $sourcePath = '@bower/bootstrap/dist';
    public $css = [
        'css/bootstrap-theme.css',
    ];
    public $depends = [
        'yii\bootstrap4\BootstrapAsset',
    ];
}

the css/bootstrap-theme.css file does not exist!

Travis HHVM fails because of PHPUnit

At this moment, all tests have been fixed and pass. Except HHVM.
The log (https://travis-ci.org/yiisoft/yii2-bootstrap4/jobs/432235776) says:

Fatal error: Uncaught Error: array_creation_expression is not allowed in write context in /home/travis/build/yiisoft/yii2-bootstrap4/vendor/phpunit/phpunit/src/Framework/TestCase.php:1270

The line in question:

    [$category, $locale] = $args;

Now I'm asking myself:

  1. Is testing against HHVM necessary?
  2. Is a failing HHVM run neglectable if all others pass?

Not Found PopperAsset.php

Yii: 2.0.15.

Hi composer.json:

"autoload": {
    "psr-4": {
        "yii\\bootstrap\\": "src"
    }
},

PopperAsset.php it is located in the root directory of the extension and not in the src directory,

Thks.

Add Branch 2.1 jquery free.

yii2.1 with bootstrap4 works well, we only have the problem of the different route of jquery in 2.0 and 2.1, seeing the roadmap of yii2.1 there are extensions that will be free of jquery, this is the time to do the same with bootstrap4 since You do not need jquery, as we are starting bootstrap4 it would be great to start with the new approaches.

#17

ActiveField radioList item rewritten

What steps will reproduce the problem?

<?php $form = ActiveForm::begin([
	'id' => 'form-step',
	'layout' => 'horizontal',
	**'fieldClass' => 'yii\bootstrap4\ActiveField',**
	'fieldConfig' => [
		'options' => ['class' => 'form-group row'],
		'horizontalCssClasses' => [
			'label' => 'col-lg-6',
			'error' => 'invalid-tooltip row px-3',
			'wrapper' => 'col-lg-6 position-relative',
		 ],
	],
	'options' => ['class' => 'pr-md-3 pr-lg-0 w-100'],
]) ?>
<?= $form->field($model, 'type', ['horizontalCssClasses' => ['wrapper' => 'col-xl-8 col-lg-10 position-relative']])->radioList(ArrayHelper::map($model->getTypeProject(), 'value', 'name'), [
	'class' => 'px-3 row',
	'aria-expanded' => 'true',
	'role' => 'listbox',
	**'item' => function** ($index, $label, $name, $checked, $value){
		switch ($index) {
			case 0:
				$checked = ' checked';
				$icon = Yii::$app->params['icon_equip'];
				break;
			case 1:
				$icon = Yii::$app->params['icon_mobile'];
				break;
			case 2:
				$icon = Yii::$app->params['icon_target'];
				break;
			case 3:
				$icon = Yii::$app->params['icon_speaker'];
				break;
			case 4:
				$icon = Yii::$app->params['icon_tower'];
				break;
			case 5:
				$icon = Yii::$app->params['icon_program'];
				break;
			default:
				$icon = false;
		}
		$return = "<div class='col-6 col-sm-4 px-0'>";
		$return .= "<input id='type-{$index}' type='radio' class='d-none check-type' name='{$name}' value='{$value}'" . $checked . ">";
		$return .= "<label for='type-{$index}' class='d-flex flex-column h-100 justify-content-center p-4 w-100'>";
		$return .= "<span class='mb-4'>{$icon}</span>";
		$return .= "<span class='corner'>{$label}</span>";
		$return .= '</label>';
		return .= "</div>";

		return $return;
	},
])->label(false) ?>

What's expected?

<div class="form-check">
<input type="radio" id="i0" class="form-check-input" name="AppForm[type]" value="0">
<label class="form-check-label" for="i0">123</label>
</div>

What do you get instead?

<div class="col-6 col-sm-4 px-0">
<input id="type-0" type="radio" class="d-none check-type" name="AppForm[type]" value="0" checked="">
<label for="type-0" class="d-flex flex-column h-100 justify-content-center p-4 w-100">
<span class="mb-4"><svg></svg></span>
<span class="corner">123</span>
</label>
</div>

Additional info

Q A
Yii vesion 2.0.16-dev
PHP version 7.2.8
Operating system Windows 10

yiisoft/yii2-bootstrap4 1.0.x-dev requires bower-asset/bootstrap ^4.1.0 -> no matching package found.

What steps will reproduce the problem?

  1. Add "yiisoft/yii2-bootstrap4": "~1.0.0", to composer.json
  2. Run composer update in command prompt window.

What's expected?

Successful installation.

What do you get instead?

Installation fails with

Problem 1
- Installation request for yiisoft/yii2-bootstrap4 ~1.0.0 -> satisfiable by yiisoft/yii2-bootstrap4[1.0.x-dev].
- yiisoft/yii2-bootstrap4 1.0.x-dev requires bower-asset/bootstrap ^4.1.0 -> no matching package found.

Additional info

Q A
Yii version 2.0.15.1
PHP version 7.2.9
Operating system Windows 10 Pro

I can't install this extension

What steps will reproduce the problem?

My app config:

'assetManager' => [
	'class' => 'yii\web\AssetManager',
	'bundles' => [
		'yii\web\JqueryAsset' => [
			'js' => [
				YII_ENV_DEV ? 'jquery.js' : 'jquery.min.js'
			]
		],
		'yii\bootstrap4\BootstrapAsset' => [
			'sourcePath' => null,
			'baseUrl' => 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1',
			'css' => [
				YII_ENV_DEV ? 'css/bootstrap.css' : 'css/bootstrap.min.css',
			]
		],
		'yii\bootstrap4\BootstrapPluginAsset' => [
			'sourcePath' => null,
			'baseUrl' => 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1',
			'js' => [
				YII_ENV_DEV ? 'js/bootstrap.js' : 'js/bootstrap.min.js',
				YII_ENV_DEV ? 'js/bootstrap.bundle.js' : 'js/bootstrap.bundle.min.js',
			]
		]
	],
],

composer.json config

"require": {
	"php": ">=5.4.0",
	"yiisoft/yii2": "~2.0.14",
	"yiisoft/yii2-bootstrap4": "~1.0.0",
	...
},
"replace": {
    "bower-asset/bootstrap": ">=3.3.0"
},

What's expected?

(1) I try uing Nav::widget

-->

(2) \vendor\yiisoft\yii2-bootstrap4\src\Dropdown.php at line 89
BootstrapPluginAsset::register($this->getView());

-->

(3) \vendor\yiisoft\yii2\web\AssetManager.php
The file or directory to be published does not exist: .../vendor\bower/bootstrap/assets/js/vendor

What do you get instead?

What did I do wrong?

Additional info

Q A
Yii vesion 2.0.15
PHP version 7.0.6
Operating system Win XAMPP

Draft a new release

Could you draft at least one release? Say, v0.1.0 or something like that.
We can't use this package in composer.json with "minimum-stability": "stable".

Class yii\web\JqueryAsset not found

https://github.com/yiisoft/yii2-bootstrap4/blob/master/src/BootstrapPluginAsset.php#L24

public $depends = [
     'yii\web\JqueryAsset',

But, https://github.com/yiisoft/yii2/blob/3.0/framework/UPGRADE.md

Assets yii\web\JqueryAsset, yii\web\YiiAsset, yii\validators\ValidationAsset have been moved under yii\jquery* namespace. Make sure you refer to the new full-qualified names of this classes.

Because of this, we get an error: Class yii\web\JqueryAsset not found...

Additional info

Q A
Yii vesion 3.0@dev
PHP version any
Operating system any

Preparing first stable release

This extension seems almost ready and is already totaling ~20k downloads :)
We should probably publish a first stable release into the wild and see how it plays.

We still need to:

  • Document some stuff: #25, #81, #83
  • Fix two layout problems: #36, #78
  • Switch to npm: #35 (PR #40)
  • #85 update dependency versions

@simialbi do you have the time to look at the open issues? (no pressure)

autoCloseItems Accordion::widget

Parameter autoCloseItems => true do not lead to the closure of other elements of the accordion

`
echo \yii\bootstrap4\Accordion::widget([

                   'options'=>['class' => ''],
	      'itemToggleOptions' => [
		      'tag'  => 'a',
		      'type' => false,
		      'class' => 'collapsed',
	      ],
	      'encodeLabels'=>false,
	      'autoCloseItems'=>true,
	      'items'             => []
      ])`

Something is missing...

What steps will reproduce the problem?

Install yii2 with basic config
Install bootstrap4 extension
Change asset import in main.php with bootstrap4 instead of boostrap
Generate a simple CRUD

What's expected?

Form validation error showing "red" message
glyph icons showing in table

What do you get instead?

Form validation stays black with message "cannot be blank"
glyph icons not showing

Additional info

Q A
Yii vesion 2.0.14
PHP version 7.1.12
Operating system Windows 10 (WAMP)

Bootstrap4 Tab Widget not working

What steps will reproduce the problem?

Add a BS4 tab widget to a page.
Click on the tabs ... nothing happens

What's expected?

Tab label html content should not show up
When you click on a tab, you should see the content for that tab

What do you get instead?

Tab label html shows up as code
tab border appears when you hover, but when you click, nothing happens

Additional info

screen shot 2019-02-19 at 8 42 02 am

Q A
Yii version 2.0.16
PHP version 7.1.23
Operating system macOS 10.14.3
jQuery 3.3.1

Change Class Toggle Button Navbar Bootstrap 4.1

Navbar.php

Current Code:

    Html::addCssClass($this->containerOptions, ['collapse' => 'collapse', 'widget' => 'navbar-toggleable-xs']);

BS 4.1 Code:

    Html::addCssClass($this->containerOptions, ['collapse' => 'collapse', 'widget' => 'navbar-collapse']);

Regards,

bootstrap 4.1.2 Invalid Argument – yii\base\InvalidArgumentException

What steps will reproduce the problem?

"require": {
    "php": ">=5.4.0",
    "yiisoft/yii2": "~2.0.14",
    "yiisoft/yii2-bootstrap4": "~1.0.0",
    "yiisoft/yii2-swiftmailer": "~2.0.0",
    "bower-asset/bootstrap": "4.*",
    "bower-asset/font-awesome": "4.*"
},

Causes Invalid Argument – yii\base\InvalidArgumentException
directory not found /vendor/bower-asset/bootstrap/js/vendor

I should use "bower-asset/bootstrap": "4.0.0" instead

There is no "vendor" folder in bootstrap for Popper.

What steps will reproduce the problem?

I used yii2-bootstrap4. That's all. When I am using PopperAsset it's giving the "The file or directory to be published does not exist: /../../vendor/bower-asset/bootstrap/assets/js/vendor". Seems the path is wrong. And seems right path: @bower/bootstrap/site/docs/4.1/assets/js/vendor

Link: https://github.com/twbs/bootstrap/blob/v4-dev/site/docs/4.1/assets/js/vendor/popper.min.js

Additional info

Q A
Yii vesion 2.0.16
PHP version 7.2
Operating system Linux

Remove encoding option in BaseHtml::staticControl

The reason is, because the value gets encoded either way (see https://github.com/yiisoft/yii2/blob/master/framework/helpers/BaseHtml.php#L1941)
So either the value gets double-encoded or it gets encoded when it shouldn't.
Currently there is no way to override this behavior.
So either the option gets removed from this extension and reduces configuration possibilities OR (which may break some stuff) the yii\helpers\BaseHtml gets changed.

What steps will reproduce the problem?

See https://github.com/yiisoft/yii2-bootstrap4/blob/master/tests/HtmlTest.php#L60
This second dataset for testStaticControl() doesn't pass a 'encoded' => false in the options, so by default, the value will get encoded the first time. Later, when the input tag gets rendered, the value gets encoded a second time, because $value !== null.

What's expected?

The value <html> should become &lt;html&gt;

What do you get instead?

The value <html> becomes &amp;lt;html&amp;gt; (double-encoded)

Additional info

Q A
Yii vesion ~2.0
PHP version 7.1
Operating system Wins10x64

Remove Collapse ?

Documentation reads:

  • [[yii\bootstrap4\Collapse|Collapse]] deprecated (see [[yii\bootstrap4\Accordion|Accordion]])

Since we're rolling out the first official stable release, shouldn't we remove it right away?

TravisCI build errors

I tried to fix the TravisCI build error. After a while I got the test suite to run completely on my local machine with a few tests still failing. But at least no more error.

What steps will reproduce the problem?

These would be the first important steps to fix the build process.

What's expected?

Test suite runs without errors.

What do you get instead?

...

Additional info

Q A
Yii vesion 2.0.14
PHP version 7.1
Operating system Win10

No Auto Update Packagist.org

Yii: 2.0.15.
PHP: 7.1

Hi packagist.org:

Current Update:

e98188106e7fb1ce5efb13ec1e39449f34ef5385

Cuurent Update Github:

5b4861a8f53f8029675e812d096e9c9a8a60294f

Thks,

Error when installing via composer

What steps will reproduce the problem?

Running composer require --prefer-dist yiisoft/yii2-bootstrap4

What's expected?

I was expecting Bootstrap 3 already installed to be updated to version 4

What do you get instead?

Got this error: Could not find a version of package yiisoft/yii2-bootstrap4 matching your minimum-stability (stable)...

Additional info

Q A
Yii vesion 2.0.15.1
PHP version 7.2.5RC1
Operating system Windows 7 pro

Can not install

Package json example

  "minimum-stability": "stable",
    "require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": "~2.0.14",
        "yiisoft/yii2-swiftmailer": "~2.0.0",
        "yiisoft/yii2-bootstrap4": "~1.0.0"
    },

Result

The requested package yiisoft/yii2-bootstrap4 ~1.0.0 is satisfiable by yiisoft/yii2-bootstrap4[1.0.x-dev] but these conflict with your requirements or minimum-stability.

Q A
Yii vesion latest
PHP version 5.4
Operating system Mac OS

Dropdown does not cascade `encodeLabels` in `renderItems`

What steps will reproduce the problem?

The Dropdown::encodeLabels property is not cascaded to lower children submenu levels. This is because Line 136 does not use the encodeLabels setting when making the recursive call to the widget.

What's expected?

All child menu levels should use the Dropdown::encodeLabels if item level encode setting is not set.

What do you get instead?

Only first menu level uses the encodeLabels property - not the child levels. I will be submitting a PR #56 to correct this.

Additional info

Q A
Yii vesion 2.x
PHP version 7.x
Operating system All

Migrating from yii2-bootstrap

It would be nice to include a paragraph or more in the docs about what's required to upgrade from yii2-bootstrap to this extension.

Is there any changes that people would be confused about? Any quick adaptations that come to mind?

Make container optional for `ButtonDropdown`

What steps will reproduce the problem?

The ButtonDropdown always renders a <div class="dropdown"> container. This should be made optional - as it is not required for rendering within a form input group as seen here.

What's expected?

ButtonDropdown container should be made optional via a property.

What do you get instead?

Currently container is always rendered. Will update over PR # 56.

Additional info

Q A
Yii vesion 2.x
PHP version 7.x
Operating system All

using bootstrap4 cdn on yii2-advanced template?

I'm trying to use Bootstrap4 through the official CDN. I followed the steps as outlined in the assets setup but when I try to run the program I get an error that says "Class yii\bootstrap4\BootstrapAsset does not exist". I would rather use the CDN than download a package; is it even possible? I did so many web searches but I couldn't figure out how to get things to work.

I configured assetManager in /frontend/config/main.php as the guide told me to and copied the following into the composer.json file:
"replace": { "bower-asset/bootstrap": ">=4.1.1" },

Can't figure out how to get it to work. Any help would be appreciated, thanks!

Q A
Yii vesion Latest stable release 2.*
PHP version 7.*
Operating system Windows

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.