diff options
Diffstat (limited to 'web/views')
-rw-r--r-- | web/views/footer.php | 2 | ||||
-rw-r--r-- | web/views/header.php | 74 | ||||
-rw-r--r-- | web/views/modal/new-post.php | 28 | ||||
-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 |
7 files changed, 190 insertions, 0 deletions
diff --git a/web/views/footer.php b/web/views/footer.php new file mode 100644 index 0000000..6cbe21b --- /dev/null +++ b/web/views/footer.php @@ -0,0 +1,2 @@ + <body> +</html> diff --git a/web/views/header.php b/web/views/header.php new file mode 100644 index 0000000..183f4f4 --- /dev/null +++ b/web/views/header.php @@ -0,0 +1,74 @@ +<?php // vi: syntax=php ?> +<?php + $self = $this->main->user(); +?> +<!DOCTYPE html> +<html> + <head> + <?php + foreach ($js_files as $js) { + echo $this->main->link_js($js); + } + foreach ($css_files as $css) { + echo $this->main->link_css($css); + } + ?> + <title><?=$title?></title> + </head> + <body> + <header class="nav"> + <div class="nav-left"> + <span class="logo">xssbook</span> + </div> + <div class="nav-center" :class="{hidden: !visible}"> + <a + id="action-home" + class="header-entry btn btn-hover btn-action btn-blue" + href="/home" + title="<?=lang('action_home_tip')?>" + > + <i class="mi mi-lg">home</i> + <span><?=lang('action_home_text')?></span> + </a> + <a + id="action-people" + class="header-entry btn btn-hover btn-action btn-blue" + href="/people" + title="<?=lang('action_people_tip')?>" + > + <i class="mi mi-lg">people</i> + <span><?=lang('action_people_text')?></span> + </a> + <a + id="action-chat" + class="header-entry btn btn-hover btn-action btn-blue" + href="/chat" + title="<?=lang('action_chat_tip')?>" + > + <i class="mi mi-lg">chat</i> + <span><?=lang('action_chat_text')?></span> + </a> + </div> + <div class="nav-right"> + <button + id="action-hamburger" + title="<?=lang('action_hamburger_tip')?>" + > + <i class="mi mi-lg">menu</i> + </button> + <?php if($self): ?> + <?php $this->view('template/pfp', array( + 'user' => $self, + 'class' => 'pfp-sm ml', + )); ?> + <?php else: ?> + <?=ilang('action_login', class: 'btn btn-action', href: '/auth/login')?> + <?php endif; ?> + </div> + <script> + $('#action-hamburger').on('click', function() { + let menu = $('.nav-center'); + menu.toggleClass('visible'); + }); + </script> + </header> diff --git a/web/views/modal/new-post.php b/web/views/modal/new-post.php new file mode 100644 index 0000000..7215862 --- /dev/null +++ b/web/views/modal/new-post.php @@ -0,0 +1,28 @@ +<?php + $user = $this->main->user(); +?> +<form> +<div class="modal-content new-post-modal"> + <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"><?=lang('now')?></span> + </div> + </div> + <textarea + type="text" + name="text" + id="text" + placeholder="<?=lang('action_new_post_text', sub: [$user['first_name']])?>" + ></textarea> +</div> +<div class="modal-footer"> + <?=ilang('action_submit', + id: 'new-post-submit', + class: 'btn-action', + attrs: array('type' => 'submit'), + button: TRUE + )?> +</div> +</form> 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> |