diff options
Diffstat (limited to 'src/web/_views/modal/new_post.php')
-rw-r--r-- | src/web/_views/modal/new_post.php | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/src/web/_views/modal/new_post.php b/src/web/_views/modal/new_post.php deleted file mode 100644 index 66e6561..0000000 --- a/src/web/_views/modal/new_post.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php /* Copyright (c) 2024 Freya Murphy */ ?> -<?php /* vi: syntax=php */ ?> -<?php - $user = $this->main->user(); -?> -<form id="new-post-form"> -<div class="modal-content new-post-modal"> - <div class="row"> - <?=pfp($user)?> - <div class="col ml"> - <strong><?=$user['first_name'] . ' ' . $user['last_name']?></strong> - <span class="subtext"><?=ucfirst(lang('now'))?></span> - </div> - </div> - <textarea - type="text" - name="content" - id="new-post-content" - placeholder="<?=ucfirst(lang('action_new_post_text', sub: [$user['first_name']]))?>" - ></textarea> -</div> -<div class="modal-footer"> - <?=ilang('action_submit', - id: 'new-post-submit', - class: 'btn btn-submit btn-alt grow', - attrs: array('type' => 'submit'), - button: TRUE - )?> -</div> -</form> -<script> - $('#new-post-form').submit(function(e) { - e.preventDefault(); - let content = $('#new-post-content').val(); - let me = $(this); - - const getPost = function(data) { - if (data) { - $('#post-container').prepend(data); - } - me.closest('.modal-container').remove(); - } - - const onPost = function(data) { - let id = data[0].id; - $.get({ - url: '/_util/post/post?id=' + id, - success: getPost - }); - } - - $.ajax({ - url: '/api/post', - method: 'POST', - data: JSON.stringify({ content }), - success: onPost - }); - }); -</script> |