Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs folder standardization and other fixes #91

Merged
merged 3 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Copyright © 2008 by Yii Software (https://www.yiiframework.com/)
Copyright © 2008 by Yii Software (<https://www.yiiframework.com/>)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

* Redistributions of source code must retain the above copyright
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Yii Software nor the names of its
* Neither the name of Yii Software nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

Expand Down
72 changes: 21 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
This [Yii Framework](https://www.yiiframework.com/) package encapsulates [Bulma](https://bulma.io) components
and plugins in terms of Yii widgets, and thus makes using Bulma components/plugins in Yii applications convenient.

## Requirements

- PHP 8.0 or higher.

## Installation

```shell
Expand All @@ -31,9 +35,9 @@ composer require yiisoft/yii-bulma --prefer-dist

There are several ways to install the assets, they are:

1.- Using the [AssetPackagist](https://asset-packagist.org/) package manager.
1. Using the [AssetPackagist](https://asset-packagist.org/) package manager.

Add to composer.json the following:
Add to composer.json file the following:

```json
{
Expand Down Expand Up @@ -68,7 +72,7 @@ Once the changes are made, you can install the assets using the following comman
composer update --prefer-dist
```

2.- Using the [npm-asset](https://www.npmjs.com/) package manager.
2. Using the [npm-asset](https://www.npmjs.com/) package manager.

Run the following command at the root directory of your application.

Expand Down Expand Up @@ -100,7 +104,6 @@ By registering the Asset in the `resources/layout/main.php` it will be available
If you need it registered for individual view (such as `resources/views/site/contact.php`) only,
register it in that view.


```php
use Yiisoft\Yii\Bulma\Asset\BulmaAsset;

Expand Down Expand Up @@ -141,64 +144,31 @@ $this->setCssFiles($assetManager->getCssFiles());
$this->setJsFiles($assetManager->getJsFiles());
```

## Widgets usage

We will quickly and easily describe how to use widgets, and be able to use all the power of
the Bulma CSS framework with PHP:
## Documentation

- [Breadcrumbs](docs/breadcrumbs.md)
- [Dropdown](docs/dropdown.md)
- [Menu](docs/menu.md)
- [Message](docs/message.md)
- [Modal](docs/modal.md)
- [ModalCard](docs/modalcard.md)
- [NavBar](docs/navbar.md)
- [Panel](docs/panel.md)
- [ProgressBar](docs/progressbar.md)
- [Tabs](docs/tabs.md)
- [Guides](docs/guide/README.md)
- [Internals](docs/internals.md)

## Testing
## Support

### Unit testing

The package is tested with [PHPUnit](https://phpunit.de/). To run tests:

```shell
./vendor/bin/phpunit
```
If you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that.
You may also check out other [Yii Community Resources](https://www.yiiframework.com/community).

### Mutation testing
## Support the project

The package tests are checked with [Infection](https://infection.github.io/) mutation framework with
[Infection Static Analysis Plugin](https://github.com/Roave/infection-static-analysis-plugin). To run it:

```shell
./vendor/bin/roave-infection-static-analysis-plugin
```

### Static analysis
[![Open Collective](https://img.shields.io/badge/Open%20Collective-sponsor-7eadf1?logo=open%20collective&logoColor=7eadf1&labelColor=555555)](https://opencollective.com/yiisoft)

The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:
## Follow updates

```shell
./vendor/bin/psalm
```
[![Official website](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](https://www.yiiframework.com/)
[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter&logoColor=1DA1F2&labelColor=555555?style=flat)](https://twitter.com/yiiframework)
[![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat&logo=telegram)](https://t.me/yii3en)
[![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat&logo=facebook&logoColor=ffffff)](https://www.facebook.com/groups/yiitalk)
[![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat&logo=slack)](https://yiiframework.com/go/slack)

## License

The Yii Framework Bulma Integration is free software. It is released under the terms of the BSD License.
Please see [`LICENSE`](./LICENSE.md) for more information.

Maintained by [Yii Software](https://www.yiiframework.com/).

### Support the project

[![Open Collective](https://img.shields.io/badge/Open%20Collective-sponsor-7eadf1?logo=open%20collective&logoColor=7eadf1&labelColor=555555)](https://opencollective.com/yiisoft)

### Follow updates

[![Official website](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](https://www.yiiframework.com/)
[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter&logoColor=1DA1F2&labelColor=555555?style=flat)](https://twitter.com/yiiframework)
[![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat&logo=telegram)](https://t.me/yii3en)
[![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat&logo=facebook&logoColor=ffffff)](https://www.facebook.com/groups/yiitalk)
[![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat&logo=slack)](https://yiiframework.com/go/slack)
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"issues": "https://github.com/yiisoft/yii-bulma/issues?state=open",
"forum": "https://www.yiiframework.com/forum/",
"wiki": "https://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"irc": "ircs://irc.libera.chat:6697/yii",
"chat": "https://t.me/yii3en",
"source": "https://github.com/yiisoft/yii-bulma"
},
Expand Down
5 changes: 5 additions & 0 deletions docs/guide/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Yii Framework Bulma Integration

- [English](en/README.md)
- [Português - Brasil](pt-BR/README.md)
- [Internals](internals.md)
17 changes: 17 additions & 0 deletions docs/guide/en/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Yii Framework Bulma Integration

## Widgets usage

We will quickly and easily describe how to use widgets, and be able to use all the power of
the Bulma CSS framework with PHP:

- [Breadcrumbs](breadcrumbs.md)
- [Dropdown](dropdown.md)
- [Menu](menu.md)
- [Message](message.md)
- [Modal](modal.md)
- [ModalCard](modalcard.md)
- [NavBar](navbar.md)
- [Panel](panel.md)
- [ProgressBar](progressbar.md)
- [Tabs](tabs.md)
88 changes: 88 additions & 0 deletions docs/guide/en/breadcrumbs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Breadcrumbs widget

### [The Bulma breadcrumb](https://bulma.io/documentation/components/breadcrumb/) is a simple navigation component

<p align="center">
</br>
<img src="../../image/breadcrumbs.png">
</p>

## Usage

```php
<?php
use Yiisoft\Yii\Bulma\Breadcrumbs;
use Yiisoft\Yii\Bulma\Asset\BulmaAsset;

/* Register assets in view */

$assetManager->register(BulmaAsset::class);

$this->setCssFiles($assetManager->getCssFiles());
$this->setJsFiles($assetManager->getJsFiles());
?>

// The Font-Awesome Asset must be added, in this case we are going to use an external library.
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>

<?= Breadcrumbs::widget()
->attributes(['class' => 'is-centered'])
->homeItem([
'label' => 'Index',
'url' => '/index',
'icon' => 'fas fa-home',
'iconAttributes' => ['class' => 'icon']
])
->items([
[
'label' => 'About',
'url' => '/about',
'icon' => 'fas fa-thumbs-up',
'iconAttributes' => ['class' => 'icon']
]
])
->render() ?>
```

The code above generates the following HTML:

```html
<nav id="w71391357285001-breadcrumbs" class="is-centered breadcrumb" aria-label="breadcrumbs">
<ul>
<li><span class="icon"><i class="fas fa-home"></i></span><a href="/index">Index</a></li>
<li><span class="icon"><i class="fas fa-thumbs-up"></i></span><a href="/about">About</a></li>
</ul>
</nav>
```

## Setters

All setters are immutable and return a new instance of the `Yiisoft\Yii\Bulma\Breadcrumbs` class with the specified value.

Method | Description | Default
-------|-------------|---------
`activeItemTemplate(string $value)`| Template used to render each active item in the breadcrumbs. | `<li class=\"is-active\"><a aria-current=\"page\">{link}</a></li>\n`
`ariaLabel` | Defines a string value that labels the current element. | `breadcrumbs`
`attributes(array $value)` | HTML attributes for the widget container nav tag. | `[]`
`autoIdPrefix(string $value)` | Prefix to the automatically generated widget ID. | `w`
`encode()` | Enable/Disable encoding for labels. | `false`
`homeItem(?array $value)` | The first item in the breadcrumbs (called home link). | `['label' => 'Home', 'url' => '/']`
`id(string $value)` | Widget ID. | `''`
`items(array $value)` | List of items to appear in the breadcrumbs. | `[]`
`itemsAttributes(array $value)` | HTML attributes for the items widget. | `[]`
`itemTemplate(string $value)` | Template used to render each inactive item in the breadcrumbs. | `<li>{icon}{link}</li>\n`

### Items structure is an array of the following structure

```php
[
[
'label' => 'Home',
'url' => '/',
'template' => '<li><a href="{url}">{icon}{label}</a></li>',
'encode' => true,
'icon' => 'fas fa-home',
'iconAttributes' => ['class' => 'icon'],
],
]
```
File renamed without changes.
File renamed without changes.
5 changes: 1 addition & 4 deletions docs/message.md → docs/guide/en/message.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Message widget

### [The message component](https://bulma.io/documentation/components/message/) displays a message like the following:
### [The message component](https://bulma.io/documentation/components/message/) displays a message like the following

<p align="center">
</br>
Expand All @@ -20,9 +20,6 @@ necessary JavaScript. Alternatively, you can use your own JavaScript code.

```php
<?php

declare(strict_types=1);

use Yiisoft\Yii\Bulma\Message;
use Yiisoft\Yii\Bulma\Asset\BulmaAsset;
use Yiisoft\Yii\Bulma\Asset\BulmaJsAsset;
Expand Down
12 changes: 5 additions & 7 deletions docs/modal.md → docs/guide/en/modal.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@
A base [modal](https://bulma.io/documentation/components/modal/) overlay, in which you can include any content you want

The modal structure:

- `modal`: the main container
- `modal-background`: a transparent overlay that can act as a click target to close the modal
- `modal-content`: a horizontally and vertically centered container, in which you can include any content
- `modal-close`: a simple cross located in the top right corner
- `modal-background`: a transparent overlay that can act as a click target to close the modal
- `modal-content`: a horizontally and vertically centered container, in which you can include any content
- `modal-close`: a simple cross located in the top right corner

<p align="center">
</br>
<img src="images/modal.png">
</p>
</p>

## Usage

```php
<?php

declare(strict_types=1);

use Yiisoft\Html\Html;
use Yiisoft\Yii\Bulma\Modal;
use Yiisoft\Yii\Bulma\Asset\BulmaAsset;
Expand Down
17 changes: 7 additions & 10 deletions docs/modalcard.md → docs/guide/en/modalcard.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@
</p>

The modal structure:

- `modal`: the main container
- `modal-background`: a transparent overlay that can act as a click target to close the modal
- `modal-card`: ...
- `modal-card-head`: ...
- `modal-card-title`: ...
- `modal-card-body`: ...
- `modal-card-foot`: ...
- `modal-background`: a transparent overlay that can act as a click target to close the modal
- `modal-card`: ...
- `modal-card-head`: ...
- `modal-card-title`: ...
- `modal-card-body`: ...
- `modal-card-foot`: ...

## Usage

```php
<?php

declare(strict_types=1);

use Yiisoft\Html\Html;
use Yiisoft\Html\Tag\Button;
use Yiisoft\Html\Tag\P;
Expand Down Expand Up @@ -127,4 +125,3 @@ Method | Description | Default
`toggleButtonSize(string $value)` | Toggle button size. Options available are: (`ModalCard::SIZE_SMALL`, `ModalCard::SIZE_MEDIUM`, `ModalCard::SIZE_LARGE`). | Default setting is "normal".
`withoutCloseButton(bool $value)` | Whether the close button is disabled. | `false`
`withoutToggleButton(bool $value)` | Whether the toggle button is disabled. | `false`

7 changes: 2 additions & 5 deletions docs/navbar.md → docs/guide/en/navbar.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Navbar and nav widget

### [The navbar component](https://bulma.io/documentation/components/navbar/) is a responsive and versatile horizontal navigation bar.
### [The navbar component](https://bulma.io/documentation/components/navbar/) is a responsive and versatile horizontal navigation bar

<p align="center">
</br>
Expand Down Expand Up @@ -33,9 +33,6 @@ You can use Navbar the following way:

```php
<?php

declare(strict_types=1);

use Yiisoft\Yii\Bulma\Nav;
use Yiisoft\Yii\Bulma\NavBar;
use Yiisoft\Yii\Bulma\Asset\BulmaAsset;
Expand Down Expand Up @@ -166,7 +163,7 @@ Method | Description | Default
`items(array $value)` | The menu items. | `[]`
`withoutActivateItems()` | Disable activate items according to whether their currentPath. | `false`

### Items structure is an array of the following structure:
### Items structure is an array of the following structure

```php
[
Expand Down
5 changes: 1 addition & 4 deletions docs/panel.md → docs/guide/en/panel.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

```php
<?php

declare(strict_types=1);

use Yiisoft\Yii\Bulma\Panel;
use Yiisoft\Yii\Bulma\Asset\BulmaAsset;
use Yiisoft\Yii\Bulma\Asset\BulmaJsAsset;
Expand Down Expand Up @@ -136,7 +133,7 @@ Method | Description | Default
`tabsAttributes(array $value)` | HTML attributes for the tabs container tag. | `[]`
`template(string $value)` | String the template for rendering panel. | `{panelBegin}{panelHeading}{panelTabs}{panelItems}{panelEnd}`

### Tabs structure is an array of the following structure:
### Tabs structure is an array of the following structure

```php
[
Expand Down
3 changes: 0 additions & 3 deletions docs/progressbar.md → docs/guide/en/progressbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ In progress widget looks like this:

```php
<?php

declare(strict_types=1);

use Yiisoft\Yii\Bulma\ProgressBar;
use Yiisoft\Yii\Bulma\Asset\BulmaAsset;

Expand Down
Loading
Loading