diff --git a/README.md b/README.md index 6d84633..59eff3b 100644 --- a/README.md +++ b/README.md @@ -5,20 +5,19 @@ - [HTMX](https://htmx.org/) - [Tailwind](https://tailwindcss.com/) - ## Start Dev ### Beim ersten Start Config file erstellen bzw kopieren -1. `cd web/api/inc` +1. `cd web/inc` 2. Datei `example.config.inc.php` umbenennen auf `config.inc.php` 3. Gegebenenfalls Werte anpassen in der Config Composer sachen holen -1. `cd web/api/inc` +1. `cd web/inc` 2. `composer install` ### Linux @@ -32,4 +31,24 @@ In zweitem Terminal dann Webserver starten 1. `cd web` 2. `php -S localhost:8080` -3. Browser auf http://localhost:8080 öffnen \ No newline at end of file +3. Browser auf http://localhost:8080 öffnen + +## Ordnerstruktur + +``` +. +├── tools Tools halt +└── web + ├── css CSS files, braucht man eigentlich nicht weil tailwind macht das schon + ├── imgs Statische Bilder hier rein + ├── inc Paar Sachen, die wichtig sind, damit das backend überhaupt funktioniert + │ ├── classes Allgemeine Klassen für die Seite + │ └── vendor Composer pakete + ├── js JS Libraries + ├── pages Alle Ordner hier drinnen sind automatisch dann endpoints. zB wenn man /home + │ ├── auth aufrufen können möchte, muss man einen home Ordner erstellen und drinnen eine PHP Datei namens + │ ├── err controller.php haben. Die wiederum muss eine Klasse sein, die den Namen des Ordners hat (nur großer Anfangsbuchstabe) + │ └── home Am einfachsten einen bestehenden anschauen oder kopieren 😁 + └── templates Allgemeine Templates, mal schauen ob benötigt + └── partials +``` \ No newline at end of file diff --git a/tools/tailwind.config.js b/tools/tailwind.config.js index b369c2c..6d171b1 100644 --- a/tools/tailwind.config.js +++ b/tools/tailwind.config.js @@ -1,6 +1,6 @@ /** @type {import('tailwindcss').Config} */ module.exports = { - content: ["../web/**/*.{html,js,mustache}","../web/api/**/*.{html,js,mustache}"], + content: ["../web/**/*.{html,js,mustache}"], theme: { extend: {}, }, diff --git a/web/css/output.css b/web/css/output.css index b9ce972..2642a65 100644 --- a/web/css/output.css +++ b/web/css/output.css @@ -839,9 +839,9 @@ video { border-color: rgb(209 213 219 / var(--tw-border-opacity)); } -.border-green-500 { +.border-red-500 { --tw-border-opacity: 1; - border-color: rgb(34 197 94 / var(--tw-border-opacity)); + border-color: rgb(239 68 68 / var(--tw-border-opacity)); } .bg-gray-50 { @@ -849,41 +849,21 @@ video { background-color: rgb(249 250 251 / var(--tw-bg-opacity)); } -.bg-green-100 { - --tw-bg-opacity: 1; - background-color: rgb(220 252 231 / var(--tw-bg-opacity)); -} - .bg-indigo-600 { --tw-bg-opacity: 1; background-color: rgb(79 70 229 / var(--tw-bg-opacity)); } +.bg-red-100 { + --tw-bg-opacity: 1; + background-color: rgb(254 226 226 / var(--tw-bg-opacity)); +} + .bg-white { --tw-bg-opacity: 1; background-color: rgb(255 255 255 / var(--tw-bg-opacity)); } -.bg-indigo-500 { - --tw-bg-opacity: 1; - background-color: rgb(99 102 241 / var(--tw-bg-opacity)); -} - -.bg-green-50 { - --tw-bg-opacity: 1; - background-color: rgb(240 253 244 / var(--tw-bg-opacity)); -} - -.bg-red-50 { - --tw-bg-opacity: 1; - background-color: rgb(254 242 242 / var(--tw-bg-opacity)); -} - -.bg-red-200 { - --tw-bg-opacity: 1; - background-color: rgb(254 202 202 / var(--tw-bg-opacity)); -} - .bg-gradient-to-tr { background-image: linear-gradient(to top right, var(--tw-gradient-stops)); } @@ -1061,16 +1041,16 @@ video { color: rgb(17 24 39 / var(--tw-text-opacity)); } -.text-green-700 { - --tw-text-opacity: 1; - color: rgb(21 128 61 / var(--tw-text-opacity)); -} - .text-indigo-600 { --tw-text-opacity: 1; color: rgb(79 70 229 / var(--tw-text-opacity)); } +.text-red-700 { + --tw-text-opacity: 1; + color: rgb(185 28 28 / var(--tw-text-opacity)); +} + .text-slate-500 { --tw-text-opacity: 1; color: rgb(100 116 139 / var(--tw-text-opacity)); diff --git a/web/api/inc/.gitignore b/web/inc/.gitignore similarity index 100% rename from web/api/inc/.gitignore rename to web/inc/.gitignore diff --git a/web/api/inc/classes/Page.class.php b/web/inc/classes/Page.class.php similarity index 98% rename from web/api/inc/classes/Page.class.php rename to web/inc/classes/Page.class.php index 6f127e6..7a049d3 100644 --- a/web/api/inc/classes/Page.class.php +++ b/web/inc/classes/Page.class.php @@ -97,7 +97,7 @@ class Page $partials = []; if(is_dir($controller_dir.'partials')) $partials[] = new Mustache_Loader_FilesystemLoader($controller_dir.'partials'); - $partials[] = new Mustache_Loader_FilesystemLoader(ROOT.DS.'..'.DS.'templates'.DS.'partials'); + $partials[] = new Mustache_Loader_FilesystemLoader(ROOT.DS.DS.'templates'.DS.'partials'); $m = new Mustache_Engine(array( 'entity_flags' => ENT_QUOTES, 'partials_loader' => new Mustache_Loader_CascadingLoader($partials) diff --git a/web/api/inc/composer.json b/web/inc/composer.json similarity index 100% rename from web/api/inc/composer.json rename to web/inc/composer.json diff --git a/web/api/inc/composer.lock b/web/inc/composer.lock similarity index 100% rename from web/api/inc/composer.lock rename to web/inc/composer.lock diff --git a/web/api/inc/core.php b/web/inc/core.php similarity index 100% rename from web/api/inc/core.php rename to web/inc/core.php diff --git a/web/api/inc/example.config.inc.php b/web/inc/example.config.inc.php similarity index 100% rename from web/api/inc/example.config.inc.php rename to web/inc/example.config.inc.php diff --git a/web/api/inc/helpers.php b/web/inc/helpers.php similarity index 100% rename from web/api/inc/helpers.php rename to web/inc/helpers.php diff --git a/web/api/index.php b/web/index.php similarity index 90% rename from web/api/index.php rename to web/index.php index a94a47f..88ad18f 100644 --- a/web/api/index.php +++ b/web/index.php @@ -3,6 +3,9 @@ define('DS', DIRECTORY_SEPARATOR); define('ROOT', dirname(__FILE__)); +if($_SERVER['HTTP_HX_REQUEST']!='true') + exit(file_get_contents(ROOT.DS.'templates'.DS.'mainpage.html')); + // if(file_exists(ROOT.DS.'inc'.DS.'config.inc.php')) // include_once(ROOT.DS.'inc'.DS.'config.inc.php'); // else die('ERR: no config file found :('); @@ -14,8 +17,6 @@ if($_GET['url']) $url = explode('/',ltrim(parse_url($_GET['url'], PHP_URL_PATH),'/')); else $url = array_filter(explode('/',ltrim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH),'/'))); -if(count($url) > 0 && ($url[0]=='api' || $url[0]=='backend')) - array_shift($url); if($url==[] && $_SERVER['HTTP_HX_CURRENT_URL']) $url = explode('/',ltrim(parse_url($_SERVER['HTTP_HX_CURRENT_URL'], PHP_URL_PATH),'/')); @@ -23,7 +24,6 @@ if($url==[] && $_SERVER['HTTP_HX_CURRENT_URL']) //echo print_r(['url'=>$url,'server'=>$_SERVER,'request'=>$_REQUEST,'cookie'=>$_COOKIE,'session'=>$_SESSION],true); - $response = callHook($url); if(is_string($response)) diff --git a/web/api/pages/auth/controller.php b/web/pages/auth/controller.php similarity index 100% rename from web/api/pages/auth/controller.php rename to web/pages/auth/controller.php diff --git a/web/api/pages/err/controller.php b/web/pages/err/controller.php similarity index 100% rename from web/api/pages/err/controller.php rename to web/pages/err/controller.php diff --git a/web/api/pages/err/notfound.mustache b/web/pages/err/notfound.mustache similarity index 100% rename from web/api/pages/err/notfound.mustache rename to web/pages/err/notfound.mustache diff --git a/web/api/pages/home/controller.php b/web/pages/home/controller.php similarity index 100% rename from web/api/pages/home/controller.php rename to web/pages/home/controller.php diff --git a/web/api/pages/home/home.mustache b/web/pages/home/home.mustache similarity index 100% rename from web/api/pages/home/home.mustache rename to web/pages/home/home.mustache diff --git a/web/templates/login.html b/web/templates/login.html index 28993c0..4379a33 100644 --- a/web/templates/login.html +++ b/web/templates/login.html @@ -7,7 +7,7 @@
yes
-
+
diff --git a/web/index.html b/web/templates/mainpage.html similarity index 97% rename from web/index.html rename to web/templates/mainpage.html index 83c02f9..a83e6f9 100644 --- a/web/index.html +++ b/web/templates/mainpage.html @@ -14,7 +14,7 @@
-
+