From 8362e6d6d911a77d7c74fdcd5a6497cf2fe47548 Mon Sep 17 00:00:00 2001 From: Natan Felles Date: Tue, 1 Nov 2022 20:53:33 -0300 Subject: [PATCH] Add support for W3.CSS framework --- .phpstorm.meta.php | 4 ++++ guide/index.rst | 1 + src/Pager.php | 5 +++++ src/Views/w3-short.php | 29 ++++++++++++++++++++++++ src/Views/w3.php | 51 ++++++++++++++++++++++++++++++++++++++++++ tests/PagerTest.php | 5 +++++ 6 files changed, 95 insertions(+) create mode 100644 src/Views/w3-short.php create mode 100644 src/Views/w3.php diff --git a/.phpstorm.meta.php b/.phpstorm.meta.php index ae5ffa2..dbcafc1 100644 --- a/.phpstorm.meta.php +++ b/.phpstorm.meta.php @@ -42,6 +42,10 @@ 'tailwind-short', 'tailwind3', 'tailwind3-short', + 'w3', + 'w3-short', + 'w34', + 'w34-short', ); expectedArguments( \Framework\Pagination\Pager::getView(), diff --git a/guide/index.rst b/guide/index.rst index 49f67a2..0776de2 100644 --- a/guide/index.rst +++ b/guide/index.rst @@ -166,6 +166,7 @@ The Aplus Framework Pagination Library works with the following front-end framew - `Primer `_ - `Semantic UI `_ - `Tailwind `_ +- `W3.CSS `_ Note that it is necessary to load links from CSS files. diff --git a/src/Pager.php b/src/Pager.php index 010d7d9..07ccc0c 100644 --- a/src/Pager.php +++ b/src/Pager.php @@ -78,6 +78,11 @@ class Pager implements JsonSerializable 'tailwind-short' => __DIR__ . '/Views/tailwind-short.php', 'tailwind3' => __DIR__ . '/Views/tailwind.php', 'tailwind3-short' => __DIR__ . '/Views/tailwind-short.php', + // W3.CSS 4 + 'w3' => __DIR__ . '/Views/w3.php', + 'w3-short' => __DIR__ . '/Views/w3-short.php', + 'w34' => __DIR__ . '/Views/w3.php', + 'w34-short' => __DIR__ . '/Views/w3-short.php', ]; protected string $defaultView = 'pagination'; protected URL $url; diff --git a/src/Views/w3-short.php b/src/Views/w3-short.php new file mode 100644 index 0000000..5da0ced --- /dev/null +++ b/src/Views/w3-short.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +/** + * @var Framework\Pagination\Pager $pager + */ +$language = $pager->getLanguage(); +?> +
+
+ getPreviousPage()) : ?> + + + + getNextPage()) : ?> + + +
+
diff --git a/src/Views/w3.php b/src/Views/w3.php new file mode 100644 index 0000000..75156e2 --- /dev/null +++ b/src/Views/w3.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +/** + * @var Framework\Pagination\Pager $pager + */ +$language = $pager->getLanguage(); +?> +
+
+ getCurrentPage() - $pager->getSurround() > 1) : ?> + getLanguage() + ->render('pagination', 'first') ?> + + + getPreviousPage()) : ?> + + + + getPreviousPagesUrls() as $p => $url) : ?> + + + + + getCurrentPage() ?> + + + getNextPagesUrls() as $p => $url) : ?> + + + + getNextPage() && $pager->getNextPage() < $pager->getLastPage() + 1) : ?> + + + + getLastPage() + && $pager->getCurrentPage() + $pager->getSurround() < $pager->getLastPage() + ) : ?> + getLanguage() + ->render('pagination', 'last') ?> + +
+
diff --git a/tests/PagerTest.php b/tests/PagerTest.php index d0ed106..615e18d 100644 --- a/tests/PagerTest.php +++ b/tests/PagerTest.php @@ -201,6 +201,10 @@ public function testViews() : void 'tailwind-short' => \realpath(__DIR__ . '/../src/Views/tailwind-short.php'), 'tailwind3' => \realpath(__DIR__ . '/../src/Views/tailwind.php'), 'tailwind3-short' => \realpath(__DIR__ . '/../src/Views/tailwind-short.php'), + 'w3' => \realpath(__DIR__ . '/../src/Views/w3.php'), + 'w3-short' => \realpath(__DIR__ . '/../src/Views/w3-short.php'), + 'w34' => \realpath(__DIR__ . '/../src/Views/w3.php'), + 'w34-short' => \realpath(__DIR__ . '/../src/Views/w3-short.php'), ]; self::assertSame($views, $this->pager->getViews()); $this->pager->setView('foo', __FILE__); @@ -304,6 +308,7 @@ public function viewsProvider() : array ['primer'], ['semantic-ui'], ['tailwind'], + ['w3'], ]; }