Layout updates, switch user updates

This commit is contained in:
Deon George 2018-08-01 16:28:10 +10:00
parent 444c159ab9
commit 0bd32aab4a
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254
7 changed files with 19 additions and 14 deletions

View File

@ -5,7 +5,7 @@
@include('adminlte::layouts.partials.htmlheader') @include('adminlte::layouts.partials.htmlheader')
@show @show
<body class="fixed skin-blue sidebar-mini"> <body class="fixed hold-transition skin-blue sidebar-mini">
<div id="app" v-cloak> <div id="app" v-cloak>
<div class="wrapper"> <div class="wrapper">
@include('adminlte::layouts.partials.mainheader') @include('adminlte::layouts.partials.mainheader')

View File

@ -1,5 +1,5 @@
<!-- Main Footer --> <!-- Main Footer -->
<footer class="main-footer"> <footer class="main-footer no-print">
<!-- To the right --> <!-- To the right -->
<div class="pull-right hidden-xs"> <div class="pull-right hidden-xs">
<a href="#"></a><b>{{ config('app.name') }}</b></a> <a href="#"></a><b>{{ config('app.name') }}</b></a>

View File

@ -1,5 +1,6 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{ config('app.name') }} - @yield('htmlheader_title', 'Your title here')</title> <title>{{ config('app.name') }} - @yield('htmlheader_title', 'Your title here')</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'> <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- CSRF Token --> <!-- CSRF Token -->
@ -14,6 +15,10 @@
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--> <![endif]-->
<style>
body { color: #333; }
</style>
<script> <script>
//See https://laracasts.com/discuss/channels/vue/use-trans-in-vuejs //See https://laracasts.com/discuss/channels/vue/use-trans-in-vuejs
window.trans = window.trans =
@ -32,4 +37,4 @@
<!-- STYLESHEETS --> <!-- STYLESHEETS -->
{!! Asset::styles() !!} {!! Asset::styles() !!}
</head> </head>

View File

@ -18,5 +18,5 @@
Both of these plugins are recommended to enhance the Both of these plugins are recommended to enhance the
user experience. Slimscroll is required when using the user experience. Slimscroll is required when using the
fixed layout. --> fixed layout. -->
@js('/site/js/jquery.slimscroll.min.js','jq.slimscroll'); @js('/site/js/jquery.slimscroll.min.js','jq.slimscroll')
@js('/site/js/fastclick.min.js','jq.fastclick'); @js('/site/js/fastclick.min.js','jq.fastclick')

View File

@ -1,5 +1,5 @@
<ul class="sidebar-menu" data-widget="tree"> <ul class="sidebar-menu" data-widget="tree">
<li class="header">Menu</li> <li class="header"><b>MENU</b></li>
<!-- Optionally, you can add icons to the links --> <!-- Optionally, you can add icons to the links -->
<li @if(Route::current()->getName() == 'home')class="active"@endif><a href="{{ url('home',['date'=>(isset($ido) ? $ido->id : NULL)]) }}"><i class='fa fa-link'></i> <span>{{ trans('adminlte_lang::message.home') }}</span></a></li> <li @if(Route::current()->getName() == 'home')class="active"@endif><a href="{{ url('home',['date'=>(isset($ido) ? $ido->id : NULL)]) }}"><i class='fa fa-link'></i> <span>{{ trans('adminlte_lang::message.home') }}</span></a></li>
</ul> </ul>

View File

@ -16,9 +16,9 @@ class AdminController extends Controller
$this->middleware('auth'); $this->middleware('auth');
} }
public function switch_authorised() public function switch_authorised($id)
{ {
return Auth::user()->isAdmin ? TRUE : FALSE; return (method_exists(Auth::user(),'isAdmin') && Auth::user()->isAdmin($id)) ? TRUE : FALSE;
} }
public function switch_session() public function switch_session()
@ -31,7 +31,7 @@ class AdminController extends Controller
*/ */
public function user_switch_start($id) public function user_switch_start($id)
{ {
if ($this->switch_session() AND $this->switch_authorised()) if ($this->switch_session() AND $this->switch_authorised($id))
{ {
$uo = User::find($id); $uo = User::find($id);

View File

@ -9,13 +9,13 @@ use Session;
trait UserSwitch trait UserSwitch
{ {
public function GetIsAdminAttribute()
{
return isset($this->admin) ? $this->admin : FALSE;
}
public function getSwitchedAttribute() public function getSwitchedAttribute()
{ {
return Session::get('orig_user'); return Session::get('orig_user');
} }
public function isAdmin($id)
{
return isset($this->admin) ? $this->admin : FALSE;
}
} }