Added user avatars next to their chosen option
This commit is contained in:
parent
67c02f458c
commit
0448f995f7
@ -34,7 +34,7 @@ function get_page_header(
|
||||
}
|
||||
$script_str = '';
|
||||
foreach ($scripts as $script) {
|
||||
$script_str .= '<script src="scripts/' . $script . '.js">';
|
||||
$script_str .= '<script src="scripts/' . $script . '.js"></script>';
|
||||
}
|
||||
return '<html><head><meta charset="utf-8"><title>'.$title.'</title><link rel="stylesheet" href="styles/style.css">'
|
||||
. $script_str
|
||||
|
@ -60,8 +60,6 @@ header {
|
||||
}
|
||||
|
||||
.poll .header {
|
||||
/*display: flex;
|
||||
align-items: center;*/
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
@ -89,3 +87,9 @@ header {
|
||||
datewrapper time {
|
||||
grid-column: 2;
|
||||
}
|
||||
|
||||
.options {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
grid-column-gap: 8px;
|
||||
}
|
||||
|
@ -35,14 +35,14 @@ try {
|
||||
. '<input type="hidden" name="id" value="'.$poll_id.'"><button type="submit">Access poll</button></form>'
|
||||
);
|
||||
}
|
||||
|
||||
jslog($poll);
|
||||
$user_avatar_url = $poll->user->getAvatarUrl(50);
|
||||
$username = '@' . $poll->user->username;
|
||||
$disabled = $poll->canVote() ? '' : 'disabled';
|
||||
$user_name = $poll->user->name ?? '';
|
||||
$created_at = $poll->created_at;
|
||||
$closed_at = $poll->closed_at;
|
||||
jslog('teyt');
|
||||
|
||||
?>
|
||||
<div class="poll">
|
||||
<div class="header">
|
||||
@ -68,11 +68,22 @@ jslog('teyt');
|
||||
</div>
|
||||
<div class="options">
|
||||
<?php
|
||||
$row = 1;
|
||||
$user_args = [
|
||||
'include_html' => false,
|
||||
'include_counts' => false,
|
||||
];
|
||||
foreach ($poll->options as $option) {
|
||||
$checked = $option->is_your_response ? 'checked' : ''; ?>
|
||||
<div class="options">
|
||||
<input type="checkbox" <?= $checked.' '.$disabled ?>/>
|
||||
<span class="option-text"><?= $option->text ?></span>
|
||||
<div class="option" style="grid-row: <?= $row ?>;">
|
||||
<input type="checkbox" <?= $checked.' '.$disabled ?>/>
|
||||
<span class="option-text"><?= $option->text . ' (' . $option->respondents . ')'?></span>
|
||||
</div>
|
||||
<div class="option-responses" style="grid-row: <?= $row++ ?>;grid-column: 2;">
|
||||
<?php foreach ($option->respondent_ids as $res_id) {
|
||||
$u = $api->getUser($res_id, $user_args); ?>
|
||||
<img src="<?= $u->getAvatarUrl(20) ?>" class="avatar" title="@<?= $u->username ?>">
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user