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);
|
||||
padding: 0 20px;
|
||||
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 {
|
||||
|
@ -53,6 +73,10 @@
|
|||
text-decoration: none;
|
||||
padding: 10px;
|
||||
|
||||
&--date {
|
||||
min-width: 130px;
|
||||
}
|
||||
|
||||
&__name {
|
||||
font-size: .9em;
|
||||
font-variant: small-caps;
|
||||
|
|
|
@ -5,7 +5,7 @@ use Misuzu\IO\File;
|
|||
require_once __DIR__ . '/../misuzu.php';
|
||||
|
||||
$user_id = (int)($_GET['u'] ?? 0);
|
||||
$mode = (string)($_GET['m'] ?? 'view');
|
||||
$mode = (string)($_GET['m'] ?? null);
|
||||
|
||||
switch ($mode) {
|
||||
case 'avatar':
|
||||
|
@ -54,7 +54,6 @@ switch ($mode) {
|
|||
echo file_get_contents($user_background);
|
||||
break;
|
||||
|
||||
case 'view':
|
||||
default:
|
||||
$getProfile = Database::prepare('
|
||||
SELECT
|
||||
|
@ -99,6 +98,6 @@ switch ($mode) {
|
|||
'profile' => $profile,
|
||||
'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;
|
||||
}
|
||||
|
|
|
@ -96,70 +96,78 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="profile__header__stats">
|
||||
<div class="profile__header__stat" title="{{ profile.created_at|date('r') }}">
|
||||
<div class="profile__header__stat__name">
|
||||
Joined
|
||||
</div>
|
||||
<time class="profile__header__stat__value" datetime="{{ profile.created_at|date('c') }}">
|
||||
{{ profile.created_at|time_diff }}
|
||||
</time>
|
||||
<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>
|
||||
|
||||
{% if profile.last_seen is not null %}
|
||||
<div class="profile__header__stat" title="{{ profile.last_seen|date('r') }}">
|
||||
<div class="profile__header__stats">
|
||||
<div class="profile__header__stat profile__header__stat--date" title="{{ profile.created_at|date('r') }}">
|
||||
<div class="profile__header__stat__name">
|
||||
Last seen
|
||||
Joined
|
||||
</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 class="profile__header__stat__value" datetime="{{ profile.created_at|date('c') }}">
|
||||
{{ profile.created_at|time_diff }}
|
||||
</time>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if profile.forum_topic_count > 0 %}
|
||||
<div class="profile__header__stat">
|
||||
<div class="profile__header__stat__name">
|
||||
Topics
|
||||
{% if profile.last_seen is not null %}
|
||||
<div class="profile__header__stat profile__header__stat--date" title="{{ profile.last_seen|date('r') }}">
|
||||
<div class="profile__header__stat__name">
|
||||
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 class="profile__header__stat__value">
|
||||
{{ profile.forum_topic_count|number_format }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if profile.forum_post_count > 0 %}
|
||||
<div class="profile__header__stat">
|
||||
<div class="profile__header__stat__name">
|
||||
Posts
|
||||
{% if profile.forum_topic_count > 0 %}
|
||||
<div class="profile__header__stat">
|
||||
<div class="profile__header__stat__name">
|
||||
Topics
|
||||
</div>
|
||||
<div class="profile__header__stat__value">
|
||||
{{ profile.forum_topic_count|number_format }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="profile__header__stat__value">
|
||||
{{ profile.forum_post_count|number_format }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if profile.comments_count > 0 %}
|
||||
<div class="profile__header__stat">
|
||||
<div class="profile__header__stat__name">
|
||||
Comments
|
||||
{% if profile.forum_post_count > 0 %}
|
||||
<div class="profile__header__stat">
|
||||
<div class="profile__header__stat__name">
|
||||
Posts
|
||||
</div>
|
||||
<div class="profile__header__stat__value">
|
||||
{{ profile.forum_post_count|number_format }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="profile__header__stat__value">
|
||||
{{ profile.comments_count|number_format }}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if profile.changelog_count > 0 %}
|
||||
<a class="profile__header__stat" href="/changelog.php?u={{ profile.user_id }}">
|
||||
<div class="profile__header__stat__name">
|
||||
Changes
|
||||
{% if profile.comments_count > 0 %}
|
||||
<div class="profile__header__stat">
|
||||
<div class="profile__header__stat__name">
|
||||
Comments
|
||||
</div>
|
||||
<div class="profile__header__stat__value">
|
||||
{{ profile.comments_count|number_format }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="profile__header__stat__value">
|
||||
{{ profile.changelog_count|number_format }}
|
||||
</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if profile.changelog_count > 0 %}
|
||||
<a class="profile__header__stat" href="/changelog.php?u={{ profile.user_id }}">
|
||||
<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>
|
||||
|
Loading…
Add table
Reference in a new issue