Change location of switch user

This commit is contained in:
Chris 2018-10-16 10:59:35 +01:00
parent 75133474f7
commit c47f296f17
5 changed files with 88 additions and 13 deletions

View file

@ -59,7 +59,12 @@ class AppServiceProvider extends ServiceProvider
$lang = Setting::fetch('language');
\App::setLocale($lang);
$allusers = User::all();
$current_user = User::currentUser();
$view->with('alt_bg', $alt_bg );
$view->with('allusers', $allusers );
$view->with('current_user', $current_user );
});

44
public/css/app.css vendored
View file

@ -234,14 +234,50 @@ body {
}
#switchuser {
background: rgba(0, 0, 0, 0.6);
background: rgba(0, 0, 0, 0.5);
position: absolute;
padding: 5px;
padding: 10px;
color: white;
text-align: center;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
border-top: 2px solid rgba(255, 255, 255, 0.15);
border-right: 2px solid rgba(255, 255, 255, 0.15);
-webkit-box-shadow: 0 0 10px 0px rgba(0, 0, 0, 0.4);
box-shadow: 0 0 10px 0px rgba(0, 0, 0, 0.4);
border-radius: 0 9px 0 0;
line-height: 1.5;
font-size: 14px;
}
#switchuser img {
width: 50px;
margin-bottom: 5px;
}
#switchuser .btn {
font-size: 13px;
color: white;
text-decoration: none;
margin-left: -10px;
margin-right: -12px;
margin-bottom: -10px;
margin-top: 8px;
border-radius: 0;
width: calc(100% + 22px);
}
#app {

View file

@ -1,4 +1,4 @@
{
"/css/app.css": "/css/app.css?id=6bc80b2f799b708a8024",
"/js/app.js": "/js/app.js?id=32cbf6f4924b46ae7e05"
}
"/css/app.css": "/css/app.css?id=1dc828711282cb6af1c7",
"/js/app.js": "/js/app.js?id=f18d23b8fc7a094a2c66"
}

View file

@ -8,14 +8,38 @@ body {
background: $body-bg;
}
#switchuser {
background: rgba(0,0,0,0.6);
background: rgba(0,0,0,0.5);
position: absolute;
padding: 5px;
padding: 10px;
color: white;
text-align: center;
top:0;
bottom:0;
left: 0;
right: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-top: 2px solid rgba(255, 255, 255, 0.15);
border-right: 2px solid rgba(255, 255, 255, 0.15);
box-shadow: 0 0 10px 0px rgba(0, 0, 0, 0.4);
border-radius: 0 9px 0 0;
line-height: 1.5;
font-size: 14px;
img {
width: 50px;
margin-bottom: 5px;
}
.btn {
font-size: 13px;
color: white;
text-decoration: none;
margin-left: -10px;
margin-right: -12px;
margin-bottom: -10px;
margin-top: 8px;
border-radius: 0;
width: calc(100% + 22px);
}
}
#app {
display: flex;

View file

@ -71,7 +71,17 @@
</div>
</div>
@endif
<a id="switchuser" href="{{ route('user.select') }}">Switch User</a>
@if($allusers->count() > 1)
<div id="switchuser">
@if($current_user->avatar)
<img class="user-img" src="{{ asset('/storage/'.$current_user->avatar) }}" />
@else
<img class="user-img" src="{{ asset('/img/heimdall-icon-small.png') }}" />
@endif
{{ $current_user->name }}
<a class="btn" href="{{ route('user.select') }}">Switch User</a>
</div>
@endif
@yield('content')
<div id="config-buttons">
@ -81,7 +91,7 @@
@endif
<a id="dash" class="config" href="{{ route('dash', [], false) }}"><i class="fas fa-th"></i></a>
@if(App\User::currentUser()->id === 1)
@if($current_user->id === 1)
<a id="users" class="config" href="{{ route('users.index', [], false) }}"><i class="fas fa-user"></i></a>
@endif
<a id="items" class="config" href="{{ route('items.index', [], false) }}"><i class="fas fa-list"></i></a>