From e09d85292a39b0f83edc698ace2ff15881239a89 Mon Sep 17 00:00:00 2001 From: ro Date: Wed, 8 May 2024 15:55:27 -0600 Subject: [PATCH] added labels to forms (#102), init templates added added some labels to login and set up forms for better accesibility and clarity about what info is being requested. found a bug in setting where the site would error out if it can't find the correct config files instead of going to set up, so when config files aren't present, it loads template files to continue to process. still thinking about a better fix for this also discovered that the init files needed for a fresh install had been removed, so those are back in place --- .gitignore | 2 ++ app/Services/SettingsService.php | 28 ++++++++++++++---- content/init/folks-template.json | 15 ++++++++++ content/init/settings-template.json | 31 ++++++++++++++++++++ public/assets/css/dash/forms.css | 22 ++++++++++++++ public/assets/css/dash/frame.css | 2 +- public/assets/css/dash/init.css | 3 -- resources/views/forms/init-fresh.blade.php | 10 +++---- resources/views/forms/init-restore.blade.php | 6 ++-- resources/views/forms/login.blade.php | 7 ++--- 10 files changed, 104 insertions(+), 22 deletions(-) create mode 100644 content/init/folks-template.json create mode 100644 content/init/settings-template.json diff --git a/.gitignore b/.gitignore index 2e891b4..c50420d 100644 --- a/.gitignore +++ b/.gitignore @@ -46,10 +46,12 @@ public/assets/images/* !content/ content/* +!content/init !content/themes content/themes/* !content/themes/fipamo-default-v2 !content/themes/fipamo-default-v2/* + *.DS_Store *.codekit3 diff --git a/app/Services/SettingsService.php b/app/Services/SettingsService.php index 0c6a23f..7a896cc 100644 --- a/app/Services/SettingsService.php +++ b/app/Services/SettingsService.php @@ -16,15 +16,33 @@ class SettingsService public function __construct(DocService $docService, ContentService $contentService) { - $this->folks = json_decode(file_get_contents(env('FOLKS_PATH')), true); - $this->tags = json_decode(file_get_contents(env('TAGS_PATH')), true); - $this->docs = $docService; - $this->contents = $contentService; + //if config files aren't avaiable, load templates + if (file_exists(env('FOLKS_PATH'))) { + $this->folks = json_decode(file_get_contents(env('FOLKS_PATH')), true); + } else { + $this->folks = json_decode(file_get_contents('../content/init/folks-template.json'), true); + } + + if (file_exists(env('TAGS_PATH'))) { + $this->tags = json_decode(file_get_contents(env('TAGS_PATH')), true); + } else { + $this->tags = []; + } } protected function loadSettings() { - return json_decode(file_get_contents(env('SETTINGS_PATH')), true); + $settings = []; + //if config files aren't avaiable, load templates + if (file_exists(env('SETTINGS_PATH'))) { + $settings = json_decode(file_get_contents(env('SETTINGS_PATH')), true); + } else { + $settings = json_decode( + file_get_contents('../content/init/settings-template.json'), + true + ); + } + return $settings; } public function getSettings() diff --git a/content/init/folks-template.json b/content/init/folks-template.json new file mode 100644 index 0000000..0933e36 --- /dev/null +++ b/content/init/folks-template.json @@ -0,0 +1,15 @@ +[ + { + "id": "", + "handle": "", + "avi": "/assets/images/global/default-avi.png", + "email": "", + "password": "", + "key": "", + "secret": "", + "role": "", + "created": "", + "updated": "", + "deleted": null + } +] diff --git a/content/init/settings-template.json b/content/init/settings-template.json new file mode 100644 index 0000000..a9681d8 --- /dev/null +++ b/content/init/settings-template.json @@ -0,0 +1,31 @@ +{ + "global": { + "base_url": "http://your.domain", + "title": "This is a Title", + "descriptions": "Because it should be easy.", + "background": "/assets/images/global/default-bg.jpg", + "private": "true", + "renderOnSave": "false", + "theme": "fipamo-default", + "display_limit": 5, + "last_backup": null, + "externalAPI": "false", + "dynamicRender": "false" + }, + "library_stats": { + "current_index": 1 + }, + "email": { + "active": "none", + "smtp": { + "domain": "", + "email": "", + "password": "" + }, + "mailgun": { + "domain": "", + "api-key": "" + } + }, + "menu": [] +} diff --git a/public/assets/css/dash/forms.css b/public/assets/css/dash/forms.css index 733ed18..e228535 100644 --- a/public/assets/css/dash/forms.css +++ b/public/assets/css/dash/forms.css @@ -52,3 +52,25 @@ select { font: 25px var(--base-type); color: var(--black); } + +form input.inline { + width: auto; + border-radius: 0 5px 5px 0; +} + +form label { + color: var(--secondary); +} + +form label.inline { + background: var(--secondary); + display: inline-block; + height: 30px; + color: var(--primary); + padding: 5px; + border-radius: 5px 0 0 5px; + font-weight: bold; + width: 90px; + vertical-align: top; + margin-right: 1px; +} diff --git a/public/assets/css/dash/frame.css b/public/assets/css/dash/frame.css index ecf001f..5671613 100644 --- a/public/assets/css/dash/frame.css +++ b/public/assets/css/dash/frame.css @@ -54,7 +54,7 @@ a.main-nav-secondary-highlight { } img.logo-medium { - width: 140px; + width: 130px; } sup { diff --git a/public/assets/css/dash/init.css b/public/assets/css/dash/init.css index f6471c3..ed910b8 100644 --- a/public/assets/css/dash/init.css +++ b/public/assets/css/dash/init.css @@ -21,7 +21,6 @@ section.restore-backup { } section.login form input { - width: 95%; height: 30px; padding: 5px; margin-bottom: 10px; @@ -67,7 +66,6 @@ section.restore-fresh form button { } section.restore-fresh form input { - width: 95%; height: 30px; padding: 5px; margin-bottom: 10px; @@ -79,7 +77,6 @@ section.restore-backup form button { } section.restore-backup form input { - width: 95%; height: 30px; padding: 5px; margin-bottom: 10px; diff --git a/resources/views/forms/init-fresh.blade.php b/resources/views/forms/init-fresh.blade.php index 6f614f3..e79e9b8 100644 --- a/resources/views/forms/init-fresh.blade.php +++ b/resources/views/forms/init-fresh.blade.php @@ -4,11 +4,11 @@
- - - - - + + + + +

diff --git a/resources/views/forms/init-restore.blade.php b/resources/views/forms/init-restore.blade.php index 16df2f1..b8f93f1 100644 --- a/resources/views/forms/init-restore.blade.php +++ b/resources/views/forms/init-restore.blade.php @@ -4,9 +4,9 @@ - - - + + +
diff --git a/resources/views/forms/login.blade.php b/resources/views/forms/login.blade.php index 052e51f..594a73f 100644 --- a/resources/views/forms/login.blade.php +++ b/resources/views/forms/login.blade.php @@ -4,15 +4,12 @@
@csrf - - + + @if($errors->any()) @else @endif - - ? -