Added a dark mode theme
Added a dark mode theme with settings option
This commit is contained in:
parent
7b37eba517
commit
31f1faf8ee
|
@ -105,6 +105,7 @@ class HomeController extends Controller
|
||||||
->get();
|
->get();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Session::put('dark_mode', $settings[0]->dark_mode ?? 0);
|
||||||
Session::put('timer_version_footer', $settings[0]->show_versions_footer ?? 1);
|
Session::put('timer_version_footer', $settings[0]->show_versions_footer ?? 1);
|
||||||
Session::put('show_servers_public', $settings[0]->show_servers_public ?? 0);
|
Session::put('show_servers_public', $settings[0]->show_servers_public ?? 0);
|
||||||
Session::put('show_server_value_ip', $settings[0]->show_server_value_ip ?? 0);
|
Session::put('show_server_value_ip', $settings[0]->show_server_value_ip ?? 0);
|
||||||
|
|
|
@ -22,6 +22,7 @@ class SettingsController extends Controller
|
||||||
public function update(Request $request, Settings $settings)
|
public function update(Request $request, Settings $settings)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
|
'dark_mode' => 'required|boolean',
|
||||||
'show_versions_footer' => 'required|boolean',
|
'show_versions_footer' => 'required|boolean',
|
||||||
'show_server_value_ip' => 'required|boolean',
|
'show_server_value_ip' => 'required|boolean',
|
||||||
'show_server_value_hostname' => 'required|boolean',
|
'show_server_value_hostname' => 'required|boolean',
|
||||||
|
@ -38,6 +39,7 @@ class SettingsController extends Controller
|
||||||
DB::table('settings')
|
DB::table('settings')
|
||||||
->where('id', 1)
|
->where('id', 1)
|
||||||
->update([
|
->update([
|
||||||
|
'dark_mode' => $request->dark_mode,
|
||||||
'show_versions_footer' => $request->show_versions_footer,
|
'show_versions_footer' => $request->show_versions_footer,
|
||||||
'show_servers_public' => $request->show_servers_public,
|
'show_servers_public' => $request->show_servers_public,
|
||||||
'show_server_value_ip' => $request->show_server_value_ip,
|
'show_server_value_ip' => $request->show_server_value_ip,
|
||||||
|
@ -52,6 +54,7 @@ class SettingsController extends Controller
|
||||||
'recently_added_amount' => $request->recently_added_amount
|
'recently_added_amount' => $request->recently_added_amount
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Session::put('dark_mode', $request->dark_mode ?? 1);
|
||||||
Session::put('timer_version_footer', $request->show_versions_footer);
|
Session::put('timer_version_footer', $request->show_versions_footer);
|
||||||
Session::put('show_servers_public', $request->show_servers_public);
|
Session::put('show_servers_public', $request->show_servers_public);
|
||||||
Session::put('show_server_value_ip', $request->show_server_value_ip);
|
Session::put('show_server_value_ip', $request->show_server_value_ip);
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddDarkModeSetting extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('settings', function (Blueprint $table) {
|
||||||
|
$table->boolean('dark_mode')->default(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
BIN
public/css/bootstrap-dark.min.css
vendored
Normal file
BIN
public/css/bootstrap-dark.min.css
vendored
Normal file
Binary file not shown.
|
@ -10,7 +10,12 @@
|
||||||
|
|
||||||
<title>@yield('title') - @if (config()->has('app.name')) {{ config('app.name') }} @else My idlers @endif</title>
|
<title>@yield('title') - @if (config()->has('app.name')) {{ config('app.name') }} @else My idlers @endif</title>
|
||||||
|
|
||||||
|
@if(Session::get('dark_mode'))
|
||||||
|
<link rel="stylesheet" href="{{ asset('css/bootstrap-dark.min.css') }}">
|
||||||
|
@else
|
||||||
<link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}">
|
<link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}">
|
||||||
|
@endif
|
||||||
|
|
||||||
<link rel="stylesheet" href="{{ asset('css/fa.min.css') }}">
|
<link rel="stylesheet" href="{{ asset('css/fa.min.css') }}">
|
||||||
|
|
||||||
@yield('css_links')
|
@yield('css_links')
|
||||||
|
|
|
@ -17,6 +17,22 @@
|
||||||
<form action="{{ route('settings.update', 1) }}" method="POST">
|
<form action="{{ route('settings.update', 1) }}" method="POST">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
|
<div class="row mt-2">
|
||||||
|
<div class="col-12 col-md-4 mb-3">
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend"><span
|
||||||
|
class="input-group-text">Use dark mode</span></div>
|
||||||
|
<select class="form-control" name="dark_mode">
|
||||||
|
<option value="1" {{ ($setting[0]->dark_mode === 1) ? 'selected' : '' }}>
|
||||||
|
Yes
|
||||||
|
</option>
|
||||||
|
<option value="0" {{ ($setting[0]->dark_mode === 0) ? 'selected' : '' }}>
|
||||||
|
No
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row mt-2">
|
<div class="row mt-2">
|
||||||
<div class="col-12 col-md-4 mb-3">
|
<div class="col-12 col-md-4 mb-3">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user