2024-03-30 16:14:42 +00:00
|
|
|
<?php /* Copyright (c) 2024 Freya Murphy */ ?>
|
|
|
|
<?php /* vi: syntax=php */ ?>
|
2024-03-30 02:29:56 +00:00
|
|
|
<?php
|
|
|
|
$user = $this->main->user();
|
|
|
|
?>
|
2024-03-30 16:14:42 +00:00
|
|
|
<form id="new-post-form">
|
2024-03-30 02:29:56 +00:00
|
|
|
<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"
|
2024-03-30 16:14:42 +00:00
|
|
|
name="content"
|
|
|
|
id="new-post-content"
|
2024-03-30 02:29:56 +00:00
|
|
|
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>
|
2024-03-30 16:14:42 +00:00
|
|
|
<script>
|
|
|
|
$('#new-post-form').submit(function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
let content = $('#new-post-content').val();
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
url: '/api/post',
|
|
|
|
method: 'POST',
|
|
|
|
data: JSON.stringify({ content }),
|
|
|
|
success: function(data) {
|
|
|
|
window.location.reload();
|
|
|
|
},
|
|
|
|
error: errorToast
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|