Skip to content

Commit 8b109ba

Browse files
committed
Trimmed long names in header
Fixes #87
1 parent 097d9c9 commit 8b109ba

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

app/User.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,19 @@ public function getEditUrl()
162162
{
163163
return '/settings/users/' . $this->id;
164164
}
165+
166+
/**
167+
* Get a shortened version of the user's name.
168+
* @param int $chars
169+
* @return string
170+
*/
171+
public function getShortName($chars = 8)
172+
{
173+
if (strlen($this->name) <= $chars) return $this->name;
174+
175+
$splitName = explode(' ', $this->name);
176+
if (strlen($splitName[0]) <= $chars) return $splitName[0];
177+
178+
return '';
179+
}
165180
}

resources/assets/sass/_header.scss

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,14 @@ header {
5656
padding-top: $-xxs;
5757
}
5858
> i {
59-
padding-top: $-xs*1.2;
59+
padding-top: 4px;
60+
font-size: 18px;
6061
}
6162
@include smaller-than($screen-md) {
6263
padding-left: $-xs;
6364
.name {
6465
display: none;
6566
}
66-
i {
67-
font-size: 2em;
68-
padding-left: 0;
69-
padding-top: 0;
70-
}
7167
}
7268
}
7369
@include smaller-than($screen-md) {

resources/views/base.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<div class="dropdown-container" dropdown>
5757
<span class="user-name" dropdown-toggle>
5858
<img class="avatar" src="{{$currentUser->getAvatar(30)}}" alt="{{ $currentUser->name }}">
59-
<span class="name" ng-non-bindable>{{ $currentUser->name }}</span> <i class="zmdi zmdi-caret-down"></i>
59+
<span class="name" ng-non-bindable>{{ $currentUser->getShortName(9) }}</span> <i class="zmdi zmdi-caret-down"></i>
6060
</span>
6161
<ul>
6262
<li>

0 commit comments

Comments
 (0)