Added edit profile button to own profile.
This commit is contained in:
parent
d1c109a84f
commit
aa748e60c2
3 changed files with 86 additions and 55 deletions
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,70 +96,78 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="profile__header__stats">
|
<div class="profile__header__options">
|
||||||
<div class="profile__header__stat" title="{{ profile.created_at|date('r') }}">
|
<div class="profile__header__actions">
|
||||||
<div class="profile__header__stat__name">
|
{% if current_user.user_id|default(0) == profile.user_id %}
|
||||||
Joined
|
<a href="/settings.php" class="profile__header__action">Edit Profile</a>
|
||||||
</div>
|
{% endif %}
|
||||||
<time class="profile__header__stat__value" datetime="{{ profile.created_at|date('c') }}">
|
|
||||||
{{ profile.created_at|time_diff }}
|
|
||||||
</time>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if profile.last_seen is not null %}
|
<div class="profile__header__stats">
|
||||||
<div class="profile__header__stat" title="{{ profile.last_seen|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">
|
||||||
Last seen
|
Joined
|
||||||
</div>
|
</div>
|
||||||
<time class="profile__header__stat__value" datetime="{{ profile.last_seen|date('c') }}">
|
<time class="profile__header__stat__value" datetime="{{ profile.created_at|date('c') }}">
|
||||||
{{ profile.last_seen|date('U') + 10 >= ''|date('U') ? 'just now' : profile.last_seen|time_diff }}
|
{{ profile.created_at|time_diff }}
|
||||||
</time>
|
</time>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if profile.forum_topic_count > 0 %}
|
{% if profile.last_seen is not null %}
|
||||||
<div class="profile__header__stat">
|
<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">
|
||||||
Topics
|
Last seen
|
||||||
|
</div>
|
||||||
|
<time class="profile__header__stat__value" datetime="{{ profile.last_seen|date('c') }}">
|
||||||
|
{{ profile.last_seen|date('U') + 10 >= ''|date('U') ? 'just now' : profile.last_seen|time_diff }}
|
||||||
|
</time>
|
||||||
</div>
|
</div>
|
||||||
<div class="profile__header__stat__value">
|
{% endif %}
|
||||||
{{ profile.forum_topic_count|number_format }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if profile.forum_post_count > 0 %}
|
{% if profile.forum_topic_count > 0 %}
|
||||||
<div class="profile__header__stat">
|
<div class="profile__header__stat">
|
||||||
<div class="profile__header__stat__name">
|
<div class="profile__header__stat__name">
|
||||||
Posts
|
Topics
|
||||||
|
</div>
|
||||||
|
<div class="profile__header__stat__value">
|
||||||
|
{{ profile.forum_topic_count|number_format }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="profile__header__stat__value">
|
{% endif %}
|
||||||
{{ profile.forum_post_count|number_format }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if profile.comments_count > 0 %}
|
{% if profile.forum_post_count > 0 %}
|
||||||
<div class="profile__header__stat">
|
<div class="profile__header__stat">
|
||||||
<div class="profile__header__stat__name">
|
<div class="profile__header__stat__name">
|
||||||
Comments
|
Posts
|
||||||
|
</div>
|
||||||
|
<div class="profile__header__stat__value">
|
||||||
|
{{ profile.forum_post_count|number_format }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="profile__header__stat__value">
|
{% endif %}
|
||||||
{{ profile.comments_count|number_format }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if profile.changelog_count > 0 %}
|
{% if profile.comments_count > 0 %}
|
||||||
<a class="profile__header__stat" href="/changelog.php?u={{ profile.user_id }}">
|
<div class="profile__header__stat">
|
||||||
<div class="profile__header__stat__name">
|
<div class="profile__header__stat__name">
|
||||||
Changes
|
Comments
|
||||||
|
</div>
|
||||||
|
<div class="profile__header__stat__value">
|
||||||
|
{{ profile.comments_count|number_format }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="profile__header__stat__value">
|
{% endif %}
|
||||||
{{ profile.changelog_count|number_format }}
|
|
||||||
</div>
|
{% if profile.changelog_count > 0 %}
|
||||||
</a>
|
<a class="profile__header__stat" href="/changelog.php?u={{ profile.user_id }}">
|
||||||
{% endif %}
|
<div class="profile__header__stat__name">
|
||||||
|
Changes
|
||||||
|
</div>
|
||||||
|
<div class="profile__header__stat__value">
|
||||||
|
{{ profile.changelog_count|number_format }}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue