From 3d1e94b4b2d9163043b06e5f5c187f05f26591dc Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Fri, 6 Dec 2024 03:33:37 -0300 Subject: [PATCH] Sync `yiisoft/yii-bootstrap5` package last changes. (#635) * Update carousel bootstrap5. * Update alert bootstrap5. * Update alert bootstrap5. * Update blog/resources/messages/en/app.php Co-authored-by: Sergei Predvoditelev * Update blog/resources/messages/en/app.php Co-authored-by: Sergei Predvoditelev * Fix pagination namespace and update row attributes in user index view. --------- Co-authored-by: Sergei Predvoditelev --- blog/resources/messages/de/app.php | 9 +++-- blog/resources/messages/en/app.php | 9 +++-- blog/resources/messages/id/app.php | 9 +++-- blog/resources/messages/ru/app.php | 9 +++-- blog/resources/messages/sk/app.php | 9 +++-- blog/resources/views/blog/post/__form.php | 4 +-- blog/resources/views/site/index.php | 41 +++++++++++++---------- blog/resources/views/user/index.php | 4 +-- blog/src/Widget/FlashMessage.php | 4 +-- 9 files changed, 58 insertions(+), 40 deletions(-) diff --git a/blog/resources/messages/de/app.php b/blog/resources/messages/de/app.php index d79a610d..7477d36d 100644 --- a/blog/resources/messages/de/app.php +++ b/blog/resources/messages/de/app.php @@ -8,9 +8,12 @@ 'gridview.login' => 'Anmelden', 'gridview.profile' => 'Profil', 'gridview.title' => 'Liste der Benutzer', - 'home.caption.slide1' => '
Hello, everyone!

Ein toller Tag, um Yii 3 auszuprobieren, richtig?

', - 'home.caption.slide2' => '
Der Code wartet!

Schau dir den Projektcode an. Er ist nicht ideal, da es sich auch um eine Entwicklungs-Sandbox handelt, bietet aber einen mittelmäßigen Überblick über die Funktionen von Yii 3.

', - 'home.caption.slide3' => '
Wir brauchen Rückmeldungen!

Bitte gib uns deine Rückmeldungen über die im README genannten Telegram- und Slack-Kanäle.

', + 'home.caption.slide1' => 'Hello, everyone!', + 'home.caption.placeholder1' => 'Ein toller Tag, um Yii 3 auszuprobieren, richtig?', + 'home.caption.slide2' => 'Der Code wartet!', + 'home.caption.placeholder2' => 'Schau dir den Projektcode an. Er ist nicht ideal, da es sich auch um eine Entwicklungs-Sandbox handelt, bietet aber einen mittelmäßigen Überblick über die Funktionen von Yii 3.', + 'home.caption.slide3' => 'Wir brauchen Rückmeldungen!', + 'home.caption.placeholder3' => 'Bitte gib uns deine Rückmeldungen über die im README genannten Telegram- und Slack-Kanäle.', 'layout.add.post' => 'Neuer Beitrag', 'layout.add.random-content' => 'Füge zufälligen Inhalt ein', 'layout.add.tag' => 'Neues Stichwort', diff --git a/blog/resources/messages/en/app.php b/blog/resources/messages/en/app.php index d26e3d3c..a9695c60 100644 --- a/blog/resources/messages/en/app.php +++ b/blog/resources/messages/en/app.php @@ -8,9 +8,12 @@ 'gridview.login' => 'Login', 'gridview.profile' => 'Profile', 'gridview.title' => 'List of users', - 'home.caption.slide1' => '
Hello, everyone!

A great day to try Yii 3, right?

', - 'home.caption.slide2' => '
Code awaits!

Check the project code. It\'s not ideal since it\'s a development sandbox as well, but gives a so-so overview of Yii 3 capabilities.

', - 'home.caption.slide3' => '
We need feedback!

Please leave your feedback in either Telegram or Slack mentioned in README.

', + 'home.caption.slide1' => 'Hello, everyone!', + 'home.caption.placeholder1' => 'A great day to try Yii3, right?', + 'home.caption.slide2' => 'Code awaits!', + 'home.caption.placeholder2' => 'Check the project code. It\'s not ideal since it\'s a development sandbox as well, but gives a so-so overview of Yii3 capabilities.', + 'home.caption.slide3' => 'We need feedback!', + 'home.caption.placeholder3' => 'Please leave your feedback in either Telegram or Slack mentioned in README.', 'layout.add.post' => 'Add post', 'layout.add.random-content' => 'Add random content', 'layout.add.tag' => 'Add tag', diff --git a/blog/resources/messages/id/app.php b/blog/resources/messages/id/app.php index 2d19202d..dd4b6129 100644 --- a/blog/resources/messages/id/app.php +++ b/blog/resources/messages/id/app.php @@ -10,9 +10,12 @@ 'gridview.api' => 'API', 'gridview.profile' => 'Profil', 'gridview.title' => 'Daftar pengguna', - 'home.caption.slide1' => '
Halo semuanya!

Hari yang menyenangkan untuk mencoba Yii 3, bukan?

', - 'home.caption.slide2' => '
Menunggu kode!

Periksa kode proyek. Ini tidak ideal karena ini juga merupakan sandbox pengembangan, tetapi memberikan gambaran umum tentang kemampuan Yii 3.

', - 'home.caption.slide3' => 'Kami membutuhkan umpan balik!

Silakan tinggalkan umpan balik Anda di Telegram atau Slack yang disebutkan di README.

', + 'home.caption.slide1' => 'Halo semuanya!', + 'home.caption.placeholder1' => 'Hari yang menyenangkan untuk mencoba Yii 3, bukan?', + 'home.caption.slide2' => 'Menunggu kode!', + 'home.caption.placeholder2' => 'Periksa kode proyek. Ini tidak ideal karena ini juga merupakan sandbox pengembangan, tetapi memberikan gambaran umum tentang kemampuan Yii 3.', + 'home.caption.slide3' => 'Kami membutuhkan umpan balik!', + 'home.caption.placeholder3' => 'Silakan tinggalkan umpan balik Anda di Telegram atau Slack yang disebutkan di README.', 'layout.add.post' => 'Tambahkan postingan', 'layout.add.random-content' => 'Tambahkan konten acak', 'layout.add.tag' => 'Tambahkan tag', diff --git a/blog/resources/messages/ru/app.php b/blog/resources/messages/ru/app.php index e81ed158..86e90c5f 100644 --- a/blog/resources/messages/ru/app.php +++ b/blog/resources/messages/ru/app.php @@ -8,9 +8,12 @@ 'gridview.api' => 'API', 'gridview.profile' => 'Профиль', 'gridview.title' => 'Список пользователей', - 'home.caption.slide1' => '
Всем привет!

Отличный день чтобы попробовать Yii 3!

', - 'home.caption.slide2' => '
Код ждёт!

Изучите код проекта. Он не идеален потому как это ещё и песочница разработчиков, но даёт представление о том, что может Yii 3.

', - 'home.caption.slide3' => '
Нам нужна обратная связь!

Оствляйте её в Telegram или Slack, которые можно найти в README.

', + 'home.caption.slide1' => 'Всем привет!', + 'home.caption.placeholder1' => 'Отличный день чтобы попробовать Yii 3!', + 'home.caption.slide2' => 'Код ждёт!', + 'home.caption.placeholder2' => 'Изучите код проекта. Он не идеален потому как это ещё и песочница разработчиков, но даёт представление о том, что может Yii 3.', + 'home.caption.slide3' => 'Нам нужна обратная связь!', + 'home.caption.placeholder3' => 'Оствляйте её в Telegram или Slack, которые можно найти в README.', 'layout.add.post' => 'Добавить пост', 'layout.add.random-content' => 'Добавить случайный контент', 'layout.add.tag' => 'Добавить тег', diff --git a/blog/resources/messages/sk/app.php b/blog/resources/messages/sk/app.php index 6d07f949..1a0bac2f 100644 --- a/blog/resources/messages/sk/app.php +++ b/blog/resources/messages/sk/app.php @@ -8,9 +8,12 @@ 'gridview.api' => 'API', 'gridview.profile' => 'Profil', 'gridiview.title' => 'Zoznam používateľov', - 'home.caption.slide1' => '
Dobrý deň!

Možno je ten správny deň, skúsiť nový Yii 3 framework!

', - 'home.caption.slide2' => '
Kód už čaká na Vás!

Naučte sa syntax kódu projektu. Nie je ešte ideálny, pretože je to ešte hračka v rukách developerov, ale Vám dá aspoň predstavu, čo Yii3 dokáže už dnes.

', - 'home.caption.slide3' => '
Potrebujeme poznať Váš názor!

Kontaktujte nás cez Telegram alebo Slack, detaily nájdete v súbore README.

', + 'home.caption.slide1' => 'Dobrý deň!', + 'home.caption.placeholder1' => 'Možno je ten správny deň, skúsiť nový Yii 3 framework!', + 'home.caption.slide2' => 'Kód už čaká na Vás!', + 'home.caption.placeholder2' => 'Naučte sa syntax kódu projektu. Nie je ešte ideálny, pretože je to ešte hračka v rukách developerov, ale Vám dá aspoň predstavu, čo Yii3 dokáže už dnes.', + 'home.caption.slide3' => 'Potrebujeme poznať Váš názor!', + 'home.caption.placeholder3' => 'Kontaktujte nás cez Telegram alebo Slack, detaily nájdete v súbore README.', 'layout.add.post' => 'Pridať príspevok', 'layout.add.random-content' => 'Vytvoriť náhodný obsah', 'layout.add.tag' => 'Pridať tag', diff --git a/blog/resources/views/blog/post/__form.php b/blog/resources/views/blog/post/__form.php index afed55da..c197c717 100644 --- a/blog/resources/views/blog/post/__form.php +++ b/blog/resources/views/blog/post/__form.php @@ -21,9 +21,7 @@ if (!empty($errors)) { foreach ($errors as $field => $error) { - echo Alert::widget() - ->options(['class' => 'alert-danger']) - ->body(Html::encode($field . ':' . $error)); + echo Alert::widget()->addClass('alert-danger')->body(Html::encode($field . ':' . $error)); } } ?> diff --git a/blog/resources/views/site/index.php b/blog/resources/views/site/index.php index 8e1796bb..4d384ad0 100644 --- a/blog/resources/views/site/index.php +++ b/blog/resources/views/site/index.php @@ -2,9 +2,11 @@ declare(strict_types=1); +use Yiisoft\Html\Tag\Div; use Yiisoft\Translator\TranslatorInterface; use Yiisoft\View\WebView; use Yiisoft\Yii\Bootstrap5\Carousel; +use Yiisoft\Yii\Bootstrap5\CarouselItem; /** * @var TranslatorInterface $translator @@ -13,23 +15,28 @@ $this->setTitle('Home'); echo Carousel::widget() - ->items([ - [ - 'content' => '
', - 'caption' => $translator->translate('home.caption.slide1'), - 'captionOptions' => ['class' => ['d-none', 'd-md-block']], - ], - [ - 'content' => '
', - 'caption' => $translator->translate('home.caption.slide2'), - 'captionOptions' => ['class' => ['d-none', 'd-md-block']], - ], - [ - 'content' => '
', - 'caption' => $translator->translate('home.caption.slide3'), - 'captionOptions' => ['class' => ['d-none', 'd-md-block']], - ], - ]); + ->captionTagName('h2') + ->items( + new CarouselItem( + Div::tag()->addAttributes(['style' => 'height: 200px'])->addClass('d-block w-100 bg-info'), + $translator->translate('home.caption.slide1'), + $translator->translate('home.caption.placeholder1'), + captionAttributes: ['class' => ['d-none', 'd-md-block']], + ), + new CarouselItem( + Div::tag()->addAttributes(['style' => 'height: 200px'])->addClass('d-block w-100 bg-secondary'), + $translator->translate('home.caption.slide2'), + $translator->translate('home.caption.placeholder2'), + captionAttributes: ['class' => ['d-none', 'd-md-block']], + ), + new CarouselItem( + Div::tag()->addAttributes(['style' => 'height: 200px'])->addClass('d-block w-100 bg-dark'), + $translator->translate('home.caption.slide3'), + $translator->translate('home.caption.placeholder3'), + captionAttributes: ['class' => ['d-none', 'd-md-block']], + ), + ) + ->showIndicators(); ?> diff --git a/blog/resources/views/user/index.php b/blog/resources/views/user/index.php index 7720e207..7a088073 100644 --- a/blog/resources/views/user/index.php +++ b/blog/resources/views/user/index.php @@ -18,7 +18,7 @@ use Yiisoft\View\WebView; use Yiisoft\Yii\DataView\Column\DataColumn; use Yiisoft\Yii\DataView\GridView; -use Yiisoft\Yii\DataView\OffsetPagination; +use Yiisoft\Yii\DataView\Pagination\OffsetPagination; /** * @var string $csrf @@ -135,7 +135,7 @@ ->paginator($paginator) ->render(), ) - ->rowAttributes(['class' => 'align-middle']) + ->headerRowAttributes(['class' => 'align-middle']) ->summaryAttributes(['class' => 'summary text-end mb-5']) ->tableAttributes(['class' => 'table table-hover']) ->toolbar( diff --git a/blog/src/Widget/FlashMessage.php b/blog/src/Widget/FlashMessage.php index 3f4b549e..0378519e 100644 --- a/blog/src/Widget/FlashMessage.php +++ b/blog/src/Widget/FlashMessage.php @@ -21,9 +21,7 @@ public function render(): string $html = []; foreach ($flashes as $type => $data) { foreach ($data as $message) { - $html[] = Alert::widget() - ->options(['class' => "alert-{$type} shadow"]) - ->body($message['body']); + $html[] = Alert::widget()->addClass("alert-{$type} shadow")->body($message['body']); } }