ADD: Sorting in the catalog

This commit is contained in:
Evg 2022-01-26 18:04:29 +03:00
parent a5f5e88bf5
commit bb441a733c
17 changed files with 45 additions and 35 deletions

View file

@ -264,7 +264,7 @@ function tabs_nav($name, $item, $user, array $pages = [])
foreach ($pages as $key => $page) {
$tl = $page['tl'] ?? null;
if (!empty($page['hr'])) {
if ($user['id'] > 0) $html .= '<li><hr></li>';
if ($user['id'] > 0) $html .= '<li><hr class="w-90"></li>';
} else {
if ($user['trust_level'] >= $tl) {
$classes = 'sky-500-hover dark-gray-200';

View file

@ -49,6 +49,7 @@ class Home
'user' => $this->user,
'data' => [
'pagesCount' => ceil($pagesCount / $this->limit),
'count' => $pagesCount,
'pNum' => $page,
'items' => $result,
'type' => $type,

View file

@ -2,11 +2,13 @@
$data = [
'site.directory' => 'Website-Verzeichnis',
'categories' => 'Kategorien',
'soft' => 'Sanft',
'status' => 'Verbindungsstatus',
'there.program' => 'Es gibt ein Programm',
'hosted.github' => 'Es wird auf GitHub gehostet',
'url.address.github' => 'GitHub-Repository-URL',
'by.date' => 'Nach Datum',
];
return $data;

View file

@ -2,11 +2,13 @@
$data = [
'site.directory' => 'Website directory',
'categories' => 'Categories',
'soft' => 'Soft',
'status' => 'Link Status',
'there.program' => 'There is a program',
'hosted.github' => 'It is hosted on GitHub',
'url.address.github' => 'GitHub repository URL',
'by.date' => 'By date',
];
return $data;

View file

@ -2,11 +2,13 @@
$data = [
'site.directory' => 'Annuaire de sites Web',
'categories' => 'Catégories',
'soft' => 'Mou, tendre',
'status' => 'Statut du lien',
'there.program' => 'Il y a un programme',
'hosted.github' => 'Il est hébergé sur GitHub',
'url.address.github' => 'URL du référentiel GitHub',
'by.date' => 'Par date',
];
return $data;

View file

@ -2,11 +2,13 @@
$data = [
'site.directory' => 'Director de site-uri',
'categories' => 'Categorii',
'soft' => 'Moale',
'status' => 'Stare link',
'there.program' => 'Există un program',
'hosted.github' => 'Este găzduit pe GitHub',
'url.address.github' => 'Adresa URL a depozitului GitHub',
'by.date' => 'După dată',
];
return $data;

View file

@ -2,11 +2,13 @@
$data = [
'site.directory' => 'Каталог сайтов',
'categories' => 'Рубрики',
'soft' => 'Софт',
'status' => 'Статус ссылки',
'there.program' => 'Есть программа',
'hosted.github' => 'Она размещена на GitHub',
'url.address.github' => 'URL адрес репозитория на GitHub',
'by.date' => 'По дате',
];
return $data;

View file

@ -2,11 +2,13 @@
$data = [
'site.directory' => '網站目錄',
'categories' => '類別',
'soft' => '柔軟的',
'status' => '鏈接狀態',
'there.program' => '有一個程序',
'hosted.github' => '它託管在 GitHub 上',
'url.address.github' => 'GitHub 存儲庫 URL',
'by.date' => '按日期',
];
return $data;

View file

@ -44,7 +44,7 @@ class WebModel extends \Hleb\Scheme\App\Models\MainModel
LEFT JOIN votes_item ON votes_item_item_id = item_id AND votes_item_user_id = :uid
$sort
ORDER BY item_id DESC LIMIT $start, $limit ";
LIMIT $start, $limit ";
return DB::run($sql, ['uid' => $user['id']])->fetchAll();
}
@ -61,10 +61,13 @@ class WebModel extends \Hleb\Scheme\App\Models\MainModel
{
switch ($sheet) {
case 'web.all':
$sort = "WHERE item_is_deleted = 0";
$sort = "WHERE item_is_deleted = 0 ORDER BY item_id DESC";
break;
case 'web.top':
$sort = "WHERE item_is_deleted = 0 ORDER BY item_votes DESC";
break;
case 'web.deleted':
$sort = "WHERE item_is_deleted = 1";
$sort = "WHERE item_is_deleted = 1 ORDER BY item_id DESC";
break;
}

View file

@ -9,7 +9,7 @@
<i class="bi bi-plus-lg middle"></i>
</a>
<?php } ?>
<h1 class="mt0 mb10 text-2xl font-normal"><?= Translate::get('site.directory'); ?></h1>
<h1 class="mt0 mb10 text-2xl font-normal"><?= Translate::get('categories'); ?></h1>
</div>
<div class="flex mb20 pt10 pr15 pb10 pl15 bg-yellow-50 flex-auto">
<?php foreach (Config::get('web-root-categories') as $cat) { ?>
@ -30,6 +30,20 @@
</div>
<?php } ?>
</div>
<div class="ml15 flex justify-between flex-row items-center max-w780">
<div>
<?= num_word($data['count'], Translate::get('num-website'), false); ?>:
<?= $data['count']; ?>
</div>
<div>
<a class="<?php if ( $data['sheet'] == 'web.all') { ?>bg-gray-100 p5 gray-600 <?php } ?>mr20" href="<?= getUrlByName('web'); ?>">
<?= Translate::get('by.date'); ?>
</a>
<a class="<?php if ( $data['sheet'] == 'web.top') { ?>bg-gray-100 p5 gray-600 <?php } ?>" href="<?= getUrlByName('web.top'); ?>">
TOP
</a>
</div>
</div>
<div class="pt5 mr15 pb5 ml15">
<?php if (!empty($data['items'])) { ?>
<?= includeTemplate('/view/default/site', ['data' => $data, 'user' => $user]); ?>
@ -38,7 +52,7 @@
<?php } ?>
</div>
<div class="pl10">
<?= pagination($data['pNum'], $data['pagesCount'], $data['sheet'], getUrlByName('web')); ?>
<?= pagination($data['pNum'], $data['pagesCount'], $data['sheet'], getUrlByName($data['sheet'])); ?>
</div>
</main>
</div>

View file

@ -10,12 +10,12 @@
<?= $item['item_title_url']; ?>
</h2>
</a>
<div class="mt5 mb15 max-w780">
<div class="mt5 mb15 max-w640">
<?= $item['item_content_url']; ?>
</div>
<div class="flex flex-row gap-2 items-center max-w780">
<?= website_img($item['item_url_domain'], 'favicon', $item['item_url_domain'], 'mr5 w20 h20'); ?>
<div class="flex justify-between flex-row gap-2 items-center max-w640">
<div class="green-600 text-sm">
<?= website_img($item['item_url_domain'], 'favicon', $item['item_url_domain'], 'mr5 w20 h20'); ?>
<?= $item['item_url_domain']; ?>
<?php if ($item['item_github_url']) { ?>
<a class="ml15 gray-600" target="_blank" rel="nofollow noreferrer ugc" href="<?= $item['item_github_url']; ?>">

View file

@ -104,7 +104,7 @@
</div>
</main>
</div>
<div class="bg-white p15 mb-none br-box-gray">
<div class="bg-white p15 mb-none">
<?= $data['topic']['facet_description']; ?>
</div>
</div>

File diff suppressed because one or more lines are too long

View file

@ -12,7 +12,7 @@
<ol class="p0 m0 list-none">
<li class="answers_subtree" id="answer_<?= $answer['answer_id']; ?>">
<div class="answ-telo hidden">
<div class="br-box-gray w130 br-rd3 right mt10 pt10 ml10 pb10 hidden center">
<div class="br-box-gray w110 br-rd3 right mt10 pt10 ml10 pb10 hidden center">
<?= user_avatar_img($answer['avatar'], 'max', $answer['login'], 'br-rd-50 w60 h60'); ?>
<div class="text-sm gray-600">
<?= lang_date($answer['answer_date']); ?>

View file

@ -55,8 +55,6 @@ img {
.bottom5 { bottom: $px-five; }
.left0 { left: $px-zero; }
.mr-auto { margin: 0 auto; }
.ml-auto { margin-left: auto; }
.-mr-1 { margin-right: -0.5rem; }
.-mt20 { margin-top: -20px; }
.-mt50 { margin-top: -50px; }
@ -160,40 +158,21 @@ img {
.bg-black { background-color: $black; }
.bg-white { background-color: $white; }
.bg-green-600 { background-color: $green-600; }
.bg-green-700 { background-color: $green-700; }
.bg-gray-100 { background-color: $gray-100; }
.bg-gray-500 { background-color: $gray-500; }
.bg-gray-700 { background-color: $gray-700; }
.bg-zinc-800 { background-color: $zinc-800; }
.bg-yellow-50 { background-color: $yellow-50; }
.bg-yellow-100 { background-color: $yellow-100; }
.bg-yellow-500 { background-color: $yellow-500; }
.bg-purple-100 { background-color: $purple-100; }
.bg-indigo-300 { background-color: $indigo-300; }
.bg-orange-500 { background-color: $orange-500; }
.bg-blue-100 { background-color: $blue-100; }
.bg-blue-400 { background-color: $blue-400; }
.bg-blue-500 { background-color: $blue-500; }
.bg-sky-50 { background-color: $sky-50; }
.bg-red-200 { background-color: $red-200; }
.bg-red-300 { background-color: $red-300; }
.bg-red-500 { background-color: $red-500; }
.bg-pink-800 { background-color: $pink-800; }
.bg-orange-800 { background-color: $orange-800; }
.bg-blue-steel-700 { background-color: $blue-steel-700; }
.bg-hover-green:hover { background-color: #5fb878; }
@ -238,7 +217,6 @@ img {
.w60 { width: 60px; }
.w94 { width: 94px; }
.w110 { width: 110px; }
.w130 { width: 130px; }
.w160 { width: 160px; }
.w200 { width: 200px; }
.w400 { width: 400px; }

View file

@ -12,7 +12,7 @@
<ol class="p0 m0 list-none">
<li class="answers_subtree" id="answer_<?= $answer['answer_id']; ?>">
<div class="answ-telo hidden">
<div class="br-box-gray w130 br-rd3 right mt10 pt10 ml10 pb10 hidden center">
<div class="br-box-gray w110 br-rd3 right mt10 pt10 ml10 pb10 hidden center">
<?= user_avatar_img($answer['avatar'], 'max', $answer['login'], 'br-rd-50 w60 h60'); ?>
<div class="text-sm gray-600">
<?= lang_date($answer['answer_date']); ?>

View file

@ -172,6 +172,8 @@ Route::get('/domain/{domain}/page/{page?}')->controller('Post\PostController@dom
Route::get('/web')->module('catalog', 'App\Home', ['web.all', 'web'])->name('web');
Route::get('/web/page/{page?}')->module('catalog', 'App\Home', ['web.all', 'web'])->where(['page' => '[0-9]+']);
Route::get('/web/top')->module('catalog', 'App\Home', ['web.top', 'web'])->name('web.top');
Route::get('/web/top/page/{page?}')->module('catalog', 'App\Home', ['web.top', 'web'])->where(['page' => '[0-9]+']);
Route::get('/web/{slug}')->module('catalog', 'App\Catalog@sites', ['all'])->where(['slug' => '[A-Za-z0-9-]+'])->name('web.topic');
Route::get('/web/{slug}/new')->module('catalog', 'App\Catalog@sites', ['new'])->where(['slug' => '[A-Za-z0-9-]+'])->name('web.topic.new');