Commit ada8bd22 authored by Michael Iseard's avatar Michael Iseard
Browse files

Further simplify controllers

parent 7a21c874
......@@ -8,27 +8,33 @@ use function App\get_logo;
class App extends Controller {
public function body_class() {
return 'app-template';
}
/**
* @return array
* Calculate extra body classes
*
* @return string
*/
public function logo() {
return [
'style' => get_logo('white'),
'size' => '25px'
];
public function body_class() {
$class=[];
if($this->site_news()) {
array_push($class, 'site-news');
}
return implode(" ", $class);
}
/**
* Define navbar variables
*
* @return array
*/
public function navbar() {
return [
'navClass' => 'navbar-dark',
'btnClass' => 'btn-outline-light'
'class' => 'navbar-dark',
'logoStyle' => get_logo('white'),
'logoSize' => '25px',
'btnClass' => 'btn-outline-light'
];
}
......
......@@ -22,21 +22,15 @@ class FrontPage extends Controller {
}
/**
* @return array
*/
public function logo() {
return [
'style' => get_logo('small'),
'size' => '40px'
];
}
/**
* Define navbar variables
*
* @return array
*/
public function navbar() {
return [
'navClass' => 'navbar-light',
'class' => 'navbar-light',
'logoStyle' => get_logo('color'),
'logoSize' => '40px',
'btnClass' => 'btn-outline-secondary'
];
}
......
<!doctype html>
<html {!! get_language_attributes() !!}>
@include('partials.head')
<body @php body_class($body_class ?? 'app-template') @endphp>
<body @php body_class($body_class ?? '') @endphp>
@php do_action('get_header') @endphp
@include('partials.header')
@yield('above-container')
......
......@@ -9,9 +9,9 @@
<header class="banner w-100 py-3 position-absolute">
<div class="container">
<nav id="nav_primary" class="navbar navbar-expand-lg nav-primary {{ $navbar['navClass'] }}">
<nav id="nav_primary" class="navbar navbar-expand-lg nav-primary {{ $navbar['class'] }}">
<a class="navbar-brand d-flex align-items-center mr-5" href="{{ home_url('/') }}">
<img alt="Kudos Logo" height="{{ $logo['size'] }}" src="{{ $logo['style'] }}"/>
<img alt="Kudos Logo" height="{{ $navbar['logoSize'] }}" src="{{ $navbar['logoStyle'] }}"/>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarMobileMenu" aria-controls="navbarMobileMenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment