Added dark mode as an option

This commit is contained in:
Hillel Coren 2017-06-19 14:19:25 +03:00
parent a5772dfcbf
commit 973ceec719
11 changed files with 100 additions and 22 deletions

View File

@ -1143,6 +1143,7 @@ class AccountController extends BaseController
$user->username = $email; $user->username = $email;
$user->email = $email; $user->email = $email;
$user->phone = trim(Input::get('phone')); $user->phone = trim(Input::get('phone'));
$user->dark_mode = Input::get('dark_mode');
if (! Auth::user()->is_admin) { if (! Auth::user()->is_admin) {
$user->notify_sent = Input::get('notify_sent'); $user->notify_sent = Input::get('notify_sent');

View File

@ -54,7 +54,7 @@ class SimplifyTasks extends Migration
$table->integer('break_duration')->nullable(); $table->integer('break_duration')->nullable();
}); });
if (Schema::hasColumn('accounts', 'dark_mode')) { if (Schema::hasColumn('users', 'dark_mode')) {
Schema::table('users', function ($table) { Schema::table('users', function ($table) {
$table->dropColumn('dark_mode'); $table->dropColumn('dark_mode');
}); });

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class UpdateDarkMode extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function ($table) {
$table->boolean('dark_mode')->default(true)->change();
});
DB::statement('update users set dark_mode = 1;');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -39,38 +39,68 @@ thead th {
border-left: 1px solid #999; border-left: 1px solid #999;
} }
.sidebar-nav { .sidebar-nav-dark {
background-color: #313131; background-color: #313131;
} }
.sidebar-nav li { .sidebar-nav-dark li {
border-bottom:solid 1px #444444; border-bottom:solid 1px #444444;
} }
.sidebar-nav i.fa { .sidebar-nav-dark li > a {
color: white; color: #aaa;
} }
.menu-toggle i, .sidebar-nav-dark li:hover > a,
.sidebar-nav li > a { .sidebar-nav-dark li > a.active {
color: #999999;
}
.menu-toggle:hover i,
.sidebar-nav li:hover > a,
.sidebar-nav li > a.active {
color: #fff; color: #fff;
} }
.sidebar-nav li:hover, .sidebar-nav-dark li:hover,
.sidebar-nav li.active { .sidebar-nav-dark li.active {
background: rgba(255,255,255,0.1); background: rgba(255,255,255,0.1);
} }
.sidebar-nav-light {
background-color: #FFFFFF;
}
.sidebar-nav-light li {
border-bottom:solid 1px #DDD;
}
.sidebar-nav-light li > a {
color: #757575;
}
.sidebar-nav-light li:hover > a,
.sidebar-nav-light li > a.active {
color: #363636;
}
.sidebar-nav-light li:hover,
.sidebar-nav-light li.active {
background: rgba(140,140,140,0.1);
}
.menu-toggle i {
color: #999999;
}
.menu-toggle:hover {
color: #fff;
}
.menu-toggle { .menu-toggle {
color: #999 !important; color: #999 !important;
} }
.sidebar-nav a.btn i.fa,
.navbar-header:hover i,
.menu-toggle:hover { .menu-toggle:hover {
color: #fff !important; color: #fff !important;
} }

View File

@ -92,13 +92,23 @@
margin: 0; margin: 0;
list-style: none; list-style: none;
height: 100%; height: 100%;
}
.sidebar-nav-dark {
box-shadow: inset 0 0 6px #000000; box-shadow: inset 0 0 6px #000000;
-moz-box-shadow: inset 0 0 6px #000000; -moz-box-shadow: inset 0 0 6px #000000;
-webkit-box-shadow: inset 0 0 5px #000000; -webkit-box-shadow: inset 0 0 5px #000000;
} }
.sidebar-nav-light {
height: 100%;
box-shadow: inset 0 0 4px #888;
-moz-box-shadow: inset 0 0 4px #888;
-webkit-box-shadow: inset 0 0 4px #888;
}
#left-sidebar-wrapper .sidebar-nav li { #left-sidebar-wrapper .sidebar-nav li {
text-indent: 20px; text-indent: 14px;
line-height: 36px; line-height: 36px;
} }

View File

@ -624,7 +624,7 @@ $LANG = array(
'times' => 'Times', 'times' => 'Times',
'set_now' => 'Set to now', 'set_now' => 'Set to now',
'dark_mode' => 'Dark Mode', 'dark_mode' => 'Dark Mode',
'dark_mode_help' => 'Show white text on black background', 'dark_mode_help' => 'Use a dark background for the sidebars',
'add_to_invoice' => 'Add to invoice :invoice', 'add_to_invoice' => 'Add to invoice :invoice',
'create_new_invoice' => 'Create new invoice', 'create_new_invoice' => 'Create new invoice',
'task_errors' => 'Please correct any overlapping times', 'task_errors' => 'Please correct any overlapping times',

View File

@ -14,6 +14,7 @@
{{ Former::populateField('last_name', $user->last_name) }} {{ Former::populateField('last_name', $user->last_name) }}
{{ Former::populateField('email', $user->email) }} {{ Former::populateField('email', $user->email) }}
{{ Former::populateField('phone', $user->phone) }} {{ Former::populateField('phone', $user->phone) }}
{{ Former::populateField('dark_mode', intval($user->dark_mode)) }}
@if (Input::has('affiliate')) @if (Input::has('affiliate'))
{{ Former::populateField('referral_code', true) }} {{ Former::populateField('referral_code', true) }}
@ -47,6 +48,11 @@
!!} !!}
@endif @endif
{!! Former::checkbox('dark_mode')
->help(trans('texts.dark_mode_help'))
->text(trans('texts.enable'))
->value(1) !!}
@if (Utils::isNinja()) @if (Utils::isNinja())
@if ($user->referral_code) @if ($user->referral_code)
{{ Former::setOption('capitalize_translations', false) }} {{ Former::setOption('capitalize_translations', false) }}

View File

@ -361,7 +361,7 @@
<!-- Sidebar --> <!-- Sidebar -->
<div id="left-sidebar-wrapper" class="hide-phone"> <div id="left-sidebar-wrapper" class="hide-phone">
<ul class="sidebar-nav"> <ul class="sidebar-nav {{ Auth::user()->dark_mode ? 'sidebar-nav-dark' : 'sidebar-nav-light' }}">
@foreach([ @foreach([
'dashboard', 'dashboard',
'clients', 'clients',
@ -422,7 +422,7 @@
<!-- /#left-sidebar-wrapper --> <!-- /#left-sidebar-wrapper -->
<div id="right-sidebar-wrapper" class="hide-phone" style="overflow-y:hidden"> <div id="right-sidebar-wrapper" class="hide-phone" style="overflow-y:hidden">
<ul class="sidebar-nav"> <ul class="sidebar-nav {{ Auth::user()->dark_mode ? 'sidebar-nav-dark' : 'sidebar-nav-light' }}">
{!! \App\Libraries\HistoryUtils::renderHtml(Auth::user()->account_id) !!} {!! \App\Libraries\HistoryUtils::renderHtml(Auth::user()->account_id) !!}
</ul> </ul>
</div> </div>

View File

@ -17,7 +17,7 @@
@endif @endif
<a href="{{ url($option == 'recurring' ? 'recurring_invoice' : $option) }}" <a href="{{ url($option == 'recurring' ? 'recurring_invoice' : $option) }}"
style="font-size:15px; padding-top:6px; padding-bottom:6px" style="font-size:16px; padding-top:6px; padding-bottom:6px"
class="nav-link {{ Request::is("{$option}*") ? 'active' : '' }}"> class="nav-link {{ Request::is("{$option}*") ? 'active' : '' }}">
<i class="fa fa-{{ empty($icon) ? \App\Models\EntityModel::getIcon($option) : $icon }}" style="width:46px; padding-right:10px"></i> <i class="fa fa-{{ empty($icon) ? \App\Models\EntityModel::getIcon($option) : $icon }}" style="width:46px; padding-right:10px"></i>
{{ ($option == 'recurring_invoices') ? trans('texts.recurring') : mtrans($option) }} {{ ($option == 'recurring_invoices') ? trans('texts.recurring') : mtrans($option) }}