diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 9d357d294f..a2148289b8 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -117,6 +117,8 @@ private function mapWebRoutes(): void 'namespace' => $this->namespace, 'middleware' => 'web', ], function () { + (new \V3\Controller())->setupEndpoints(); + require base_path('routes/auth.php'); require base_path('routes/misc.php'); require base_path('routes/forum.php'); diff --git a/composer.json b/composer.json index 7488aab658..5008c38eff 100644 --- a/composer.json +++ b/composer.json @@ -70,6 +70,7 @@ "Boduch\\Grid\\": "grid/", "Coyote\\": "app/", "Neon\\": "neon/src/", + "V3\\": "v3/src/", "Database\\Seeders\\": "database/seeders/" }, "files": [ @@ -84,7 +85,8 @@ "Tests\\Grid\\": "tests/Grid/", "Tests\\Legacy\\": "tests/Legacy/", "Tests\\Unit\\": "tests/Unit/", - "Neon\\Test\\": "neon/test/" + "Neon\\Test\\": "neon/test/", + "V3\\Test\\": "v3/test/" }, "files": [ "neon/test/BaseFixture/Caught/caught.php" diff --git a/config/twigbridge.php b/config/twigbridge.php index f826144eb4..540da2dcf1 100644 --- a/config/twigbridge.php +++ b/config/twigbridge.php @@ -62,6 +62,8 @@ 'Coyote\Services\TwigBridge\Extensions\Media', 'Coyote\Services\TwigBridge\Extensions\Icon', 'Coyote\Services\TwigBridge\Extensions\Vue', + + 'V3\Web\Twig\Extension', ], /* diff --git a/config/view.php b/config/view.php index a4009f5619..af070e12a6 100644 --- a/config/view.php +++ b/config/view.php @@ -14,7 +14,8 @@ */ 'paths' => [ - realpath(base_path('resources/views')) + realpath(base_path('resources/views')), + realpath(base_path('v3/src/Web/view')), ], /* |-------------------------------------------------------------------------- diff --git a/public/img/v3/logo.svg b/public/img/v3/logo.svg new file mode 100644 index 0000000000..273aa66893 --- /dev/null +++ b/public/img/v3/logo.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/public/img/v3/stroke.svg b/public/img/v3/stroke.svg new file mode 100644 index 0000000000..e6e832e796 --- /dev/null +++ b/public/img/v3/stroke.svg @@ -0,0 +1,3 @@ + + + diff --git a/v3/src/Controller.php b/v3/src/Controller.php new file mode 100644 index 0000000000..cfa1fb461b --- /dev/null +++ b/v3/src/Controller.php @@ -0,0 +1,31 @@ + Peripheral::resourceUrl('css/v3.css'), + 'logoUrl' => '/img/v3/logo.svg', + ]); + }); + + Peripheral::addPostRoute('/v3/createAccount', function () { + $requestModel = new RequestModel( + Peripheral::httpRequestField('registerLogin'), + Peripheral::httpRequestField('registerPassword'), + Peripheral::httpRequestField('registerEmail'), + ); + + return Peripheral::renderTwig('view', [ + 'stylesheetUrl' => Peripheral::resourceUrl('css/v3.css'), + ]); + }); + } +} diff --git a/v3/src/Peripheral.php b/v3/src/Peripheral.php new file mode 100644 index 0000000000..a9b25800d1 --- /dev/null +++ b/v3/src/Peripheral.php @@ -0,0 +1,42 @@ +render(); + } + + public static function resourceUrl(string $string): string + { + return cdn($string); + } + + public static function httpRequestField(string $field): ?string + { + $value = Request::get($field); + if ($value === null) { + abort(422); + } + return $value; + } + + public static function httpRequestQuery(string $string): ?string + { + return Request::query($string); + } +} diff --git a/v3/src/RequestModel.php b/v3/src/RequestModel.php new file mode 100644 index 0000000000..4f57b3a9f7 --- /dev/null +++ b/v3/src/RequestModel.php @@ -0,0 +1,13 @@ + + + + + + + +
+
+
+ +

+ Dołącz do największej społeczności programistycznej w Polsce +

+ +
+ + + +

+ Konto o podanej nazwie użytkownika już istnieje +

+
+ + +
+ +
+ + +
+ + + +

+ Hasło powinno zawierać conajmniej 8 znaków, w tym przynajmniej jedną wielką literę, cyfrę oraz znak specjalny. +

+
+
+
+ + +
+
+ + +
+
+
+ +
+
+ +
+
+ + +
+
+
+ + diff --git a/v3/test/Unit/EmptyTest.php b/v3/test/Unit/EmptyTest.php new file mode 100644 index 0000000000..3b6b8a1790 --- /dev/null +++ b/v3/test/Unit/EmptyTest.php @@ -0,0 +1,17 @@ + same as before, but mock out the actual call (test that js makes request, and that controller when gets call delegates to IB) + + // test that twig view can get new function + } +} diff --git a/webpack.common.js b/webpack.common.js index e7096c73d4..5992e8d181 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -121,6 +121,7 @@ module.exports = { wiki: ['./js/pages/wiki.js'], job: ['./js/pages/job.js'], adm: './sass/pages/adm.scss', + v3: '../v3/src/Web/view/v3/style.scss', }, plugins: [ new VueLoaderPlugin(),