diff --git a/app/Http/Controllers/PageController.php b/app/Http/Controllers/PageController.php index a937999..8f2b495 100644 --- a/app/Http/Controllers/PageController.php +++ b/app/Http/Controllers/PageController.php @@ -45,12 +45,14 @@ class PageController extends Controller } }, Storage::disk('pages')->files(Auth::user()->getAuthIdentifier()))); + /** @var \App\Models\User $user */ $user = Auth::user(); return view('pages.index', [ - 'start_date'=> min((new DateTime())->sub(new DateInterval('P1Y')), $user->created_at), - 'checkword' => $user->checkword, - 'pages' => $pages, + 'start_date' => min((new DateTime())->sub(new DateInterval('P1Y')), $user->created_at), + 'checkword' => $user->checkword, + 'settings' => json_encode($user->getSettings()), + 'pages' => $pages, ]); } @@ -124,7 +126,7 @@ class PageController extends Controller */ public function edit($id) { - throw new MethodNotAllowedHttpException('You can\'t edit a page.'); + throw new MethodNotAllowedHttpException(['GET'], 'You can\'t edit a page.'); } /** @@ -137,7 +139,7 @@ class PageController extends Controller */ public function update(Request $request, $id) { - throw new MethodNotAllowedHttpException('You can\'t edit a page.'); + throw new MethodNotAllowedHttpException(['GET'], 'You can\'t edit a page.'); } /** diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index c8eaec9..447f3d2 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Http\Requests\User\SettingsRequest; use App\Http\Requests\User\WordCheckRequest; use App\Models\User; use Illuminate\Support\Facades\Auth; @@ -23,4 +24,26 @@ class UserController extends Controller return response()->json(['success' => true]); } + + public function settings() + { + return view('user.settings', [ + 'settings' => Auth::user()->getSettings(), + ]); + } + + public function storeSettings(SettingsRequest $request) + { + $validated = $request->validated(); + $user = User::where('id', Auth::user()->getAuthIdentifier())->firstOrFail(); + foreach ($validated as $name => $value) { + $user->{$name} = $value; + } + $user->save(); + Auth::setUser($user); + + $request->session()->flash('status', __('Settings saved!')); + + return redirect()->route('user.settings'); + } } diff --git a/app/Http/Requests/User/SettingsRequest.php b/app/Http/Requests/User/SettingsRequest.php new file mode 100644 index 0000000..414d9f1 --- /dev/null +++ b/app/Http/Requests/User/SettingsRequest.php @@ -0,0 +1,34 @@ + ['required', 'string', 'max:7'], + 'background_color' => ['required', 'string', 'max:7'], + 'font' => ['required', 'string', 'max:255'], + 'font_size' => ['required', 'numeric'], + 'line_spacing' => ['required', 'numeric'], + ]; + } +} diff --git a/app/Models/User.php b/app/Models/User.php index 8996368..a42afce 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -33,6 +33,14 @@ class User extends Authenticatable 'remember_token', ]; + protected $settings = [ + 'text_color', + 'background_color', + 'font', + 'font_size', + 'line_spacing', + ]; + /** * The attributes that should be cast. * @@ -41,4 +49,17 @@ class User extends Authenticatable protected $casts = [ 'email_verified_at' => 'datetime', ]; + + /** + * @return array + */ + public function getSettings() + { + $settings = []; + foreach ($this->settings as $setting) { + $settings[$setting] = $this->{$setting}; + } + + return $settings; + } } diff --git a/composer.json b/composer.json index f02313c..bb8f3ce 100644 --- a/composer.json +++ b/composer.json @@ -6,13 +6,15 @@ "license": "MIT", "require": { "php": "^7.3|^8.0", + "doctrine/dbal": "^3.3", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "kzykhys/yaml-front-matter": "^1.0", "laravel/framework": "^9.0", "laravel/sanctum": "^2.11", "laravel/tinker": "^2.5", - "laravel/ui": "^3.4" + "laravel/ui": "^3.4", + "ext-json": "*" }, "require-dev": { "spatie/laravel-ignition": "^1.0", diff --git a/composer.lock b/composer.lock index b8bbbc4..9ffeae3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "af7035cb5f906bc34893e53d97e6656f", + "content-hash": "4b6bb4a29b9cbd7a05ba0cc319b1aa4c", "packages": [ { "name": "asm89/stack-cors", @@ -197,6 +197,353 @@ }, "time": "2021-08-13T13:06:58+00:00" }, + { + "name": "doctrine/cache", + "version": "2.1.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "331b4d5dbaeab3827976273e9356b3b453c300ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/331b4d5dbaeab3827976273e9356b3b453c300ce", + "reference": "331b4d5dbaeab3827976273e9356b3b453c300ce", + "shasum": "" + }, + "require": { + "php": "~7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "alcaeus/mongo-php-adapter": "^1.1", + "cache/integration-tests": "dev-master", + "doctrine/coding-standard": "^8.0", + "mongodb/mongodb": "^1.1", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "predis/predis": "~1.0", + "psr/cache": "^1.0 || ^2.0 || ^3.0", + "symfony/cache": "^4.4 || ^5.2 || ^6.0@dev", + "symfony/var-exporter": "^4.4 || ^5.2 || ^6.0@dev" + }, + "suggest": { + "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", + "homepage": "https://www.doctrine-project.org/projects/cache.html", + "keywords": [ + "abstraction", + "apcu", + "cache", + "caching", + "couchdb", + "memcached", + "php", + "redis", + "xcache" + ], + "support": { + "issues": "https://github.com/doctrine/cache/issues", + "source": "https://github.com/doctrine/cache/tree/2.1.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", + "type": "tidelift" + } + ], + "time": "2021-07-17T14:49:29+00:00" + }, + { + "name": "doctrine/dbal", + "version": "3.3.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "719663b15983278227669c8595151586a2ff3327" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/719663b15983278227669c8595151586a2ff3327", + "reference": "719663b15983278227669c8595151586a2ff3327", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2", + "doctrine/cache": "^1.11|^2.0", + "doctrine/deprecations": "^0.5.3", + "doctrine/event-manager": "^1.0", + "php": "^7.3 || ^8.0", + "psr/cache": "^1|^2|^3", + "psr/log": "^1|^2|^3" + }, + "require-dev": { + "doctrine/coding-standard": "9.0.0", + "jetbrains/phpstorm-stubs": "2021.1", + "phpstan/phpstan": "1.5.3", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "9.5.16", + "psalm/plugin-phpunit": "0.16.1", + "squizlabs/php_codesniffer": "3.6.2", + "symfony/cache": "^5.2|^6.0", + "symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0", + "vimeo/psalm": "4.22.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\DBAL\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", + "homepage": "https://www.doctrine-project.org/projects/dbal.html", + "keywords": [ + "abstraction", + "database", + "db2", + "dbal", + "mariadb", + "mssql", + "mysql", + "oci8", + "oracle", + "pdo", + "pgsql", + "postgresql", + "queryobject", + "sasql", + "sql", + "sqlite", + "sqlserver", + "sqlsrv" + ], + "support": { + "issues": "https://github.com/doctrine/dbal/issues", + "source": "https://github.com/doctrine/dbal/tree/3.3.5" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal", + "type": "tidelift" + } + ], + "time": "2022-04-05T09:50:18+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "v0.5.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "9504165960a1f83cc1480e2be1dd0a0478561314" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/9504165960a1f83cc1480e2be1dd0a0478561314", + "reference": "9504165960a1f83cc1480e2be1dd0a0478561314", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0|^7.0|^8.0", + "phpunit/phpunit": "^7.0|^8.0|^9.0", + "psr/log": "^1.0" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/v0.5.3" + }, + "time": "2021-03-21T12:59:47+00:00" + }, + { + "name": "doctrine/event-manager", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/event-manager.git", + "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f", + "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": "<2.9@dev" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", + "homepage": "https://www.doctrine-project.org/projects/event-manager.html", + "keywords": [ + "event", + "event dispatcher", + "event manager", + "event system", + "events" + ], + "support": { + "issues": "https://github.com/doctrine/event-manager/issues", + "source": "https://github.com/doctrine/event-manager/tree/1.1.x" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager", + "type": "tidelift" + } + ], + "time": "2020-05-29T18:28:51+00:00" + }, { "name": "doctrine/inflector", "version": "2.0.4", @@ -2305,6 +2652,55 @@ ], "time": "2021-12-04T23:24:31+00:00" }, + { + "name": "psr/cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/3.0.0" + }, + "time": "2021-02-03T23:26:27+00:00" + }, { "name": "psr/container", "version": "2.0.2", diff --git a/database/migrations/2022_04_14_095502_add_user_settings.php b/database/migrations/2022_04_14_095502_add_user_settings.php new file mode 100644 index 0000000..32d8fd1 --- /dev/null +++ b/database/migrations/2022_04_14_095502_add_user_settings.php @@ -0,0 +1,48 @@ +string('text_color')->default('#000000'); + $table->string('background_color')->default('#FFFFFF'); + $table->string('font')->default('Arial'); + $table->float('font_size', 3, 1)->default(16); + $table->float('line_spacing', 2, 3)->default(1.5); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('text_color'); + }); + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('background_color'); + }); + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('font'); + }); + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('font_size'); + }); + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('line_spacing'); + }); + } +}; diff --git a/resources/js/components/pages/App.tsx b/resources/js/components/pages/App.tsx index dc919b4..503799c 100644 --- a/resources/js/components/pages/App.tsx +++ b/resources/js/components/pages/App.tsx @@ -24,6 +24,7 @@ const sessionPassphrase = sessionStorage.getItem("key") as string; let pages: IList[] = []; let getPageContentUrl, postUrl, + settings, removeUrl, checkword, startDate, @@ -33,7 +34,8 @@ if (app) { getPageContentUrl = "" + app.getAttribute('data-url'); pages = JSON.parse("" + app.getAttribute('data-list')) as IList[]; postUrl = "" + app.getAttribute('data-post'); - startDate = "" + app.getAttribute('data-start'); + startDate = "" + app.getAttribute('data-start'); + settings = JSON.parse("" + app.getAttribute('data-settings')); removeUrl = "" + app.getAttribute('data-remove'); csrf = "" + app.getAttribute('data-csrf'); checkword = "" + app.getAttribute('data-checkword'); @@ -195,6 +197,7 @@ function App() { csrf={csrf} removeUrl={removeUrl} loadPages={loadPages} + settings={settings} setAllLoaded={setAllLoaded} /> diff --git a/resources/js/components/pages/List.tsx b/resources/js/components/pages/List.tsx index b363e6f..0aa736f 100644 --- a/resources/js/components/pages/List.tsx +++ b/resources/js/components/pages/List.tsx @@ -5,7 +5,7 @@ import {IPages} from "../../interfaces/IPages"; import {IList} from "../../interfaces/IList"; import {isAllLoadedLocally} from "../../utils"; -export default function Pages({pages, url, removeUrl, csrf, passphrase, loadPages, setAllLoaded}: IPages) { +export default function Pages({pages, url, removeUrl, csrf, passphrase, loadPages, settings, setAllLoaded}: IPages) { const isPassphraseSet = passphrase !== null; const perPage = 1; const total = pages.length; @@ -24,26 +24,22 @@ export default function Pages({pages, url, removeUrl, csrf, passphrase, loadPage const json = await response.json(); if (json.success) { - console.log(listPages.length); const newListPages = listPages.filter(function (value) { - console.log(value.id); return value.id !== id; }); setListPages(newListPages); - console.log(newListPages.length); - console.log(listPages.length); updateListPages(newListPages.slice((currentPage - 1) * perPage, ((currentPage - 1) * perPage) + perPage).map(page => - )); + )); } } const [listPagesDisplayed, updateListPages] = React.useState(listPages.slice((currentPage-1) * perPage, ((currentPage-1) * perPage) + perPage ).map(page => - )); + )); const handlePageChange = (event: React.ChangeEvent, value: number) => { setPage(value); updateListPages(listPages.slice((value-1) * perPage, ((value-1) * perPage) + perPage).map(page => - )); + )); }; const loadAllPages = function() { @@ -61,7 +57,7 @@ export default function Pages({pages, url, removeUrl, csrf, passphrase, loadPage localStorage.setItem(page.id + "text", json.content); updateListPages([]); updateListPages(listPages.slice((currentPage-1) * perPage, ((currentPage-1) * perPage) + perPage).map(page => - )); + )); } } diff --git a/resources/js/components/pages/Page.tsx b/resources/js/components/pages/Page.tsx index f56c8ae..dedde0d 100644 --- a/resources/js/components/pages/Page.tsx +++ b/resources/js/components/pages/Page.tsx @@ -3,7 +3,7 @@ import { AlertTitle, Card, CardContent, CardHeader, Collapse, - Grid, IconButton + Grid, IconButton, } from '@mui/material'; import MoreVertIcon from '@mui/icons-material/MoreVert'; import * as React from 'react'; @@ -12,7 +12,7 @@ import {Delete, Download} from "@mui/icons-material"; import MDEditor from "@uiw/react-md-editor"; import {PropPage} from "../../interfaces/PropPage"; -const Page = function({page, url, passphrase, remove}: PropPage) { +const Page = function({page, url, passphrase, settings, remove}: PropPage) { const [more, setMore] = React.useState(false); const handleMoreClick = () => { setMore(!more); }; @@ -49,10 +49,22 @@ const Page = function({page, url, passphrase, remove}: PropPage) { ); } + return ( - + - + diff --git a/resources/js/components/user/BasicMenu.tsx b/resources/js/components/user/BasicMenu.tsx index f3368d5..98708e2 100644 --- a/resources/js/components/user/BasicMenu.tsx +++ b/resources/js/components/user/BasicMenu.tsx @@ -13,6 +13,12 @@ export default function BasicMenu({nickname}) { setAnchorEl(null); }; + function gotoSettings() { + const currentHref = location.href.split('/'); + currentHref.pop(); + location.href = currentHref.join('/') + '/settings'; + } + function logout() { const logoutForm: HTMLFormElement = document.getElementById("logout-form") as HTMLFormElement; logoutForm.submit(); @@ -39,7 +45,7 @@ export default function BasicMenu({nickname}) { 'aria-labelledby': 'basic-button', }} > - {/*My account*/} + Settings Logout diff --git a/resources/js/components/user/MobileMenu.tsx b/resources/js/components/user/MobileMenu.tsx index af56adf..71cecbf 100644 --- a/resources/js/components/user/MobileMenu.tsx +++ b/resources/js/components/user/MobileMenu.tsx @@ -28,6 +28,12 @@ export default function MobileMenu({nickname}) { setState( open ); }; + function gotoSettings() { + const currentHref = location.href.split('/'); + currentHref.pop(); + location.href = currentHref.join('/') + '/settings'; + } + function logout() { const logoutForm: HTMLFormElement = document.getElementById("logout-form") as HTMLFormElement; logoutForm.submit(); @@ -53,7 +59,7 @@ export default function MobileMenu({nickname}) { onKeyDown={toggleDrawer(false)} > - + @@ -62,7 +68,13 @@ export default function MobileMenu({nickname}) { - + + + + + + + diff --git a/resources/js/interfaces/IPages.ts b/resources/js/interfaces/IPages.ts index e193c80..c663400 100644 --- a/resources/js/interfaces/IPages.ts +++ b/resources/js/interfaces/IPages.ts @@ -1,5 +1,6 @@ import {IList} from "./IList"; import * as React from "react"; +import {ISettings} from "./ISettings"; export interface IPages { pages: IList[]; @@ -7,6 +8,7 @@ export interface IPages { removeUrl: string; csrf: string; passphrase: string; + settings: ISettings; loadPages: React.MutableRefObject<() => void>; setAllLoaded: React.Dispatch>; } diff --git a/resources/js/interfaces/ISettings.ts b/resources/js/interfaces/ISettings.ts new file mode 100644 index 0000000..f50787f --- /dev/null +++ b/resources/js/interfaces/ISettings.ts @@ -0,0 +1,7 @@ +export interface ISettings { + background_color: string; + text_color: string; + font_size: number; + font: string; + line_spacing: number; +} diff --git a/resources/js/interfaces/PropPage.ts b/resources/js/interfaces/PropPage.ts index f691ad3..129057c 100644 --- a/resources/js/interfaces/PropPage.ts +++ b/resources/js/interfaces/PropPage.ts @@ -1,9 +1,11 @@ import { Ref } from "react"; import {IList} from "./IList"; +import {ISettings} from "./ISettings"; export interface PropPage { page: IList; url: string; + settings: ISettings; passphrase: string; remove: (id) => void; ref: Ref; diff --git a/resources/views/pages/index.blade.php b/resources/views/pages/index.blade.php index 1bddcf7..49c8697 100644 --- a/resources/views/pages/index.blade.php +++ b/resources/views/pages/index.blade.php @@ -17,6 +17,7 @@ data-remove="{{ route('pages.destroy', ['page' => 'replace_me']) }}" data-csrf="{{ csrf_token() }}" data-checkword="{{ $checkword }}" + data-settings="{{ $settings }}" > diff --git a/resources/views/user/settings.blade.php b/resources/views/user/settings.blade.php new file mode 100644 index 0000000..f9b922b --- /dev/null +++ b/resources/views/user/settings.blade.php @@ -0,0 +1,96 @@ + + +

+ {{ __('Settings') }} +

+
+ +
+
+
+ + + + + + + +
+
+ @csrf +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + {{ $settings['font_size'] }} +
+
+ +
+
+ +
+
+ + {{ $settings['line_spacing'] }} +
+
+ +
+
+
+ +
+
+ +
+
+
+
+
+ +
diff --git a/routes/web.php b/routes/web.php index e1e02e4..634c4c1 100644 --- a/routes/web.php +++ b/routes/web.php @@ -27,6 +27,8 @@ Route::resource('pages', PageController::class) Route::get('/first', [UserController::class, 'first'])->middleware(['auth', 'auth.passphrase'])->name('user.first'); Route::post('/first', [UserController::class, 'storeFirst'])->middleware(['auth', 'auth.passphrase'])->name('user.storeFirst'); +Route::get('/settings', [UserController::class, 'settings'])->middleware(['auth'])->name('user.settings'); +Route::post('/settings', [UserController::class, 'storeSettings'])->middleware(['auth'])->name('user.storeSettings'); Route::get('/dashboard', function () { return redirect(\route('pages.index'));