diff options
author | Freya Murphy <freya@freyacat.org> | 2024-03-29 22:29:56 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-03-29 22:29:56 -0400 |
commit | 944b6b0526032ad8c1b4a2612d6723bec75e0e4c (patch) | |
tree | d3da5584df33a7878c087622b4fc2ec2883cf880 /web/views/template | |
download | xssbook2-944b6b0526032ad8c1b4a2612d6723bec75e0e4c.tar.gz xssbook2-944b6b0526032ad8c1b4a2612d6723bec75e0e4c.tar.bz2 xssbook2-944b6b0526032ad8c1b4a2612d6723bec75e0e4c.zip |
start database (user and post), and initial barebones home page
Diffstat (limited to 'web/views/template')
-rw-r--r-- | web/views/template/comment.php | 10 | ||||
-rw-r--r-- | web/views/template/modal.php | 12 | ||||
-rw-r--r-- | web/views/template/pfp.php | 6 | ||||
-rw-r--r-- | web/views/template/post.php | 58 |
4 files changed, 86 insertions, 0 deletions
diff --git a/web/views/template/comment.php b/web/views/template/comment.php new file mode 100644 index 0000000..ef7a081 --- /dev/null +++ b/web/views/template/comment.php @@ -0,0 +1,10 @@ +<div class="comment row mt"> + <?php $this->view('template/pfp', array('user' => $user))?> + <div class="ml col sub-card"> + <div class="row"> + <strong><?=$this->main->display_name($user)?></strong> + <span class="dim ml"><?=$this->main->display_date($comment['date'])?></span> + </div> + <?=$comment['content']?> + </div> +</div> diff --git a/web/views/template/modal.php b/web/views/template/modal.php new file mode 100644 index 0000000..4f47400 --- /dev/null +++ b/web/views/template/modal.php @@ -0,0 +1,12 @@ +<div class="modal-container"> + <div class="modal"> + <div class="modal-header row"> + <?=$title?> + <?=ilang( + 'action_modal_close', + class: 'float-right btn btn-action modal-close', + )?> + </div> + <?php $this->view('modal/' . $content) ?> + </div> +</div> diff --git a/web/views/template/pfp.php b/web/views/template/pfp.php new file mode 100644 index 0000000..842fc92 --- /dev/null +++ b/web/views/template/pfp.php @@ -0,0 +1,6 @@ +<?php + $class = isset($class) ? $class : ''; +?> +<a class="image-loading pfp <?=$class?>" href="/profile?id=<?=$user['id']?>"> + <img src="/api/rpc/avatar?user_id=<?=$user['id']?>" /> +</a> diff --git a/web/views/template/post.php b/web/views/template/post.php new file mode 100644 index 0000000..d9c7c92 --- /dev/null +++ b/web/views/template/post.php @@ -0,0 +1,58 @@ +<div class="post card"> + <div class="row"> + <?php $this->view('template/pfp', array('user' => $user))?> + <div class="col ml"> + <strong><?=$user['first_name'] . ' ' . $user['last_name']?></strong> + <span class="dim"><?=$post['date']?></span> + </div> + </div> + <p> + <?=$post['content']?> + </p> +<?php + $self = $this->main->user(); +?> +<?php if ($self): ?> + <hr> + <div class="row"> + <?=ilang('action_like', class: 'grow btn btn-hover btn-action')?> + <?=ilang('action_comment', class: 'grow btn btn-hover btn-action action-comment', + click: '$(\'#new-comment-' . $post['id'] . '\').focus()' + )?> + </div> + <hr> +<?php else: ?> + <hr> +<?php endif; ?> + <div class="col comments"> + <?php + $_GET['id'] = $post['id']; + $this->comments(); + ilang('action_load_comments', + class: 'action-load-comments btn btn-line mt', + attrs: array('postId' => $post['id']) + ); + ?> + </div> +<?php if ($self): ?> + <div class="row grow mt"> + <?php $this->view('template/pfp', array('user' => $user))?> + <form class="ml"> + <input + type="hidden" + name="id" + value="<?=$post['id']?>" + > + <input + id="new-comment-<?=$post['id']?>" + class="input" + autocomplete="off" + type="text" + name="text" + placeholder="<?=lang('action_new_comment_text')?>" + aria-label="<?=lang('action_new_comment_tip')?>" + > + </form> + </div> +<?php endif; ?> +</div> |