forked from projects/fipamo
ro
a92e124957
the default theme included with fipamo was a bit janky, so that's been cleaned to bring it more inline with current accessiblility standards, an updated mobile friendly menu, updated the logo and plugged in the fresh colors. the layout is still a bit boring but the main purpose of the default is to show how templating works, so it needs to be kept as simple as possible but it still has some room for making it pop a bit more.
63 lines
1.9 KiB
PHP
63 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Theming;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Interfaces\PageRepositoryInterface;
|
|
use App\Services\AuthService;
|
|
use App\Services\SortingService;
|
|
use App\Services\AssetService;
|
|
|
|
class ThemeController extends Controller
|
|
{
|
|
protected PageRepositoryInterface $pages;
|
|
protected AuthService $auth;
|
|
protected AssetService $assets;
|
|
protected SortingService $sort;
|
|
|
|
public function __construct(
|
|
PageRepositoryInterface $pageRepository,
|
|
AuthService $authService,
|
|
AssetService $assetService,
|
|
SortingService $sortService,
|
|
) {
|
|
$this->pages = $pageRepository;
|
|
$this->auth = $authService;
|
|
$this->assets = $assetService;
|
|
$this->sort = $sortService;
|
|
}
|
|
|
|
public function getView($view = 'index')
|
|
{
|
|
//move assets to theme testing dir
|
|
$this->assets->moveToTheme();
|
|
$currentTheme = $this->assets->getCurrentTheme();
|
|
$template;
|
|
$pageData = [];
|
|
switch ($view) {
|
|
case "index":
|
|
case "page":
|
|
$view == 'index' ?
|
|
$template = $currentTheme . '.index' :
|
|
$template = $currentTheme . '.page';
|
|
$page = $this->pages->getById('F4429D34-25E7-4CA9-9B0A-742810277505');
|
|
$pageData = $this->sort->page($page);
|
|
break;
|
|
case "tags":
|
|
$template = $currentTheme . '.tags';
|
|
$pageData = $this->sort->tags();
|
|
break;
|
|
case "archives":
|
|
case "archive":
|
|
$template = $currentTheme . '.archive';
|
|
$pageData = $this->sort->archive();
|
|
break;
|
|
}
|
|
if ($this->auth::status()) {
|
|
return view($template, $pageData);
|
|
} else {
|
|
return redirect('dashboard/start');
|
|
}
|
|
}
|
|
}
|