UX: Профиль

This commit is contained in:
Evg 2023-02-06 09:01:43 +03:00
parent fd908a6a98
commit 48308ebdd5
8 changed files with 40 additions and 18 deletions

View file

@ -30,10 +30,7 @@ class ProfileController extends Controller
$posts = FeedModel::feed($this->pageNumber, $this->limit, 'profile.posts', $profile['id']);
$pagesCount = FeedModel::feedCount('profile.posts', $profile['id']);
$amount = UserModel::contentCount($profile['id'], 'active');
if (($amount['count_answers'] + $amount['count_comments']) < 3) {
Request::getHead()->addMeta('robots', 'noindex');
}
$this->indexing($profile['id']);
return $this->render(
'/user/profile/index',
@ -58,6 +55,8 @@ class ProfileController extends Controller
$posts = FeedModel::feed($this->pageNumber, $this->limit, 'profile.posts', $profile['id']);
$pagesCount = FeedModel::feedCount('profile.posts', $profile['id']);
$this->indexing($profile['id']);
return $this->render(
'/user/profile/post',
[
@ -85,6 +84,8 @@ class ProfileController extends Controller
return ($b['comment_date'] ?? $b['answer_date']) <=> ($a['comment_date'] ?? $a['answer_date']);
});
$this->indexing($profile['id']);
return $this->render(
'/user/profile/comment',
[
@ -145,4 +146,13 @@ class ProfileController extends Controller
return true;
}
// Index profile or not
public function indexing($profile_id)
{
$amount = UserModel::contentCount($profile_id, 'active');
if (($amount['count_answers'] + $amount['count_comments']) < 3) {
Request::getHead()->addMeta('robots', 'noindex');
}
}
}

View file

@ -11,7 +11,7 @@
<a href="#" class="tag-grey">.tag-grey</a>
<a href="#" class="tag-violet">.tag-violet</a>
<a href="#" class="tag-yellow">.tag-yellow</a>
<a href="#" class="tag-clear">.tag-clear</a>
<h4 class="mt15"><?= __('admin.buttons'); ?>:</h4>
<p><i class="btn btn-outline-primary">btn btn-outline-primary</i></p>

File diff suppressed because one or more lines are too long

View file

@ -31,7 +31,7 @@ $facet_view_policy = $blog['facet_view_policy'] ?? null;
<div class="flex flex-row items-center">
<?php if (!empty($data['facets'])) : ?>
<?php foreach ($data['facets'] as $topic) : ?>
<a class="tag" href="<?= url('topic', ['slug' => $topic['facet_slug']]); ?>"><?= $topic['facet_title']; ?></a>
<a class="tag-clear" href="<?= url('topic', ['slug' => $topic['facet_slug']]); ?>"><?= $topic['facet_title']; ?></a>
<?php endforeach; ?>
<?php endif; ?>
</div>
@ -230,7 +230,7 @@ $facet_view_policy = $blog['facet_view_policy'] ?? null;
<?php endif; ?>
<?php if ($post['post_content_img']) : ?>
<div class="box bg-lightgray img-preview">
<div class="box border-lightgray img-preview">
<img class="w-100 br-rd5" src="<?= Img::PATH['posts_cover'] . $post['post_content_img']; ?>" alt="<?= $post['post_title']; ?>">
</div>
<?php endif; ?>

View file

@ -1,6 +1,9 @@
<div class="flex flex-col w-100">
<?= insert('/content/user/profile/header', ['data' => $data]); ?>
<div class="flex gap">
<aside>
<?= insert('/content/user/profile/sidebar', ['data' => $data]); ?>
</aside>
<main class="flex-auto">
<div class="mb15"><?= __('app.comments'); ?> <b><?= $data['profile']['login']; ?></b></div>
<?php if (!empty($data['comments'])) : ?>
@ -10,8 +13,5 @@
<?= insert('/_block/no-content', ['type' => 'small', 'text' => __('app.no_comments'), 'icon' => 'info']); ?>
<?php endif; ?>
</main>
<aside>
<?= insert('/content/user/profile/sidebar', ['data' => $data]); ?>
</aside>
</div>
</div>

View file

@ -1,6 +1,9 @@
<div class="flex flex-col w-100">
<?= insert('/content/user/profile/header', ['data' => $data]); ?>
<div class="flex gap">
<aside>
<?= insert('/content/user/profile/sidebar', ['data' => $data]); ?>
</aside>
<main class="flex-auto">
<?php if ($data['profile']['my_post'] != false && $data['my_post']['post_is_deleted'] != true) : ?>
<div class="box bg-violet">
@ -35,8 +38,5 @@
<?= Html::pagination($data['pNum'], $data['pagesCount'], false, '/@' . $data['profile']['login'] . '/posts'); ?>
</main>
<aside>
<?= insert('/content/user/profile/sidebar', ['data' => $data]); ?>
</aside>
</div>
</div>

View file

@ -1,6 +1,9 @@
<div class="flex flex-col w-100">
<?= insert('/content/user/profile/header', ['data' => $data]); ?>
<div class="flex gap">
<aside>
<?= insert('/content/user/profile/sidebar', ['data' => $data]); ?>
</aside>
<main class="flex-auto">
<div class="mb15"><?= __('app.posts'); ?> <b><?= $data['profile']['login']; ?></b></div>
@ -8,8 +11,5 @@
<?= Html::pagination($data['pNum'], $data['pagesCount'], false, '/@' . $data['profile']['login'] . '/posts'); ?>
</main>
<aside>
<?= insert('/content/user/profile/sidebar', ['data' => $data]); ?>
</aside>
</div>
</div>

View file

@ -7,7 +7,8 @@
.tag,
.tag-grey,
.tag-yellow,
.tag-violet {
.tag-violet,
.tag-clear {
font-size: 0.9rem;
border-radius: 3px;
margin-left: 0.25em;
@ -46,6 +47,17 @@
color: #544e4e;
}
.tag-clear {
color: #707476;
background-color: var(--white);
border: 1px solid #e8ebed;
}
.tag-clear:hover {
color: #707476;
background-color: #f5f7f8;
}
/* Этикетки */
.label {
font-style: italic;