Permalink
Browse files

improved theme handling

Signed-off-by: Tassu <git@tassu.me>
  • Loading branch information...
supertassu committed Jan 19, 2019
1 parent d4217a4 commit 616c9a89e70fc01e21faa80fad594ddaf92e2156
@@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ViewController extends Controller
{
/**
* @param Request $request
* @return \Response
*/
public function index(Request $request) {
$theme = $request->query('theme') ? $request->query('theme') : config('statu.default-theme', 'light');
if (!in_array($theme, ['light', 'dark'])) {
$theme = config('statu.default-theme', 'light');
}
return view('welcome', ['theme' => $theme]);
}
}
@@ -7,6 +7,7 @@
'refresh-time' => 30,
'expand-categories-by-default' => true,
'default-theme' => 'dark',
// date & time settings
'date-format' => 'MMM Do, HH:mm',
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

document.getElementById('whoopsie').setAttribute('style', 'display: none;');
window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
window.moment = __webpack_require__(/*! moment */ "./node_modules/moment/moment.js");
@@ -1,3 +1,5 @@
document.getElementById('whoopsie').setAttribute('style', 'display: none;');

window.Vue = require('vue');
window.$ = window.jQuery = require('jquery');

@@ -14,7 +14,7 @@
<link rel="preload" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css"
as="style" onload="this.rel = 'stylesheet'">

@if (Request::query('dark') === 'true')
@if ($theme === 'dark')
<link href="{{ asset('css/dark.css') }}" rel="stylesheet">
@else
<link href="{{ asset('css/light.css') }}" rel="stylesheet">
@@ -34,19 +34,16 @@

<section class="section" id="app">
<div class="container">
<small style="margin-top: 15px;">
@if (Request::query('dark') === 'true')
<a href="?dark=false">Use light theme</a>
@else
<a href="?dark=true">Use dark theme</a>
@endif
</small>

@yield('content')

<p style="margin-top: 15px;">
Powered by <strong><a href="https://github.com/supertassu/statu">Statu</a></strong>
<a href="https://github.com/supertassu/statu/commit/{{ \App\ApplicationVersion::instance()->getLongHash() }}">{{ \App\ApplicationVersion::instance()->get() }}</a>.
@if ($theme === 'dark')
<a href="?theme=light">Use light theme</a>.
@else
<a href="?theme=dark">Use dark theme</a>.
@endif
</p>
</div>
</section>
@@ -8,6 +8,11 @@
{!! config('statu.title') !!}
</p>

<system-status></system-status>
<div id="whoopsie">
<div class="notification is-danger">
Looks like something went wrong. Please try again.
</div>
</div>

<system-status></system-status>
@endsection
@@ -11,6 +11,4 @@
|
*/
Route::get('/', function () {
return view('welcome');
});
Route::get('/', 'ViewController@index');

0 comments on commit 616c9a8

Please sign in to comment.