@@ -9,14 +9,13 @@ $active_user_id = ($active_user ? $active_user->getId() : null);
9
9
$ c_edit_visible_admin = ($ active_user && ($ active_user ->getOptionsBitmask () & User::OPTION_ACL_COMMENT_MODIFY ));
10
10
$ c_delete_visible_admin = ($ active_user && ($ active_user ->getOptionsBitmask () & User::OPTION_ACL_COMMENT_DELETE ));
11
11
?>
12
- <div class="row mt-3">
13
- <div class="col">
14
- <h2><a name="comments">Comments</a></h2>
12
+ <div class="row mt-3 justify-content-center ">
13
+ <div class="col-md-9 ">
14
+ <h2><a href="#comments" name="comments">Comments</a></h2>
15
15
<? if (!$ comments ) { ?>
16
16
<div class="border border-secondary m-auto rounded-pill p-2" style="max-width:400px;"><p class="text-center mb-0"><em>no one has commented yet.</em></p></div>
17
- <? } else { ?>
18
- <table class="table table-striped text-white-50"><tbody>
19
- <? foreach ($ comments as $ c ) {
17
+ <? } else {
18
+ foreach ($ comments as $ c ) {
20
19
$ c_created_dt = $ c ->getCreatedDateTime ();
21
20
$ c_id = rawurlencode ($ c ->getId ());
22
21
$ c_parent_url = $ c ->getParentUrl ();
@@ -27,33 +26,29 @@ $c_delete_visible_admin = ($active_user && ($active_user->getOptionsBitmask() &
27
26
$ c_user_name = ($ c_user ? filter_var ($ c_user ->getName (), FILTER_SANITIZE_FULL_SPECIAL_CHARS ) : 'Anonymous ' );
28
27
29
28
$ c_user_string = ($ c_user ? sprintf ('<a href="%s"><img class="rounded" src="%s"/> %s</a> ' , $ c_user_url , $ c_user_avatar , $ c_user_name ) : $ c_user_name );
29
+ $ c_time_string = sprintf ('<time class="small text-muted" datetime="%s">%s</time> ' , $ c_created_dt ->format ('c ' ), $ c_created_dt ->format ('D M j, Y g:ia T ' ));
30
30
31
31
$ c_edit_visible = ($ c_user_id == $ active_user_id || $ c_edit_visible_admin );
32
- $ c_delete_visible = ($ c_user_id == $ active_user_id || $ c_delete_visible_admin ); ?>
33
- <tr><td>
34
- <?= $ c_user_string?> <br/>
35
- <time datetime="<?= $ c_created_dt ->format ('c ' )?> "><?= $ c_created_dt ->format ('D M j, Y g:ia T ' )?> </time>
36
- </td><td>
37
- <? if ($ c_delete_visible ) { ?>
38
- <a class="btn btn-sm btn-danger float-right m-1" href="<?= Common::relativeUrlToAbsolute ('/comment/delete?id= ' . $ c_id )?> " title="Delete">❌</a>
39
- <? } if ($ c_edit_visible ) { ?>
40
- <a class="btn btn-sm btn-secondary float-right m-1" href="<?= Common::relativeUrlToAbsolute ('/comment/edit?id= ' . $ c_id )?> " title="Edit">📝</a>
41
- <? } ?>
42
- <?= $ c ->getContent (true )?>
43
- </td></tr>
44
- <? } ?>
45
- </tbody></table>
46
- <? } ?>
32
+ $ c_delete_visible = ($ c_user_id == $ active_user_id || $ c_delete_visible_admin );
33
+
34
+ $ c_content = (
35
+ ($ c_delete_visible ? '<a class="btn btn-sm btn-danger float-right m-1" href=" ' . Common::relativeUrlToAbsolute ('/comment/delete?id= ' . $ c_id ) . '" title="Delete">❌</a> ' : '' ) .
36
+ ($ c_edit_visible ? '<a class="btn btn-sm btn-secondary float-right m-1" href=" ' . Common::relativeUrlToAbsolute ('/comment/edit?id= ' . $ c_id ) . '" title="Edit">📝</a> ' : '' ) .
37
+ $ c ->getContent (true )
38
+ );
39
+
40
+ printf ('<div class="row bg-primary border border-dark mt-2 py-3 rounded"><div class="col-3">%s<br/>%s</div><div class="col-9">%s</div></div> ' , $ c_user_string , $ c_time_string , $ c_content );
41
+ }} ?>
47
42
</div>
48
43
</div>
49
44
<? if ($ active_user ) { ?>
50
45
<div class="row my-3 justify-content-center">
51
- <div class="col-8">
46
+ <div class="col-md- 8">
52
47
<form method="POST" action="<?= Common::relativeUrlToAbsolute ('/comment/create ' )?> ">
53
48
<input type="hidden" name="parent_type" value="<?= $ comment_parent_type?> "/>
54
49
<input type="hidden" name="parent_id" value="<?= $ comment_parent_id?> "/>
55
50
<div class="form-group">
56
- <span class="float-right text-muted small">(Markdown supported)</span>
51
+ <span class="float-right small">(Markdown supported)</span>
57
52
<label for="comment-content" class="font-weight-bold">Make a Comment:</label>
58
53
<textarea id="comment-content" class="border border-secondary form-control bg-dark text-light" name="content"></textarea>
59
54
</div>
0 commit comments