routing overhaul

previously all the of the page routing was handlede through controller
organized by CRUD methods. it worked, but organizing by CRUD and not
purpose resulted in more time spent looking for a specific task through
controllers, so it turned out not to an effecient way of organizing.

so routing has been completely reorganized into laravel's web routing
section and methods have been moved to their appropriate controller so
tasks are much easier to find

front facing page routing turned out to be a bit more tricky that
anticipated do the overap of routing paths, but it only affects dynamic
page rendering and there's a patch in place that handles that issue
until a better solution is found. Rendered HTML pages works fine.

whew!
This commit is contained in:
RXP 2025-05-16 17:37:53 -06:00
parent 42dfdc947e
commit 743d7c4d90
Signed by: ro
GPG key ID: 976711B5057688B7
26 changed files with 690 additions and 758 deletions

View file

@ -4,157 +4,71 @@ namespace App\Http\Controllers;
use App\Interfaces\PageRepositoryInterface;
use App\Interfaces\MemberRepositoryInterface;
use App\Services\Data\ThemeService;
use App\Services\Data\SortingService;
use App\Services\Assets\FileUploadService;
use Illuminate\Http\Request;
class DashController extends Controller
{
protected PageRepositoryInterface $pages;
protected MemberRepositoryInterface $member;
protected ThemeService $themes;
protected SortingService $sort;
protected FileUploadService $upload;
public function __construct(
PageRepositoryInterface $pageRepository,
MemberRepositoryInterface $memberRepo,
ThemeService $themeService,
SortingService $sortingService
FileUploadService $fileUploadService,
) {
$this->pages = $pageRepository;
$this->member = $memberRepo;
$this->themes = $themeService;
$this->sort = $sortingService;
$this->upload = $fileUploadService;
}
//---
// GET
//---
public function init($second, $third, $fourth)
{
switch ($second) {
case 'settings':
return $this->settings();
break;
case 'navigation':
return $this->navigation();
break;
case 'pages':
($third == null) ? $third = 'all' : $third = $third;
($fourth == null) ? $fourth = 1 : $fourth = $fourth;
return $this->book($third, $fourth);
break;
case 'page':
return $this->page($third, $fourth);
break;
case 'logout':
return $this->logout();
break;
default:
return $this->start();
break;
}
}
public function start()
{
$result = [];
if ($this->member::status()) {
$result = $this->pages->getGroup(1, 4);
}
return view('back.start', [
"status" => $this->member::status(),
"result" => $result,
"title" => "Start"
]);
}
public function book($pageFilter = 'all', $pageNum = 1)
{
$result = [];
if ($this->member::status()) {
$result = $this->pages->getGroup($pageNum, 4, $pageFilter);
}
return view('back.book', [
"status" => $this->member::status(),
"result" => $result,
"currentPage" => $pageNum,
"title" => "Pages"
]);
}
public function page($mode, $uuid)
{
$title;
$page = [];
$views = [];
$mode == 'edit' ? $page = $this->pages->getByUuid($uuid) : $page = [];
$mode == 'edit' ? $title = 'Edit Page' : $title = 'Add New';
$mode == 'edit' ? $views = $this->themes->getCustomViews($page['layout']) : $views[] = 'page';
//just a patch for now to get this out of the template
if ($mode == 'edit') {
$id = $page['id'];
$uuid = $page['uuid'];
$slug = $page['slug'];
$feature = $page['feature'];
$layout = $page['layout'];
$tags = $page['tags'];
$content = $page['content'];
$date = $page['created'];
$updated = $page['updated'];
$media = $page['media'];
$files = $page['docs'];
$editTitle = $page['title'];
return view('back.start', [
"status" => $this->member::status(),
"result" => $result,
"title" => "Start"
]);
} else {
$id = "";
$uuid = "";
$slug = "";
$feature = "";
$layout = "";
$tags = "";
$content = "";
$date = "";
$updated = "";
$media = "";
$files = "";
$editTitle = "";
};
return view('back.page', [
"status" => $this->member::status(),
"mode" => $mode,
"page" => $page,
"views" => $views,
"id" => $id,
"uuid" => $uuid,
"slug" => $slug,
"feature" => $feature,
"layout" => $layout,
"tags" => $tags,
"content" => $content,
"date" => $date,
"updated" => $updated,
"media" => $media,
"files" => $files,
"title" => urldecode($title),
"editTitle" => urldecode($editTitle),
]);
}
public function navigation()
{
return view('back.navigation', $this->sort->navigation());
}
public function settings()
{
return view('back.settings', $this->sort->settings());
return view('back.login', [
"status" => $this->member::status(),
"title" => "Hi!"
]);
}
}
//---
// POST
//---
public function uploads(Request $request)
{
$result = $result = $this->upload->handleFile($request);
//update configs for specfic uploads
switch ($request['source']) {
case 'avatar-upload':
$member = [];
$member = session('member');
$member['avatar'] = $result['filePath'];
$member = (object) $member;
$this->member->update($member);
break;
case 'background-upload':
$this->settings->updateGlobalData('background', $result['filePath']);
break;
}
return $result;
}
//---
// PUT
@ -167,7 +81,7 @@ class DashController extends Controller
public function login()
{
if ($this->member::status()) {
return redirect('dashboard');
return redirect('dashboard/start');
} else {
return view('back.login', [
"status" => $this->member::status(),

View file

@ -6,6 +6,9 @@ use App\Interfaces\PageRepositoryInterface;
use App\Services\Assets\AssetService;
use App\Services\Data\SettingsService;
use App\Services\Data\SortingService;
use App\Services\Upkeep\InitService;
use App\Http\Controllers\DashController;
use Illuminate\Http\Request;
use function _\find;
@ -15,52 +18,95 @@ class FrontController extends Controller
protected PageRepositoryInterface $pages;
protected AssetService $assets;
protected SortingService $sort;
protected $init;
protected $dash;
public function __construct(
PageRepositoryInterface $pageRepository,
SettingsService $settingsService,
AssetService $assetService,
SortingService $sortService,
InitService $initService,
DashController $dashController,
) {
$this->pages = $pageRepository;
$this->settings = $settingsService;
$this->assets = $assetService;
$this->sort = $sortService;
$this->init = $initService;
$this->dash = $dashController;
}
//REFACTOR: there is some method overlap between index and pages, so that needs to be addressed
public function index($first = 00, $second = 00, $third = 00)
public function start($one = 00, $two = 00, $three = 00)
{
$global = $this->settings->getGlobal();
$currentTheme = $this->assets->getCurrentTheme();
$template;
$pageData = [];
$pages = $this->pages->getAll();
//weird bug where the whole url is being passed with optional params
//for now, just split it manually and set it to the vars used
$paths = explode('/', $one);
if (isset($paths[0])) {
$one = $paths[0];
}
if (isset($paths[1])) {
$two = $paths[1];
}
if (isset($paths[2])) {
$three = $paths[2];
}
//check if configs are present
if (file_exists(env('FOLKS_PATH')) && file_exists(env('SETTINGS_PATH'))) {
if ($global['dynamicRender'] == 'true') {
if (is_numeric($first)) {
if ($first == 00 || !isset($first)) {
$page = $pages->where('id', 1)->first();
$pageData = $this->sort->page($page, false);
$template = $currentTheme . '.index';
} else {
$page = $this->pages->getBySlug($third);
$pageData = $this->sort->page($page, false);
$template = $currentTheme . '.' . $page['layout'];
}
} else {
if ($first == null || $first == '') {
if (is_numeric($one)) {
if ($one == 00 || !isset($one)) {
$page = $pages->where('id', 0)->first();
$pageData = $this->sort->page($page, false);
$template = $currentTheme . '.index';
} else {
$page = $this->pages->getBySlug($first);
$page = $this->pages->getBySlug($three);
$pageData = $this->sort->page($page, false);
$template = $currentTheme . '.' . $page['layout'];
}
} else {
if ($one == null || $one == '') {
$page = $pages->where('id', 0)->first();
$pageData = $this->sort->page($page, false);
$template = $currentTheme . '.index';
} else {
if ($one == 'archives' || $one == 'archive' || $one == 'tags') {
$currentTheme = $this->assets->getCurrentTheme();
switch ($one) {
case 'archive':
case 'archives':
$template = $currentTheme . '.archive';
$pageData = $this->sort->archive(false);
break;
case 'tags':
$template = $currentTheme . '.tags';
$tags = $this->sort->tags(false);
$tagData = find($tags['tags'], ['tag_name' => $two]);
$pageData = [
'theme' => $currentTheme, // for theme kit
'title' => 'Pages Tagged as ' . $two,
'dynamicRender' => $tags['dynamicRender'],
'info' => $tags['info'],
'menu' => $tags['menu'],
'pages' => $tagData['pages'],
'media' => $tags['media'],
];
break;
}
} else {
$page = $this->pages->getBySlug($one);
$pageData = $this->sort->page($page, false);
$template = $currentTheme . '.' . $page['layout'];
}
}
}
return view($template, $pageData);
} else {
if (is_file('../public/index.html')) {
@ -74,30 +120,18 @@ class FrontController extends Controller
}
}
public function page($first = 00, $second = 00, $third = 00)
//setup up a new site or restore from back up
public function init($task, Request $request)
{
$currentTheme = $this->assets->getCurrentTheme();
switch ($first) {
case 'archive':
case 'archives':
$template = $currentTheme . '.archive';
$pageData = $this->sort->archive();
$result = [];
switch ($task) {
case 'fresh':
$result = $this->init->fresh(json_decode($request->getContent()));
break;
case 'tags':
$template = $currentTheme . '.tags';
$tags = $this->sort->tags(false);
$tagData = find($tags['tags'], ['tag_name' => $second]);
$pageData = [
'theme' => $currentTheme, // for theme kit
'title' => 'Pages Tagged as ' . $second,
'dynamicRender' => $tags['dynamicRender'],
'info' => $tags['info'],
'menu' => $tags['menu'],
'pages' => $tagData['pages'],
'media' => $tags['media'],
];
case 'restore':
$result = $this->init->restore($request);
break;
}
return view($template, $pageData);
return response()->json($result)->header('Content-Type', 'application/json');
}
}

View file

@ -0,0 +1,147 @@
<?php
namespace App\Http\Controllers;
use App\Interfaces\PageRepositoryInterface;
use App\Interfaces\MemberRepositoryInterface;
use App\Services\Data\ThemeService;
use Illuminate\Http\Request;
class PageController extends Controller
{
protected PageRepositoryInterface $page;
protected MemberRepositoryInterface $member;
protected ThemeService $themes;
public function __construct(
PageRepositoryInterface $pageRepo,
MemberRepositoryInterface $memberRepo,
ThemeService $themeService,
) {
$this->page = $pageRepo;
$this->member = $memberRepo;
$this->themes = $themeService;
}
//---
// GET Actions
//---
public function start(string $one = 'all', string $two = '1')
{
//checks mode to see what needs to get loaded
switch ($one) {
case "edit":
case "add":
return $this->page($one, $two);
break;
default:
return $this->book($one, $two);
break;
}
}
private function page($mode, $uuid)
{
$title;
$page = [];
$views = [];
$mode == 'edit' ? $page = $this->page->getByUuid($uuid) : $page = [];
$mode == 'edit' ? $title = 'Edit Page' : $title = 'Add New';
$mode == 'edit' ? $views = $this->themes->getCustomViews($page['layout']) : $views[] = 'page';
//just a patch for now to get this out of the template
if ($mode == 'edit') {
$id = $page['id'];
$uuid = $page['uuid'];
$slug = $page['slug'];
$feature = $page['feature'];
$layout = $page['layout'];
$tags = $page['tags'];
$content = $page['content'];
$date = $page['created'];
$updated = $page['updated'];
$media = $page['media'];
$files = $page['docs'];
$editTitle = $page['title'];
} else {
$id = "";
$uuid = "";
$slug = "";
$feature = "";
$layout = "";
$tags = "";
$content = "";
$date = "";
$updated = "";
$media = "";
$files = "";
$editTitle = "";
};
return view('back.page', [
"status" => $this->member::status(),
"mode" => $mode,
"page" => $page,
"views" => $views,
"id" => $id,
"uuid" => $uuid,
"slug" => $slug,
"feature" => $feature,
"layout" => $layout,
"tags" => $tags,
"content" => $content,
"date" => $date,
"updated" => $updated,
"media" => $media,
"files" => $files,
"title" => urldecode($title),
"editTitle" => urldecode($editTitle),
]);
}
private function book($pageFilter, $pageNum)
{
$result = [];
if ($this->member::status()) {
$result = $this->page->getGroup($pageNum, 4, $pageFilter);
}
return view('back.book', [
"status" => $this->member::status(),
"result" => $result,
"currentPage" => $pageNum,
"title" => "Pages"
]);
}
//---
// POST Actions
//---
public function create(Request $request)
{
$body = json_decode($request->getContent());
$result = $this->page->create($body);
return response()->json($result)->header('Content-Type', 'application/json');
}
//---
// PUT Actions
//---
public function write(Request $request)
{
$body = json_decode($request->getContent());
$result = $this->page->update($body);
return response()->json($result)->header('Content-Type', 'application/json');
}
//---
// DELETE Actions
//---
public function delete(Request $request)
{
$body = json_decode($request->getContent());
$result = $this->page->delete($body);
return response()->json($result)->header('Content-Type', 'application/json');
}
}

View file

@ -1,29 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Interfaces\PageRepositoryInterface;
class RouteDeleteController extends Controller
{
protected $page;
public function __construct(
PageRepositoryInterface $pageRepo
) {
$this->page = $pageRepo;
}
public function handleRequest(Request $request)
{
$path = explode('/', $request->path());
switch ($path[0]) {
case 'page':
$body = json_decode($request->getContent());
$result = $this->page->delete($body);
return response()->json($result)->header('Content-Type', 'application/json');
break;
}
}
}

View file

@ -1,91 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Interfaces\MemberRepositoryInterface;
use App\Services\Data\SettingsService;
class RouteGetController extends Controller
{
protected $dash;
protected $gate;
protected $theme;
protected $front;
protected $member;
protected $settings;
public function __construct(
DashController $dashController,
AuthController $authController,
ThemeController $themeController,
FrontController $frontController,
MemberRepositoryInterface $memberRepo,
SettingsService $settingsService,
) {
$this->dash = $dashController;
$this->gate = $authController;
$this->theme = $themeController;
$this->front = $frontController;
$this->member = $memberRepo;
$this->settings = $settingsService;
}
public function handleRequest($first = null, $second = null, $third = null, $fourth = null)
{
if (isset($first) && !is_numeric($first)) {
switch ($first) {
case 'dashboard':
if ($this->member::status()) {
return $this->dash->init($second, $third, $fourth);
} else {
return $this->dash->login();
}
break;
case 'theme':
if ($this->member::status()) {
if (isset($second)) {
return $this->theme->getView($third, $fourth);
} else {
return $this->theme->start();
}
} else {
return $this->dash->login();
}
break;
case 'tags':
case 'archives':
return $this->front->page($first, $second, $third);
break;
case 'backup':
return $this->downloadBackup($second);
break;
default:
return $this->front->index($first, $second, $third);
break;
}
} else {
return $this->front->index($first, $second, $third);
}
}
private function downloadBackup($type)
{
if ($this->member::status()) {
$latest = '';
$file = '';
if ($type == 'content-download') {
$latest = $this->settings->getGlobal()['last_content_backup'];
$file = 'backup-content-' . $latest . '.zip';
} else {
$latest = $this->settings->getGlobal()['last_files_backup'];
$file = 'backup-files-' . $latest . '.zip';
}
return response()->download(
'../content/backups/' . $file,
$file,
['Content-Type: application/zip']
);
}
}
}

View file

@ -1,122 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use App\Mail\SystemEmail;
use App\Interfaces\PageRepositoryInterface;
use App\Services\Upkeep\MaintenanceService;
use App\Services\Assets\FileUploadService;
use App\Interfaces\MemberRepositoryInterface;
use App\Services\Data\SettingsService;
use App\Services\Upkeep\InitService;
use App\Services\Upkeep\ResetService;
class RoutePostController extends Controller
{
protected $page;
protected $gate;
protected $maintenance;
protected $upload;
protected $settings;
protected $member;
protected $init;
protected $reset;
public function __construct(
PageRepositoryInterface $pageRepo,
AuthController $authController,
MaintenanceService $maintenanceService,
FileUploadService $fileUploadService,
SettingsService $settingsService,
MemberRepositoryInterface $memberRepo,
InitService $initService,
ResetService $resetService,
) {
$this->page = $pageRepo;
$this->gate = $authController;
$this->maintenance = $maintenanceService;
$this->upload = $fileUploadService;
$this->settings = $settingsService;
$this->member = $memberRepo;
$this->init = $initService;
$this->reset = $resetService;
}
public function handleRequest(Request $request)
{
$path = explode('/', $request->path());
switch ($path[0]) {
case 'init':
return $this->initTask($path[1], $request);
break;
case 'login':
return $this->gate->enter($request);
break;
case 'page':
$body = json_decode($request->getContent());
$result = $this->page->create($body);
return response()->json($result)->header('Content-Type', 'application/json');
break;
case 'settings':
if ($path[1] == 'mailer') {
return $this->sendNotify($request);
}
break;
case 'upload':
$result = $result = $this->upload->handleFile($request);
//update configs for specfic uploads
switch ($request['source']) {
case 'avatar-upload':
$member = [];
$member = session('member');
$member['avatar'] = $result['filePath'];
$member = (object) $member;
$this->member->update($member);
break;
case 'background-upload':
$this->settings->updateGlobalData('background', $result['filePath']);
break;
}
return $result;
break;
}
}
private function initTask($task, $request)
{
$result = [];
switch ($task) {
case 'fresh':
$result = $this->init->fresh(json_decode($request->getContent()));
break;
case 'restore':
$result = $this->init->restore($request);
break;
case 'reset':
$result = $this->reset->site($request);
break;
}
return response()->json($result)->header('Content-Type', 'application/json');
}
private function sendNotify($request)
{
$result = [];
try {
Mail::to(env('ADMIN_EMAIL'))->send(new SystemEmail($request->content));
$result = [
'type' => 'mail_good',
'message' => 'Mail Sent',
];
} catch (TransportException $e) {
$result = [
'type' => 'mail_not_good',
'message' => 'Mail Not Sent. It\'s cool. Just check mail settings in the .env',
];
}
return response()->json($result)->header('Content-Type', 'application/json');
}
}

View file

@ -2,75 +2,55 @@
namespace App\Http\Controllers;
use App\Interfaces\PageRepositoryInterface;
use App\Services\Assets\AssetService;
use App\Services\Assets\RenderService;
use App\Interfaces\MemberRepositoryInterface;
use App\Services\Data\SettingsService;
use App\Services\Data\SortingService;
use App\Services\Assets\AssetService;
use App\Services\Assets\RenderService;
use App\Services\Upkeep\MaintenanceService;
use App\Services\Upkeep\ResetService;
use Illuminate\Http\Request;
class RoutePutController extends Controller
class SettingsController extends Controller
{
protected $page;
protected $theme;
protected $member;
protected $settings;
protected $sort;
protected $assets;
protected $render;
protected $settings;
protected $member;
protected $maintenance;
protected $reset;
public function __construct(
PageRepositoryInterface $pageRepo,
AssetService $assetService,
RenderService $renderService,
SettingsService $settingsService,
ThemeController $themeController,
MemberRepositoryInterface $memberRepo,
SettingsService $settingsService,
SortingService $sortingService,
AssetService $assetsService,
RenderService $renderService,
MaintenanceService $maintenanceService,
ResetService $resetService,
) {
$this->page = $pageRepo;
$this->assets = $assetService;
$this->render = $renderService;
$this->settings = $settingsService;
$this->theme = $themeController;
$this->member = $memberRepo;
$this->settings = $settingsService;
$this->sort = $sortingService;
$this->assets = $assetsService;
$this->render = $renderService;
$this->maintenance = $maintenanceService;
$this->reset = $resetService;
}
public function handleRequest(Request $request)
public function start()
{
$path = explode('/', $request->path());
switch ($path[0]) {
case 'page':
$body = json_decode($request->getContent());
$result = $this->page->update($body);
return response()->json($result)->header('Content-Type', 'application/json');
break;
case 'settings':
return $this->settingsTasks($request, $path[1]);
break;
case 'backup':
return $this->createBackup($request);
break;
}
return view('back.settings', ['settings' => $this->sort->settings(), 'nav' => $this->sort->navigation()]);
}
private function createBackup($request)
{
$body = json_decode($request->getContent());
if ($body->task == 'content_backup') {
return response()->json(
$this->maintenance->createContentBackUp()
)->header('Content-Type', 'application/json');
} else {
return response()->json(
$this->maintenance->createFileBackUp()
)->header('Content-Type', 'application/json');
}
}
private function settingsTasks($request, $task)
public function tasks(Request $request)
{
$result = [];
switch ($task) {
switch (explode("/", $request->getURI())[5]) {
case 'publish':
$this->assets->moveToTheme(true);
$result = $this->render->publishAll();
@ -89,4 +69,45 @@ class RoutePutController extends Controller
}
return response()->json($result)->header('Content-Type', 'application/json');
}
public function createBackup(Request $request)
{
$body = json_decode($request->getContent());
if ($body->task == 'content_backup') {
return response()->json(
$this->maintenance->createContentBackUp()
)->header('Content-Type', 'application/json');
} else {
return response()->json(
$this->maintenance->createFileBackUp()
)->header('Content-Type', 'application/json');
}
}
public function downloadBackup($type)
{
if ($this->member::status()) {
$latest = '';
$file = '';
if ($type == 'content-download') {
$latest = $this->settings->getGlobal()['last_content_backup'];
$file = 'backup-content-' . $latest . '.zip';
} else {
$latest = $this->settings->getGlobal()['last_files_backup'];
$file = 'backup-files-' . $latest . '.zip';
}
return response()->download(
'../content/backups/' . $file,
$file,
['Content-Type: application/zip']
);
}
}
public function reset(Request $request)
{
$result = $this->reset->site($request);
return response()->json($result)->header('Content-Type', 'application/json');
}
}

View file

@ -3,6 +3,8 @@
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Mail;
use App\Mail\SystemEmail;
use Illuminate\Http\Request;
class SystemMailController extends Controller
{
@ -14,4 +16,23 @@ class SystemMailController extends Controller
$message = "This is something important. Probably";
Mail::to(env('ADMIN_EMAIL'))->send(new SystemEmail($message));
}
public function sendNotify(Request $request)
{
$result = [];
try {
Mail::to(env('ADMIN_EMAIL'))->send(new SystemEmail($request->content));
$result = [
'type' => 'mail_good',
'message' => 'Mail Sent',
];
} catch (TransportException $e) {
$result = [
'type' => 'mail_not_good',
'message' => 'Mail Not Sent. It\'s cool. Just check mail settings in the .env',
];
}
return response()->json($result)->header('Content-Type', 'application/json');
}
}

View file

@ -61,7 +61,7 @@ class ThemeController extends Controller
$template = $currentTheme . '.page';
//if coming from theme page, grabs id of latest page
if ($id == null) {
$uuid = $this->getPageUUID();
$page = $this->pages->getByUuid($this->getPageUUID());
} else {
//get page by uuid
$page = $this->pages->getByUuid($id);

View file

@ -4,16 +4,16 @@ namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use App\Services\AuthService;
use App\Interfaces\MemberRepositoryInterface;
class MemberCheck
{
protected $auth;
protected MemberRepositoryInterface $member;
public function __construct(
AuthService $authService,
MemberRepositoryInterface $memberRepo,
) {
$this->auth = $authService;
$this->member = $memberRepo;
}
/**
@ -23,7 +23,7 @@ class MemberCheck
*/
public function handle(Request $request, Closure $next)
{
if ($this->auth::status()) {
if ($this->member::status()) {
return $next($request);
} else {
return redirect('dashboard');

View file

@ -1,10 +1,8 @@
article.navigation {
width: 100%;
max-width: 900px;
margin: 100px auto;
main > article > section.settings-tabs > section#site-menu {
padding: 10px 0;
}
article.navigation > section > div.nav-item {
main > article > section.settings-tabs > section#site-menu > div.nav-item {
display: block;
width: 98%;
background: var(--secondary);
@ -15,7 +13,7 @@ article.navigation > section > div.nav-item {
cursor: move;
}
article.navigation > section > div.nav-item > label {
main > article > section.settings-tabs > section#site-menu > label {
display: inline-block;
padding: 5px;
margin: 12px 0 0 10px;
@ -23,24 +21,30 @@ article.navigation > section > div.nav-item > label {
cursor: move;
}
article.navigation > section > div.nav-item > div#nav-btns {
main > article > section.settings-tabs > section#site-menu > div.nav-item > div#nav-btns {
float: right;
padding: 5px;
position: relative;
}
article.navigation > section > div.nav-item > div#nav-btns button {
main
> article
> section.settings-tabs
> section#site-menu
> div.nav-item
> div#nav-btns
button {
margin-left: 5px;
}
@media only screen and (max-width: 500px) {
article.navigation > section > div.nav-item > label {
main > article > section.settings-tabs > section#site-menu > div.nav-item > label {
width: 55%;
margin: 0;
font-size: 0.8em;
}
article.navigation > section i {
main > article > section.settings-tabs > section#site-menu > section i {
font-size: 1.5em;
}
}

View file

@ -17,7 +17,7 @@ article[class="settings"] label {
}
article.settings div.tab-toolbar button {
width: 180px;
width: 120px;
height: 40px;
color: var(--secondary);
}

View file

@ -8,7 +8,7 @@ export default class NavActions {
//--------------------------
syncMenu() {
let navData = [];
let items = document.getElementById('nav-items').children;
let items = document.getElementById('site-menu').children;
for (let index = 0; index < items.length; index++) {
navData.push({
title: items[index].getElementsByTagName('label')[0].innerHTML,

View file

@ -20,7 +20,7 @@ export default class NavIndex {
start() {
//grabs elements and makes them sortables
let self = this;
Sortable.create(document.getElementById('nav-items'), {
Sortable.create(document.getElementById('site-menu'), {
onUpdate: () => {
new NavActions().syncMenu().then(data => {
notify.alert('Updating Menu', null);
@ -68,7 +68,7 @@ export default class NavIndex {
case 'edit-item':
self.processing = false;
window.location =
'/dashboard/page/edit/' + e.target.getAttribute('data-uuid');
'/dashboard/pages/edit/' + e.target.getAttribute('data-uuid');
break;
}
}

View file

@ -212,7 +212,7 @@ export default class PostEditor {
notify.alert(r.message, true);
} else {
notify.alert(r.message, true);
window.location = '/dashboard/page/edit/' + r.id;
window.location = '/dashboard/pages/edit/' + r.id;
}
}
})

View file

@ -7,17 +7,17 @@ export const REQUEST_TYPE_DELETE = 'DELETE';
export const CONTENT_TYPE_JSON = 'json';
export const CONTENT_TYPE_FORM = 'x-www-form-urlencoded';
//** ACTIONS URLS **//
export const API_NEW_PAGE = '/page/create';
export const API_EDIT_PAGE = '/page/write';
export const API_DELETE_PAGE = '/page/delete';
export const API_GET_SETTINGS = '/settings/site';
export const API_SETTINGS_SYNC = '/settings/sync';
export const API_PUBLISH_PAGES = '/settings/publish';
export const API_NAV_SYNC = '/settings/nav-sync';
export const API_NEW_PAGE = '/dashboard/pages/create';
export const API_EDIT_PAGE = '/dashboard/pages/write';
export const API_DELETE_PAGE = '/dashboard/pages/delete';
export const API_GET_SETTINGS = '/dashboard/settings/site';
export const API_SETTINGS_SYNC = '/dashboard/settings/sync';
export const API_PUBLISH_PAGES = '/dashboard/settings/publish';
export const API_NAV_SYNC = '/dashboard/settings/nav-sync';
export const API_GET_MEMBER_INFO = '/settings/member';
export const API_REINDEX_PAGES = '/settings/reindex';
export const API_SEND_MAIL = '/settings/mailer';
export const API_SEND_MAIL = '/dashboard/mailer';
export const API_LOGIN = '/login';
//** ACTIONS TASKS **//

View file

@ -9,11 +9,11 @@ export const CONTENT_TYPE_FORM = 'x-www-form-urlencoded';
//** API URLS **//
export const API_INIT = '/init/fresh';
export const API_RESTORE = '/init/restore';
export const API_RESET = '/init/reset';
export const API_CREATE_BACKUP = '/backup/create';
export const API_DOWNLOAD_BACKUP = '/backup/download';
export const API_RESTORE_BACKUP = '/backup/restore';
export const API_FILES_UPLOAD = '/upload/files';
export const API_RESET = '/dashboard/settings/reset';
export const API_CREATE_BACKUP = '/dashboard/settings/backup/create';
export const API_DOWNLOAD_BACKUP = '/dashboard/settings/backup/download';
export const API_RESTORE_BACKUP = '/dashboard/settings/backup/restore';
export const API_FILES_UPLOAD = '/dashboard/uploads';
//export const API_RESET_PASS = '/api/v1/reset-password';
@ -23,7 +23,7 @@ export const TASK_BACKUP_RESTORE = 'restoreBackup';
export const TASK_BACKUP_CREATE = 'createBackup';
export const TASK_GET_SECRET = 'retrieveSecret';
export const TASK_RESET_PASS = 'resetPassword';
export const TASK_UPLOAD_FILES = 'uploadFiles';
export const TASK_UPLOAD_FILES = '/task/uploadFiles';
//** API STATUS **//
export const API_ACCESS_GOOD = 'apiUseAuthorized';
export const API_ACCESS_BAD = 'apiUseNotAuthorized';

View file

@ -1,33 +0,0 @@
@extends('frame')
@section('title', 'The Dash | Edit Navigation')
@section('main-content')
<article class="navigation">
<section id="nav-items">
@foreach($menu as $item)
<div id="{{ $item['id'] }}" class="nav-item" data-slug="{{ $item['slug'] }}" data-uuid="{{ $item['uuid'] }}" data-path="{{ $item['id'] }}">
<svg id="move-menu-item" class="icon">
<use id="move-menu-item" xlink:href="/assets/images/global/sprite.svg#entypo-select-arrows"/>
</svg>
<label>{{ $item['title'] }}</label>
<div id="nav-btns">
<button id="edit-item" class="nav-btn" data-uuid="{{ $item['uuid'] }}" data-id="{{ $item['id'] }}" title="edit page">
<svg id="edit-item" class="icon" data-uuid="{{ $item['uuid'] }}" data-id="{{ $item['id'] }}">
<use id="edit-item" data-uuid="{{ $item['uuid'] }}" data-id="{{ $item['id'] }}" xlink:href="/assets/images/global/sprite.svg#entypo-edit"/>
</svg>
</button>
<button id="remove-item" class="nav-btn" data-uuid="{{ $item['uuid'] }}" data-id="{{ $item['id'] }}" title="delete from menu">
<svg id="remove-item" class="icon" data-uuid="{{ $item['uuid'] }}" data-id="{{ $item['id'] }}">
<use id="remove-item" data-uuid="{{ $item['uuid'] }}" data-id="{{ $item['id'] }}" xlink:href="/assets/images/global/sprite.svg#entypo-cross"/>
</svg>
</button>
</div>
</div>
@endforeach
</section>
</article>
@endsection
@section('scripting')
<script type="module" src="/assets/scripts/dash/app/EditNav.js"></script>
@endsection

View file

@ -1,169 +1,198 @@
@extends('frame')
@extends('frame')
<?php
$status = $settings['status'];
$title = $settings['title'];
$renderOnSave = $settings['renderOnSave'];
?>
@section('title', 'The Dash | '. $title)
@section('title', 'The Dash | '. $settings['title'])
@section('main-content')
<article class="settings">
<div class="tab-toolbar" role="toolbar">
<button id="profile" class="tab-button">PROFILE</button>
<button id="features" class="tab-button">FEATURES</button>
<button id="themes" class="tab-button">THEMES</button>
</div>
<section class="settings-tabs">
<section id="site-profile" class="section-tab show">
<div class="member-avatar">
<div class="avatar" style="background: url({{ $member['avatar'] }} ) no-repeat center center / cover"></div>
<input id="avatar-upload" type="file" name="avatar-upload"/>
</div>
<div class="site-background">
<div class="background" style="background: url({{ $background }} ) no-repeat center center / cover"></div>
<input id="background-upload" type="file" name="backgrond-upload"/>
</div>
<div>
<input type='text' class="input-dark" name='handle' id='settings-handle' placeholder='handle' value="{{ $member['handle'] }}" autofocus/>
<input type='text' class="input-dark" name='email' id='settings-email' placeholder='email' value="{{ $member['email'] }}" autofocus/>
<input type='hidden' name='member-id' id='member-id' value="{{ $member['id'] }}"/>
</div>
<div>
<input type='text' class="input-dark" name='base-url' id='settings-url' placeholder='url' value="{{ $baseUrl }}" autofocus/>
<input type='text' class="input-dark" name='base-title' id='settings-title' placeholder='site title' value="{{ $siteTitle }}" autofocus/>
</div>
<div>
<textarea id="settings-desc" class="input-dark" type='text' name='settings_desc' class='settings-dec' placeholder='description stuff' , autofocus>{{ $desc }}</textarea>
</div>
<div>
<div>
<label>API KEY</label>
<span>{{ $member['key'] }}</span>
@section('main-content')
<article class="settings">
<div class="tab-toolbar" role="toolbar">
<button id="profile" class="tab-button">PROFILE</button>
<button id="features" class="tab-button">FEATURES</button>
<button id="themes" class="tab-button">THEMES</button>
<button id="menu" class="tab-button">MENU</button>
</div>
<section class="settings-tabs">
<section id="site-profile" class="section-tab show">
<div class="member-avatar">
<div class="avatar" style="background: url({{$settings['member']['avatar']}} ) no-repeat center center / cover"></div>
<input id="avatar-upload" type="file" name="avatar-upload" />
</div>
<div class="site-background">
<div class="background" style="background: url({{$settings['background']}} ) no-repeat center center / cover"></div>
<input id="background-upload" type="file" name="backgrond-upload" />
</div>
<div>
<label>FORM TOKEN</label><br/>
<span>{{ $ftoken }}</span>
<input type='text' class="input-dark" name='handle' id='settings-handle' placeholder='handle' value="{{$settings['member']['handle']}}" autofocus />
<input type='text' class="input-dark" name='email' id='settings-email' placeholder='email' value="{{$settings['member']['email']}}" autofocus />
<input type='hidden' name='member-id' id='member-id' value="{{$settings['member']['id']}}" />
</div>
</div>
</section>
<section id="site-features" class="section-tab hide">
<div class="features-mail">
<button id="send-test-mail">
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-mail-with-circle"/>
</svg>
<span>TEST MAIL</span>
</button>
<div>
<label>SYSTEM EMAIL</label><br />
set email settings in .env file
<input type='text' class="input-dark" name='base-url' id='settings-url' placeholder='url' value="{{$settings['baseUrl']}}" autofocus />
<input type='text' class="input-dark" name='base-title' id='settings-title' placeholder='site title' value="{{$settings['siteTitle']}}" autofocus />
</div>
</div>
<div class="site-options">
<div class="option-container">
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-landline"/>
</svg>
@if(isset($apiStatus) && $apiStatus == 'true')
<button id="api-access-toggle" title="allow external api" data-enabled="true">
<span id="api-status">API ACCESS ENABLED</span>
</button>
@else
<button id="api-access-toggle" title="allow external api" data-enabled="false">
<span id="api-status">API ACCESS NOT ENABLED</span>
</button>
@endif
<div>
<textarea id="settings-desc" class="input-dark" type='text' name='settings_desc' class='settings-dec' placeholder='description stuff' , autofocus>{{$settings['desc']}}</textarea>
</div>
<div class="option-container">
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-cycle"/>
</svg>
@if(isset($dynamicRenderStatus) && $dynamicRenderStatus == 'true')
<button id="dynamic-render-toggle" title="allow external api" data-enabled="true">
<span id="dynamic-render-status">DYNAMIC PAGE RENDERING</span>
</button>
<div>
<div>
<label>API KEY</label>
<span>{{$settings['member']['key']}}</span>
</div>
<div>
<label>FORM TOKEN</label><br />
<span>{{$settings['ftoken']}}</span>
</div>
@else
<button id="dynamic-render-toggle" title="allow external api" data-enabled="false">
<span id="dynamic-render-status">STATIC PAGE RENDERING</span>
</button>
@endif
</div>
</div>
<div class="site-maintenance">
<div class="option-container">
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-copy"/>
</svg>
<button id="create-content-backup">
<span>CONTENT BACKUP</span>
</section>
<section id="site-features" class="section-tab hide">
<div class="features-mail">
<button id="send-test-mail">
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-mail-with-circle" />
</svg>
<span>TEST MAIL</span>
</button>
<span>
@if($lastContentBackup != '')
MOST RECENT:
<a href="/backup/content-download">{{ $lastContentBackup }}</a><br/>
<div>
<label>SYSTEM EMAIL</label><br />
set email settings in .env file
</div>
</div>
<div class="site-options">
<div class="option-container">
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-landline" />
</svg>
@if(isset($settings['apiStatus']) && $settings['apiStatus'] == 'true')
<button id="api-access-toggle" title="allow external api" data-enabled="true">
<span id="api-status">API ACCESS ENABLED</span>
</button>
@else
<span>span No back ups. Frowny face.</span>
<button id="api-access-toggle" title="allow external api" data-enabled="false">
<span id="api-status">API ACCESS NOT ENABLED</span>
</button>
@endif
<span>
</div>
<div class="option-container">
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-images"/>
</svg>
<button id="create-file-backup">
<span>FILE BACKUP</span>
</button>
<span>
@if($lastFilesBackup != '')
MOST RECENT:
<a href="/backup/files-download">{{ $lastFilesBackup }}</a><br/>
</div>
<div class="option-container">
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-cycle" />
</svg>
@if(isset($settings['dynamicRenderStatus']) && $settings['dynamicRenderStatus'] == 'true')
<button id="dynamic-render-toggle" title="allow external api" data-enabled="true">
<span id="dynamic-render-status">DYNAMIC PAGE RENDERING</span>
</button>
@else
<span>span No back ups. Frowny face.</span>
<button id="dynamic-render-toggle" title="allow external api" data-enabled="false">
<span id="dynamic-render-status">STATIC PAGE RENDERING</span>
</button>
@endif
</span>
</div>
</div>
<div class="option-container">
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-back-in-time"/>
</svg>
<button id="reset-to-default">
<span>RESET TO DEFAULT</span>
</button>
<span>Deletes all content and configs <strong>CANNOT UNDO</strong></span>
<div class="site-maintenance">
<div class="option-container">
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-copy" />
</svg>
<button id="create-content-backup">
<span>CONTENT BACKUP</span>
</button>
<span>
@if($settings['lastContentBackup'] != '')
MOST RECENT:
<a href="/dashboard/settings/backup/get/content-download">{{$settings['lastContentBackup']}}</a><br />
@else
<span>span No back ups. Frowny face.</span>
@endif
<span>
</div>
<div class="option-container">
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-images" />
</svg>
<button id="create-file-backup">
<span>FILE BACKUP</span>
</button>
<span>
@if($settings['lastFilesBackup'] != '')
MOST RECENT:
<a href="/dashboard/settings/backup/get/files-download">{{$settings['lastFilesBackup']}}</a><br />
@else
<span>span No back ups. Frowny face.</span>
@endif
</span>
</div>
<div class="option-container">
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-back-in-time" />
</svg>
<button id="reset-to-default">
<span>RESET TO DEFAULT</span>
</button>
<span>Deletes all content and configs <strong>CANNOT UNDO</strong></span>
</div>
</div>
</div>
</section>
<section id="site-themes" class="section-tab hide">
@foreach($themes as $theme)
@if($theme['name'] == $currentTheme)
<!--
</section>
<section id="site-themes" class="section-tab hide">
@foreach($settings['themes'] as $theme)
@if($theme['name'] == $settings['currentTheme'])
<!--
<a target="_blank" href='/theme'>Edit</a>
-->
<button id="{{ $theme['name'] }}" class="theme-select" data-enabled="true">
<div for="{{ $theme['name'] }}">
<label id="label-{{ $theme['name'] }}">ACTIVE THEME</label>
</div>
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-palette"/>
<button id="{{$theme['name']}}" class="theme-select" data-enabled="true">
<div for="{{$theme['name']}}">
<label id="label-{{$theme['name']}}">ACTIVE THEME</label>
</div>
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-palette" />
</svg>
<span for="{{$theme['name']}}">{{$theme['display-name']}}</span>
</button>
@else
<button id="{{$theme['name']}}" class="theme-select" data-enabled="false">
<div for="{{$theme['name']}}">
<label id="label-{{$theme['name']}}">INACTIVE THEME</label>
</div>
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-palette" />
</svg>
<span for="{{$theme['name']}}">{{$theme['display-name']}}</span>
</button>
@endif
@endforeach
</section>
<section id="site-menu" class="section-tab hide">
@foreach($nav['menu'] as $item)
<div id="{{$item['id']}}" class="nav-item" data-slug="{{$item['slug']}}" data-uuid="{{$item['uuid']}}" data-path="{{$item['id']}}">
<svg id="move-menu-item" class="icon">
<use id="move-menu-item" xlink:href="/assets/images/global/sprite.svg#entypo-select-arrows" />
</svg>
<span for="{{ $theme['name'] }}">{{ $theme['display-name'] }}</span>
</button>
@else
<button id="{{ $theme['name'] }}" class="theme-select" data-enabled="false">
<div for="{{ $theme['name'] }}">
<label id="label-{{ $theme['name'] }}">INACTIVE THEME</label>
<label>@php echo urldecode($item['title']) @endphp</label>
<div id="nav-btns">
<button id="edit-item" class="nav-btn" data-uuid="{{$item['uuid']}}" data-id="{{$item['id']}}" title="edit page">
<svg id="edit-item" class="icon" data-uuid="{{$item['uuid']}}" data-id="{{$item['id']}}">
<use id="edit-item" data-uuid="{{$item['uuid']}}" data-id="{{$item['id']}}" xlink:href="/assets/images/global/sprite.svg#entypo-edit" />
</svg>
</button>
<button id="remove-item" class="nav-btn" data-uuid="{{$item['uuid']}}" data-id="{{$item['id']}}" title="delete from menu">
<svg id="remove-item" class="icon" data-uuid="{{$item['uuid']}}" data-id="{{$item['id']}}">
<use id="remove-item" data-uuid="{{$item['uuid']}}" data-id="{{$item['id']}}" xlink:href="/assets/images/global/sprite.svg#entypo-cross" />
</svg>
</button>
</div>
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-palette"/>
</svg>
<span for="{{ $theme['name'] }}">{{ $theme['display-name'] }}</span>
</button>
@endif
@endforeach
</div>
@endforeach
</section>
</section>
</section>
</article>
@endsection
@section('scripting')
<script type="module" src="/assets/scripts/dash/app/EditSettings.js"></script>
@endsection
</article>
@endsection
@section('scripting')
<script type="module" src="/assets/scripts/dash/app/EditSettings.js"></script>
<script type="module" src="/assets/scripts/dash/app/EditNav.js"></script>
@endsection

View file

@ -1,38 +1,38 @@
@extends('frame')
@extends('frame')
@section('title', 'The Dash | Start')
@section('main-content')
<section class="index-header">
<div class="index-header-left">
<h1>Recent</h1>
</div>
<div class="index-header-right"></div>
</section>
<section class="index-recent-pages">
@if($result['entryCount'] != 0)
@foreach($result['pages'] as $page)
@php
@section('main-content')
<section class="index-header">
<div class="index-header-left">
<h1>Recent</h1>
</div>
<div class="index-header-right"></div>
</section>
<section class="index-recent-pages">
@if($result['entryCount'] != 0)
@foreach($result['pages'] as $page)
@php
$type = '';
$file = '';
isset($page['media'][0]['type']) ? $type = $page['media'][0]['type'] : $type = '';
isset($page['media'][0]['file']) ? $file = $page['media'][0]['file'] : $file = '';
@endphp
@if($type =='mp4')
<a href="/dashboard/page/edit/{{ $page['uuid'] }}" id="{{ $page['uuid'] }}" class="post-video-link recent-link">
@include('includes.recent-meta')
<video class="post-video" loop muted autoplay>
<source src="{{ $file }}" type="video/mp4">
Sorry, your browser doesn't support embedded videos.
</video>
</a>
@else
<a href="/dashboard/page/edit/{{ $page['uuid'] }}" id="{{ $page['uuid'] }}" class="post-link recent-link" style="background: url({{ $file }}) no-repeat center center / cover #cf436b">
@include('includes.recent-meta')
</a>
@endif
@endforeach
@endif
</section>
@endphp
@if($type =='mp4')
<a href="/dashboard/page/edit/{{$page['uuid']}}" id="{{$page['uuid']}}" class="post-video-link recent-link">
@include('includes.recent-meta')
<video class="post-video" loop muted autoplay>
<source src="{{$file}}" type="video/mp4">
Sorry, your browser doesn't support embedded videos.
</video>
</a>
@else
<a href="/dashboard/pages/edit/{{$page['uuid']}}" id="{{$page['uuid']}}" class="post-link recent-link" style="background: url({{$file}}) no-repeat center center / cover #cf436b">
@include('includes.recent-meta')
</a>
@endif
@endforeach
@endif
</section>
@endsection
@endsection

View file

@ -8,6 +8,7 @@
@include('includes.submenu-start')
@break
@case("Add New")
@case("Edit Page")
@include('includes.submenu-edit-page')
@break
@ -17,11 +18,6 @@
<use id="nav-settings-icon" xlink:href="/assets/images/global/sprite.svg#entypo-cog" />
</svg>
</a>
<a id="navigation" class="main-nav-secondary-highlight" href="/dashboard/navigation" title="edit navigation">
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-link" />
</svg>
</a>
<a id="navigation" class="main-nav-secondary-highlight" href="/dashboard/logout" title="log out">
<svg id="nav-logout-icon" class="icon">
<use id="nav-logout-icon" xlink:href="/assets/images/global/sprite.svg#entypo-log-out" />
@ -55,11 +51,6 @@
<use id="nav-settings-icon" xlink:href="/assets/images/global/sprite.svg#entypo-cog" />
</svg>
</a>
<a id="navigation" class="main-nav-secondary-highlight" href="/dashboard/navigation" title="edit navigation">
<svg id="nav-menu-icon" class="icon">
<use id="nav-menu-icon" xlink:href="/assets/images/global/sprite.svg#entypo-link" />
</svg>
</a>
<a id="navigation" class="main-nav-secondary-highlight" href="/dashboard/logout" title="log out">
<svg id="nav-logout-icon" class="icon">
<use id="nav-logout-icon" xlink:href="/assets/images/global/sprite.svg#entypo-log-out" />

View file

@ -42,7 +42,7 @@ if(isset($page['uuid']))
<svg id="option-published-icon" class="icon">
<use id="option-published-icon" xlink:href="/assets/images/global/sprite.svg#entypo-globe" />
</svg>
</button><a href="/theme/view/page/{{$uuid}}" target="_blank"><button id="option-preview" class="option-inactive post-option-btn" data-active="false" title='preview page' aria-label="preview post">
</button><a href="/dashboard/themekit/view/page/{{$uuid}}" target="_blank"><button id="option-preview" class="option-inactive post-option-btn" data-active="false" title='preview page' aria-label="preview post">
<svg id="option-preview-icon" class="icon">
<use id="option-preview-icon" xlink:href="/assets/images/global/sprite.svg#entypo-eye" />
</svg>

View file

@ -1,4 +1,4 @@
@php
<?php
if($page['menu'] == 'true')
{
@ -21,35 +21,35 @@ if($page['featured'] == 'true')
$featured = 'false';
}
@endphp
?>
<aside>
<strong>
{{ $page['updated'] }}
{{$page['updated']}}
</strong>
<hr/>
<hr />
<strong>
@php
$title = urldecode($page['title']);
@endphp
{{ $title }}
{{$title}}
</strong>
<hr/>
<button data-active="{{ $menu }}">
<hr />
<button data-active="{{$menu}}">
<svg id="option-menu-pin" class="icon">
<use id="option-menu-pin" xlink:href="/assets/images/global/sprite.svg#entypo-pin"/>
<use id="option-menu-pin" xlink:href="/assets/images/global/sprite.svg#entypo-pin" />
</svg>
</button>
<button data-active="{{ $published }}">
<button data-active="{{$published}}">
<svg id="option-published-icon" class="icon">
<use id="option-published-icon" xlink:href="/assets/images/global/sprite.svg#entypo-globe"/>
<use id="option-published-icon" xlink:href="/assets/images/global/sprite.svg#entypo-globe" />
</svg>
</button>
<button data-active="{{ $featured }}">
<button data-active="{{$featured}}">
<svg id="option-feature-icon" class="icon">
<use id="option-feature-icon" xlink:href="/assets/images/global/sprite.svg#entypo-star"/>
<use id="option-feature-icon" xlink:href="/assets/images/global/sprite.svg#entypo-star" />
</svg>
</button>
</aside>
</aside>

View file

@ -4,7 +4,7 @@
<use id="option-menu-pin" xlink:href="/assets/images/global/sprite.svg#minicute-book" />
</svg>
</a>
<a class="main-nav-primary" href='/dashboard/page/add/new' title="add new page">
<a class="main-nav-primary" href='/dashboard/pages/add/new' title="add new page">
<svg id="option-menu-pin" class="icon">
<use id="option-menu-pin" xlink:href="/assets/images/global/sprite.svg#entypo-squared-plus" />
</svg>

View file

@ -1,23 +1,23 @@
@extends('frame')
@extends('frame')
@section('title', 'The Dash | Fipamo Theme Kit')
@section('main-content')
<section class="index-header">
<div class="index-header-left">
<h1>Templates</h1>
<h2>Base</h2>
<a class="secondary" href="/theme/view/index">Index</a><br />
<a class="secondary" href="/theme/view/page">Page</a><br />
<a class="secondary" href="/theme/view/tags">Tags</a><br />
<a class="secondary" href="/theme/view/archive">Archive</a><br />
<h2>Custom</h2>
@foreach($pages as $view)
@if($view != 'page')
<a href="/theme/view/{{ $view }}" class="secondary" href="">{{ $view }}</a><br />
@endif
@endforeach
</div>
<div class="index-header-right"></div>
</section>
@endsection
@section('main-content')
<section class="index-header">
<div class="index-header-left">
<h1>Templates</h1>
<h2>Base</h2>
<a class="secondary" href="/dashboard/themekit/view/index">Index</a><br />
<a class="secondary" href="/dashboard/themekit/view/page">Page</a><br />
<a class="secondary" href="/dashboard/themekit/view/tags">Tags</a><br />
<a class="secondary" href="/dashboard/themekit/view/archive">Archive</a><br />
<h2>Custom</h2>
@foreach($pages as $view)
@if($view != 'page')
<a href="/dashboard/themekit/view/{{$view}}" class="secondary" href="">{{$view}}</a><br />
@endif
@endforeach
</div>
<div class="index-header-right"></div>
</section>
@endsection

View file

@ -1,28 +1,74 @@
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\RouteGetController;
use App\Http\Controllers\RoutePostController;
use App\Http\Controllers\RoutePutController;
use App\Http\Controllers\RouteDeleteController;
use App\Http\Controllers\FrontController;
use App\Http\Controllers\PageController;
use App\Http\Controllers\DashController;
use App\Http\Controllers\SettingsController;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\ThemeController;
use App\Http\Controllers\SystemMailController;
use App\Http\Middleware\VerifyCsrfToken;
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::prefix('/')
->controller(FrontController::class)
->group(function () {
Route::get("/{one?}/{two?}/{three?}", 'start')->where('one', '^((?!dashboard).)*$');
Route::post("/init/{task}", 'init');
});
//REFACTOR: Reorganize routes here intstead of controllers to reduce confusion
Route::get("/{first?}/{second?}/{third?}/{four?}", [RouteGetController::class, 'handleRequest']);
Route::post("/{first?}/{second?}/{third?}", [RoutePostController::class, 'handleRequest'])
->middleware(VerifyCsrfToken::class);
Route::put("/{first?}/{second?}/{third?}", [RoutePutController::class, 'handleRequest'])
->middleware(VerifyCsrfToken::class);
Route::delete("/{first?}/{second?}/{third?}", [RouteDeleteController::class, 'handleRequest'])
->middleware(VerifyCsrfToken::class);
//login stuff
Route::post("/login", [AuthController::class, 'enter']);
//Dashboard
Route::prefix('dashboard')
->middleware('member.check')
->controller(DashController::class)
->group(function () {
Route::get("/", 'login')->withoutMiddleware('member.check');
Route::get("/start", 'start');
Route::get("/logout", 'logout');
Route::post("/uploads", 'uploads');
})->name('dashboard');
//Pages
Route::prefix('dashboard/pages')
->middleware('member.check')
->controller(PageController::class)
->group(function () {
Route::get("/{pageFilter?}/{pageNum?}", 'start');
Route::get("/{mode?}/{uuid?}", 'start');
Route::put("/write", 'write');
Route::post("/create", 'create');
Route::delete("/delete", 'delete');
});
//Settings
Route::prefix('dashboard/settings')
->middleware('member.check')
->controller(SettingsController::class)
->group(function () {
Route::get("/", 'start');
Route::put("/{task}", 'tasks');
Route::put("/backup/create", 'createBackup');
Route::get("/backup/get/{type}", 'downloadBackup');
Route::post("/reset", 'reset');
});
//mailer
Route::prefix('dashboard/mailer')
->middleware('member.check')
->controller(SystemMailController::class)
->group(function () {
Route::post("/", 'sendNotify');
});
//themekit
Route::prefix('dashboard/themekit')
->middleware('member.check')
->controller(ThemeController::class)
->group(function () {
Route::get("/", 'start');
Route::get("/view/{view?}/{id?}", 'getView');
});