diff options
| author | winter | 2025-01-18 16:01:25 +0000 |
|---|---|---|
| committer | winter | 2025-01-18 16:01:25 +0000 |
| commit | c0e65d0446f928b30eecc858c5cf9a8eb1a364c1 (patch) | |
| tree | bb22cd9b3e6b4a05f9bf2b41393f3aaa9048f4bb /templates | |
| parent | ba61c6435b668375a411716f3a35447aa38b03a4 (diff) | |
implement profile editing
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/actor_profile.php | 10 | ||||
| -rw-r--r-- | templates/actor_profile_editable.php | 32 |
2 files changed, 40 insertions, 2 deletions
diff --git a/templates/actor_profile.php b/templates/actor_profile.php index 0dc3ccd..46ee273 100644 --- a/templates/actor_profile.php +++ b/templates/actor_profile.php @@ -25,13 +25,13 @@ $user = UserAccount::findByCurrentSession(); </div> </div> <?php if (isset($actor->bio) && $actor->bio != '') { ?> - <p class="bio"><?= $actor->bio ?></p> + <pre class="bio"><?= $actor->bio ?></pre> <?php } else { call_template('placeholder_text', ['message' => __('user.profile.bio.placeholder')]); } ?> <?php if (isset($user) && $actor->id != $user->actor->id): ?> - <div class="followInfo"> + <div class="profileActions"> <?php if ($actor->followsPending($user->actor)) call_template('actor_profile_pending_follow', ['subject' => $actor, 'object' => $user->actor]); ?> <?php if ($actor->follows($user->actor)): ?> @@ -39,5 +39,11 @@ $user = UserAccount::findByCurrentSession(); <?php endif; ?> <?php call_template('actor_profile_follow_button', ['actor' => $actor, 'user' => $user]); ?> </div> + <?php elseif ($actor->id == $user->actor->id): ?> + <div class="profileActions"> + <button class="primary" hx-get="/fragment/profile" hx-target="closest .fullProfile" hx-swap="outerHTML"> + <?= __('form.edit') ?> + </button> + </div> <?php endif; ?> </div>
\ No newline at end of file diff --git a/templates/actor_profile_editable.php b/templates/actor_profile_editable.php new file mode 100644 index 0000000..2c0ef5c --- /dev/null +++ b/templates/actor_profile_editable.php @@ -0,0 +1,32 @@ +<form class="fullProfile" hx-post="/fragment/profile" hx-swap="outerHTML" enctype="multipart/form-data"> + <div class="basicInfo"> + <?php call_template('actor_avatar', ['actor' => $actor]); ?> + <div> + <div class="row"> + <label for="profileDisplayName"><?= __('user.profile.displayName') ?></label> + <input id="profileDisplayName" name="displayName" type="text" required + value="<?= $actor->displayName ?>"> + </div> + <div class="handle">@<?= $actor->getFullHandle() ?></div> + <div class="joinedDate"><?= sprintf(__('user.profile.createdAt'), $actor->created->format('Y-m-d')) ?></div> + </div> + </div> + + <div class="row"> + <label for="profileAvatar"><?= __('user.profile.changeAvatar') ?></label> + <input type="file" id="profileAvatar" name="avatar" accept="image/*"> + </div> + + <div class="row"> + <label for="profileBio"><?= __('user.profile.bio') ?></label> + <textarea id="profileBio" name="bio"><?= htmlspecialchars($actor->bio ?? '') ?></textarea> + </div> + + <div class="profileActions"> + <button type="button" class="secondary" hx-get="/fragment/actor/<?= $actor->id ?>" + hx-target="closest .fullProfile" hx-swap="outerHTML"> + <?= __('form.discardChanges') ?> + </button> + <button class="primary"><?= __('form.saveChanges') ?></button> + </div> +</form>
\ No newline at end of file |
