UX: Личные сообщения
+ FIX: Локализации reCAPTCHA
This commit is contained in:
parent
8cafd633ae
commit
4d92620d1c
|
@ -43,7 +43,7 @@ class LoginController extends Controller
|
|||
return $this->render(
|
||||
'/auth/login',
|
||||
[
|
||||
'meta' => Meta::get(__('app.sign_in'), __('app.login_info'), $m),
|
||||
'meta' => Meta::get(__('app.sign_in'), __('auth.login_info'), $m),
|
||||
'data' => [
|
||||
'sheet' => 'sign.in',
|
||||
'type' => 'login',
|
||||
|
|
|
@ -27,7 +27,7 @@ class RegisterController extends Controller
|
|||
return $this->render(
|
||||
'/auth/register',
|
||||
[
|
||||
'meta' => Meta::get(__('app.registration'), __('app.security_info'), $m),
|
||||
'meta' => Meta::get(__('app.registration'), __('help.security_info'), $m),
|
||||
'data' => [
|
||||
'sheet' => 'registration',
|
||||
'type' => 'register'
|
||||
|
|
|
@ -11,19 +11,26 @@ class MessagesController extends Controller
|
|||
{
|
||||
public function index()
|
||||
{
|
||||
if ($messages_dialog = MessagesModel::getMessages($this->user['id'])) {
|
||||
|
||||
foreach ($messages_dialog as $val) {
|
||||
$dialog_ids = $val['dialog_id'];
|
||||
}
|
||||
} else {
|
||||
$dialog_ids = null;
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'/messages/index',
|
||||
[
|
||||
'meta' => Meta::get(__('app.private_messages')),
|
||||
'data' => [
|
||||
'dialogs' => $this->dialogs(),
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// All dialogues
|
||||
// Все диалоги
|
||||
public function dialogs()
|
||||
{
|
||||
$result = [];
|
||||
$messages_dialog = MessagesModel::getMessages($this->user['id']);
|
||||
|
||||
if ($messages_dialog) {
|
||||
|
||||
$result = [];
|
||||
foreach ($messages_dialog as $ind => $row) {
|
||||
|
||||
// Принимающий AND $row['dialog_recipient_count']
|
||||
|
@ -46,16 +53,8 @@ class MessagesController extends Controller
|
|||
$result[$ind] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'/messages/messages',
|
||||
[
|
||||
'meta' => Meta::get(__('app.private_messages')),
|
||||
'data' => [
|
||||
'messages' => $result,
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function dialog()
|
||||
|
@ -109,7 +108,6 @@ class MessagesController extends Controller
|
|||
'sheet' => __('app.dialogue') . ' — <b>' . $list[$key]['login'] . '</b>',
|
||||
'list' => $list,
|
||||
'recipient_user' => $recipient_user,
|
||||
'dialog' => MessagesModel::lastBranches($this->user['id']),
|
||||
]
|
||||
]
|
||||
);
|
||||
|
|
|
@ -210,6 +210,7 @@ return [
|
|||
'no_favorites' => 'للاسف, لا يوجد مفضلات بعد',
|
||||
'no_comments' => 'للاسف, لايوجد تعلقيات بعد',
|
||||
'no_answers' => 'للاسف, لايوجد اجابات بعد',
|
||||
'choose_dialogue' => 'حدد حوار لعرضه',
|
||||
'default' => 'افتراضي',
|
||||
'qa' => 'الاسئلة و الاجوبة',
|
||||
'best_answer' => 'أفضل إجابة',
|
||||
|
|
|
@ -19,8 +19,6 @@ return [
|
|||
'notifications_info' => 'يمكنك تعليم كل الاشعارات كـ "مقروءة" من خلال النقر على الرابط: "مقروء"".',
|
||||
'notification_info' => 'يمكنك إلغاء الاشتراك من جميع اشعارات البريد الإلكتروني في هذا القسم.',
|
||||
|
||||
'messages_info' => 'رسائل خاصة مع أعضاء الموقع. امتنع عن البريد العشوائي ، كن ودوداً!',
|
||||
|
||||
'add_post' => 'استخدم اداة <b>قطع</b> (<svg class="icons"><use xlink:href="/assets/svg/icons.svg#cut"></use></svg>).<br><br> يختفي تحت جزء تصنيف من النص الذي يلي العلامة (سيتم كتابته "اقرأ المزيد").',
|
||||
'edit_page' => 'يجب أن تكون الوثائق الرسمية خالية من الأخطاء وأن تكون مكتوبة بطريقة رسمية.',
|
||||
'edit_post' => 'انظر كيف يبدو المنشور على صفحة الخلاصة وفي النسخة الكاملة. قم بتحسينه هنا.',
|
||||
|
|
|
@ -210,6 +210,7 @@ return [
|
|||
'no_favorites' => 'Sorry, there are no bookmarks yet',
|
||||
'no_comments' => 'Unfortunately, there are no comments yet',
|
||||
'no_answers' => 'Sorry, no answers yet',
|
||||
'choose_dialogue' => 'Select a dialogue to view',
|
||||
'default' => 'Default',
|
||||
'qa' => 'Questions and answers',
|
||||
'best_answer' => 'Best Answer',
|
||||
|
|
|
@ -19,8 +19,6 @@ return [
|
|||
'notifications_info' => 'You can mark all ads as read by clicking on the link: "I have read".',
|
||||
'notification_info' => 'You can unsubscribe from all email notifications in this section.',
|
||||
|
||||
'messages_info' => 'Private messages with site members. Refrain from spam, be respectful!',
|
||||
|
||||
'add_post' => 'Use the tag <b>cut</b> (<svg class="icons"><use xlink:href="/assets/svg/icons.svg#cut"></use></svg>).<br><br> It hides under the cat part of the text following the tag (it will be written "Read more").',
|
||||
'edit_page' => 'Official documentation should be error-free and written more in a formal manner.',
|
||||
'edit_post' => 'See what the post looks like on the feed page and in the full version. Improve it here.',
|
||||
|
|
|
@ -210,6 +210,7 @@ return [
|
|||
'no_favorites' => 'Ne pare rău, nu există încă marcaje',
|
||||
'no_comments' => 'Din păcate, încă nu există comentarii',
|
||||
'no_answers' => 'Ne pare rău, încă nu există răspunsuri',
|
||||
'choose_dialogue' => 'Selectați un dialog de vizualizat',
|
||||
'default' => 'Mod implicit',
|
||||
'qa' => 'Intrebari si raspunsuri',
|
||||
'best_answer' => 'Cel mai bun răspuns',
|
||||
|
|
|
@ -19,8 +19,6 @@ return [
|
|||
'notifications_info' => 'Puteți marca toate anunțurile ca citite făcând clic pe linkul: „Am citit”.',
|
||||
'notification_info' => 'Vă puteți dezabona de la toate notificările prin e-mail din această secțiune.',
|
||||
|
||||
'messages_info' => 'Mesaje private cu membrii site-ului. Ferește-te de spam, fii respectuos!',
|
||||
|
||||
'add_post' => 'Folosește eticheta <b>cut</b> (<svg class="icons"><use xlink:href="/assets/svg/icons.svg#cut"></use></svg>).<br><br> Se ascunde sub pisica partea de text care urmează etichetei (va fi scris „Citește mai mult”).',
|
||||
'edit_page' => 'Documentația oficială ar trebui să nu aibă erori și să fie scrisă mai mult într-o manieră formală.',
|
||||
'edit_post' => 'Vezi cum arată postarea pe pagina de feed și în versiunea completă. Îmbunătățiți-l aici.',
|
||||
|
|
|
@ -210,6 +210,7 @@ return [
|
|||
'no_favorites' => 'К сожалению, закладок пока нет',
|
||||
'no_comments' => 'К сожалению, комментариев пока нет',
|
||||
'no_answers' => 'К сожалению, ответов пока нет',
|
||||
'choose_dialogue' => 'Выберите диалог для просмотра',
|
||||
'default' => 'По умолчанию',
|
||||
'qa' => 'Вопросы и ответы',
|
||||
'best_answer' => 'Лучший ответ',
|
||||
|
|
|
@ -19,8 +19,6 @@ return [
|
|||
'notifications_info' => 'Вы можете пометить все объявления, как прочитанные, нажать на ссылку: «Я прочитал».',
|
||||
'notification_info' => 'Вы можете отписаться от всех уведомлений на E-mail в этом разделе.',
|
||||
|
||||
'messages_info' => 'Личные сообщения с участниками сайта. Воздерживайтесь от спама, проявляйте уважение!',
|
||||
|
||||
'add_post' => 'Используйте тэг <b>cut</b>: кнопка <svg class="icons"><use xlink:href="/assets/svg/icons.svg#cut"></use></svg> <br><br> Он скрывает под кат часть текста, следующую за тегом (будет написано «Читать дальше»).',
|
||||
'edit_page' => 'Официальная документация должна быть без ошибок и написана больше в официальной манере.',
|
||||
'edit_post' => 'Посмотрите, как выглядит пост на странице ленты и в полной версии. Улучшите его тут.',
|
||||
|
|
|
@ -210,6 +210,7 @@ return [
|
|||
'no_favorites' => 'На жаль, закладок поки немає',
|
||||
'no_comments' => 'На жаль, коментарів поки немає',
|
||||
'no_answers' => 'На жаль, відповідей поки немає',
|
||||
'choose_dialogue' => 'Виберіть діалог для перегляду',
|
||||
'default' => 'За замовчуванням',
|
||||
'qa' => 'Питання та відповіді',
|
||||
'best_answer' => 'Найкраща відповідь',
|
||||
|
|
|
@ -19,8 +19,6 @@ return [
|
|||
'notifications_info' => 'Ви можете позначити всі оголошення, як прочитані, натиснути на посилання: "Я прочитав".',
|
||||
'notification_info' => 'Ви можете відписатися від усіх повідомлень на електронну пошту в цьому розділі.',
|
||||
|
||||
'messages_info' => 'Особисті повідомлення із учасниками сайту. Утримуйтесь від спаму, виявляйте повагу!',
|
||||
|
||||
'add_post' => 'Використовуйте тег <b>cut</b>: кнопка<svg class="icons"><use xlink:href="/assets/svg/icons.svg#cut"></use></svg> <br><br> Він приховує під кат частину тексту, що йде за тегом (буде написано «Читати далі»).',
|
||||
'edit_page' => 'Офіційна документація має бути без помилок та написана більше в офіційній манері.',
|
||||
'edit_post' => 'Подивіться, як виглядає пост на сторінці стрічки та у повній версії. Поліпшіть його тут.',
|
||||
|
|
|
@ -210,6 +210,7 @@ return [
|
|||
'no_favorites' => '不幸的是,还没有书签',
|
||||
'no_comments' => '不幸的是,还没有评论',
|
||||
'no_answers' => '不幸的是,还没有回复',
|
||||
'choose_dialogue' => '选择要查看的对话',
|
||||
'default' => '默认',
|
||||
'qa' => '问答',
|
||||
'best_answer' => '最佳答案',
|
||||
|
|
|
@ -19,8 +19,6 @@ return [
|
|||
'notifications_info' => '您可以通过点击链接将所有广告标记为已读:“我已阅读”。',
|
||||
'notification_info' => '您可以在此部分取消订阅所有电子邮件通知。',
|
||||
|
||||
'messages_info' => '与网站成员的私人消息。拒绝垃圾邮件,尊重他人!',
|
||||
|
||||
'add_post' => '使用标签<b>cut</b> (<svg class="icons"><use xlink:href="/assets/svg/icons.svg#cut"></use></svg>).<br><br>它隐藏在标签后面的文本的 cat 部分下(它将被写成“阅读更多”)。',
|
||||
'edit_page' => '官方文档应该没有错误,并且以正式的方式编写。',
|
||||
'edit_post' => '在提要页面和完整版中查看帖子的外观。在这里改进它。',
|
||||
|
|
|
@ -211,6 +211,7 @@ return [
|
|||
'no_favorites' => '不幸的是,还没有书签',
|
||||
'no_comments' => '不幸的是,还没有评论',
|
||||
'no_answers' => '不幸的是,还没有答案',
|
||||
'choose_dialogue' => '选择要查看的对话',
|
||||
'default' => '默认情况下',
|
||||
'qa' => '问题及答案',
|
||||
'best_answer' => '最佳答案',
|
||||
|
|
|
@ -19,8 +19,6 @@ return [
|
|||
'notifications_info' => '您可以通過單擊鏈接將所有廣告標記為已讀:“我已閱讀”。',
|
||||
'notification_info' => '您可以在此部分取消訂閱所有電子郵件通知。',
|
||||
|
||||
'messages_info' => '與網站成員的私人消息。 拒絕垃圾郵件,尊重他人!',
|
||||
|
||||
'add_post' => '使用标签<b>cut</b> (<svg class="icons"><use xlink:href="/assets/svg/icons.svg#cut"></use></svg>).<br><br>它隐藏在标签后面的文本的 cat 部分下(它将被写成“阅读更多”)。',
|
||||
'edit_page' => '官方文檔應該沒有錯誤並且以正式的方式編寫。',
|
||||
'edit_post' => '在提要頁面和完整版中查看帖子的外觀。 在這裡改進一下。',
|
||||
|
|
|
@ -26,25 +26,6 @@ class MessagesModel extends \Hleb\Scheme\App\Models\MainModel
|
|||
return DB::run($sql)->fetchAll();
|
||||
}
|
||||
|
||||
public static function lastBranches($user_id)
|
||||
{
|
||||
$sql = "SELECT
|
||||
dialog_id,
|
||||
dialog_recipient_unread,
|
||||
dialog_add_time,
|
||||
dialog_sender_count,
|
||||
dialog_recipient_count,
|
||||
id,
|
||||
login,
|
||||
avatar
|
||||
FROM messages_dialog
|
||||
LEFT JOIN users ON dialog_sender_id = id OR dialog_recipient_id = id
|
||||
WHERE dialog_sender_id = $user_id OR dialog_recipient_id = $user_id
|
||||
ORDER BY dialog_update_time DESC LIMIT 15";
|
||||
|
||||
return DB::run($sql)->fetchAll();
|
||||
}
|
||||
|
||||
// We get a dialog by id
|
||||
public static function getDialogById($dialog_id)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php if (config('integration.captcha')) : ?>
|
||||
<div class="g-recaptcha mb15" data-theme="light" data-size="normal" data-callback="captcha_ready" data-sitekey="<?= config('integration.captcha_public_key'); ?>"></div>
|
||||
<script async defer src="https://www.google.com/recaptcha/api.js?hl=ru"></script>
|
||||
<script async defer src="https://www.google.com/recaptcha/api.js?hl=<?= Translate::getLang(); ?>"></script>
|
||||
<?php endif; ?>
|
|
@ -1,5 +1,6 @@
|
|||
<main>
|
||||
<p><?= $data['sheet']; ?> <a href="<?= url('messages'); ?>">(<?= __('app.all'); ?>)</a></p>
|
||||
<a class="gray" href="<?= url('messages'); ?>">< <?= __('app.all'); ?></a>
|
||||
<div class="gray-600"><?= $data['sheet']; ?></div>
|
||||
<div class="mb15 hidden">
|
||||
<form action="<?= url('content.create', ['type' => 'message']); ?>" method="post">
|
||||
<?= csrf_field() ?>
|
||||
|
@ -22,19 +23,12 @@
|
|||
$id = UserData::getUserId();
|
||||
endif;
|
||||
?>
|
||||
<div class="flex relative">
|
||||
<div id="user-card" data-content_id="<?= $key; ?>" data-user_id="<?= $id; ?>">
|
||||
<?= Img::avatar($ava, $login, 'img-base', 'max'); ?>
|
||||
<div id="content_<?= $key; ?>" class="content_<?= $key; ?>"></div>
|
||||
<div class="flex gap-min items-center">
|
||||
<?= Img::avatar($ava, $login, 'img-base', 'max'); ?>
|
||||
<a class="gray-600" href="<?= url('profile', ['login' => $login]); ?>"><?= $login; ?></a>
|
||||
<div class="gray-600 lowercase text-sm">
|
||||
<?= Html::langDate($val['message_add_time']); ?>
|
||||
</div>
|
||||
<a class="flex black" href="<?= url('profile', ['login' => $login]); ?>">
|
||||
<div class="ml5">
|
||||
<?= $login; ?>
|
||||
<div class="gray-600 lowercase text-sm">
|
||||
<?= Html::langDate($val['message_add_time']); ?>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="max-w780 ">
|
||||
<?= $val['message_content']; ?>
|
||||
|
@ -48,18 +42,4 @@
|
|||
<div class="br-bottom mb15"></div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
|
||||
<aside>
|
||||
<div class="box bg-beige">
|
||||
<h4 class="uppercase-box"><?= __('app.dialogues'); ?></h4>
|
||||
<?php foreach ($data['dialog'] as $key => $val) : ?>
|
||||
<?php if ($val['id'] != UserData::getUserId()) : ?>
|
||||
<div class="flex relative pt5 pb5 items-center hidden">
|
||||
<?= Img::avatar($val['avatar'], $val['login'], 'img-base mr5', 'max'); ?>
|
||||
<a href="<?= url('dialogues', ['id' => $val['dialog_id']]); ?>"><?= $val['login']; ?></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</aside>
|
||||
</main>
|
34
resources/views/default/content/messages/dialogue-column.php
Normal file
34
resources/views/default/content/messages/dialogue-column.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<h2 class="uppercase-box"><?= __('app.dialogues'); ?></h2>
|
||||
<?php if (!empty($dialogs)) : ?>
|
||||
<ul class="menu">
|
||||
<?php foreach ($dialogs as $msg) : ?>
|
||||
<li class="mb15 p5 <?php if (!$msg['unread'] > 0) : ?> bg-purple<?php endif; ?>">
|
||||
<a class="justify-between" href="<?= url('dialogues', ['id' => $msg['dialog_id']]); ?>">
|
||||
<div class="gray-600 text-sm">
|
||||
<?php if ($msg['dialog_sender_id'] == UserData::getUserId()) : ?>
|
||||
<?= Img::avatar($msg['msg_to_user']['avatar'], $msg['msg_to_user']['login'], 'img-base', 'small'); ?>
|
||||
<?= $msg['msg_to_user']['login']; ?> <span class="lowercase"><?= Html::langDate($msg['dialog_update_time']); ?></span>
|
||||
<?php else : ?>
|
||||
<?= Img::avatar($msg['msg_user']['avatar'], $msg['msg_user']['login'], 'img-base', 'small'); ?>
|
||||
<?= $msg['msg_user']['login']; ?> <span class="lowercase"><?= Html::langDate($msg['dialog_update_time']); ?></span>
|
||||
<?php endif; ?>
|
||||
<div class="gray"><?= fragment($msg['message']['message_content'], 38); ?>...</div>
|
||||
</div>
|
||||
|
||||
<div class="lowercase text-sm right gray-600">
|
||||
<?php if ($msg['unread']) : ?>
|
||||
<?= $msg['count']; ?> <?= $msg['unread_num']; ?>
|
||||
<?php else : ?>
|
||||
<span class="red"><?= __('app.view'); ?></span>
|
||||
<?php if ($msg['count'] != 0) : ?>
|
||||
<?= $msg['count']; ?> <?= $msg['count_num']; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else : ?>
|
||||
<?= insert('/_block/no-content', ['type' => 'max', 'text' => __('app.no_dialogs'), 'icon' => 'mail']); ?>
|
||||
<?php endif; ?>
|
8
resources/views/default/content/messages/index.php
Normal file
8
resources/views/default/content/messages/index.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<div class="w-40 mb-w-100">
|
||||
<?= insert('/content/messages/dialogue-column', ['dialogs' => $data['dialogs']]); ?>
|
||||
</div>
|
||||
<div class="w-60 mb-none">
|
||||
<div class="box bg-beige sticky top-sm">
|
||||
<?= insert('/_block/no-content', ['type' => 'max', 'text' => __('app.choose_dialogue'), 'icon' => 'mail']); ?>
|
||||
</div>
|
||||
</div>
|
|
@ -1,45 +0,0 @@
|
|||
<main>
|
||||
<h2 class="m0 mb20"><?= __('app.private_messages'); ?></h2>
|
||||
<?php if (!empty($data['messages'])) : ?>
|
||||
<?php foreach ($data['messages'] as $msg) : ?>
|
||||
<div class="hidden mb15<?php if (!$msg['unread'] > 0) : ?> bg-purple<?php endif; ?>">
|
||||
<div class="text-sm flex gray-600">
|
||||
<?php if ($msg['dialog_sender_id'] == UserData::getUserId()) : ?>
|
||||
<a class="black mr5" href="<?= url('profile', ['login' => $msg['msg_to_user']['login']]); ?>">
|
||||
<?= Img::avatar($msg['msg_to_user']['avatar'], $msg['msg_to_user']['login'], 'img-sm', 'small'); ?>
|
||||
<?= $msg['msg_to_user']['login']; ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<a class="black mr5" href="<?= url('profile', ['login' => $msg['msg_user']['login']]); ?>">
|
||||
<?= Img::avatar($msg['msg_user']['avatar'], $msg['msg_user']['login'], 'img-sm', 'small'); ?>
|
||||
<?= $msg['msg_user']['login']; ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<span class="lowercase">
|
||||
<?= Html::langDate($msg['dialog_update_time']); ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="p15 br-rd5 mt5 relative bg-blue-100<?php if (!$msg['unread'] > 0) { ?> bg-purple<?php } ?> gray">
|
||||
<?= markdown($msg['message']['message_content'], 'text'); ?>
|
||||
</div>
|
||||
<a class="lowercase text-sm right" href="<?= url('dialogues', ['id' => $msg['dialog_id']]); ?>">
|
||||
<?php if ($msg['unread']) : ?>
|
||||
<?= __('app.there_are'); ?> <?= $msg['count']; ?> <?= $msg['unread_num']; ?>
|
||||
<?php else : ?>
|
||||
<span class="red"><?= __('app.view'); ?></span>
|
||||
<?php if ($msg['count'] != 0) : ?>
|
||||
<?= $msg['count']; ?> <?= $msg['count_num']; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<?= insert('/_block/no-content', ['type' => 'max', 'text' => __('app.no_dialogs'), 'icon' => 'mail']); ?>
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
<aside>
|
||||
<div class="box bg-beige sticky top-sm">
|
||||
<?= __('help.messages_info'); ?>
|
||||
</div>
|
||||
</aside>
|
Loading…
Reference in a new issue