Added edit profile button to own profile.

This commit is contained in:
flash 2018-09-17 11:20:15 +02:00
parent d1c109a84f
commit aa748e60c2
3 changed files with 86 additions and 55 deletions

View file

@ -40,11 +40,31 @@
} }
} }
&__stats { &__options {
background-color: rgba(0, 0, 0, .9); background-color: rgba(0, 0, 0, .9);
padding: 0 20px; padding: 0 20px;
display: flex; display: flex;
justify-content: flex-end; justify-content: space-between;
}
&__actions {
display: flex;
align-items: center;
}
&__action {
border-radius: 2px;
color: var(--accent-colour);
text-decoration: none;
border: 1px solid var(--accent-colour);
margin-right: 10px;
padding: 5px 10px;
cursor: pointer;
font-size: 1.2em;
}
&__stats {
display: flex;
} }
&__stat { &__stat {
@ -53,6 +73,10 @@
text-decoration: none; text-decoration: none;
padding: 10px; padding: 10px;
&--date {
min-width: 130px;
}
&__name { &__name {
font-size: .9em; font-size: .9em;
font-variant: small-caps; font-variant: small-caps;

View file

@ -5,7 +5,7 @@ use Misuzu\IO\File;
require_once __DIR__ . '/../misuzu.php'; require_once __DIR__ . '/../misuzu.php';
$user_id = (int)($_GET['u'] ?? 0); $user_id = (int)($_GET['u'] ?? 0);
$mode = (string)($_GET['m'] ?? 'view'); $mode = (string)($_GET['m'] ?? null);
switch ($mode) { switch ($mode) {
case 'avatar': case 'avatar':
@ -54,7 +54,6 @@ switch ($mode) {
echo file_get_contents($user_background); echo file_get_contents($user_background);
break; break;
case 'view':
default: default:
$getProfile = Database::prepare(' $getProfile = Database::prepare('
SELECT SELECT
@ -99,6 +98,6 @@ switch ($mode) {
'profile' => $profile, 'profile' => $profile,
'has_background' => is_file(build_path($app->getStoragePath(), 'backgrounds/original', "{$profile['user_id']}.msz")), 'has_background' => is_file(build_path($app->getStoragePath(), 'backgrounds/original', "{$profile['user_id']}.msz")),
]); ]);
echo tpl_render('user.view'); echo tpl_render('user.profile');
break; break;
} }

View file

@ -96,8 +96,15 @@
</div> </div>
</div> </div>
<div class="profile__header__options">
<div class="profile__header__actions">
{% if current_user.user_id|default(0) == profile.user_id %}
<a href="/settings.php" class="profile__header__action">Edit Profile</a>
{% endif %}
</div>
<div class="profile__header__stats"> <div class="profile__header__stats">
<div class="profile__header__stat" title="{{ profile.created_at|date('r') }}"> <div class="profile__header__stat profile__header__stat--date" title="{{ profile.created_at|date('r') }}">
<div class="profile__header__stat__name"> <div class="profile__header__stat__name">
Joined Joined
</div> </div>
@ -107,7 +114,7 @@
</div> </div>
{% if profile.last_seen is not null %} {% if profile.last_seen is not null %}
<div class="profile__header__stat" title="{{ profile.last_seen|date('r') }}"> <div class="profile__header__stat profile__header__stat--date" title="{{ profile.last_seen|date('r') }}">
<div class="profile__header__stat__name"> <div class="profile__header__stat__name">
Last seen Last seen
</div> </div>
@ -162,6 +169,7 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div>
<div class="profile__info"> <div class="profile__info">