unify sub category sort

This commit is contained in:
xiaomlove
2023-04-21 00:50:10 +08:00
parent e5c91d40ce
commit 10cd69852c
6 changed files with 74 additions and 75 deletions
@@ -78,8 +78,8 @@ class CategoryResource extends Resource
, ,
Forms\Components\TextInput::make('sort_index') Forms\Components\TextInput::make('sort_index')
->default(0) ->default(0)
->label(__('label.search_box.taxonomy.sort_index')) ->label(__('label.priority'))
->helperText(__('label.search_box.taxonomy.sort_index_help')) ->helperText(__('label.priority_help'))
, ,
]); ]);
@@ -97,7 +97,7 @@ class CategoryResource extends Resource
Tables\Columns\TextColumn::make('class_name')->label(__('label.search_box.taxonomy.class_name')), Tables\Columns\TextColumn::make('class_name')->label(__('label.search_box.taxonomy.class_name')),
Tables\Columns\TextColumn::make('sort_index')->label(__('label.search_box.taxonomy.sort_index'))->sortable(), Tables\Columns\TextColumn::make('sort_index')->label(__('label.search_box.taxonomy.sort_index'))->sortable(),
]) ])
->defaultSort('sort_index', 'asc') ->defaultSort('sort_index', 'desc')
->filters([ ->filters([
Tables\Filters\SelectFilter::make('mode') Tables\Filters\SelectFilter::make('mode')
->options(SearchBox::query()->pluck('name', 'id')->toArray()) ->options(SearchBox::query()->pluck('name', 'id')->toArray())
@@ -32,8 +32,8 @@ class CodecResource extends Resource
Forms\Components\TextInput::make('name')->required()->label(__('label.search_box.taxonomy.name'))->required(), Forms\Components\TextInput::make('name')->required()->label(__('label.search_box.taxonomy.name'))->required(),
Forms\Components\TextInput::make('sort_index') Forms\Components\TextInput::make('sort_index')
->default(0) ->default(0)
->label(__('label.search_box.taxonomy.sort_index')) ->label(__('label.priority'))
->helperText(__('label.search_box.taxonomy.sort_index_help')) ->helperText(__('label.priority_help'))
, ,
Forms\Components\Select::make('mode') Forms\Components\Select::make('mode')
->options(SearchBox::query()->pluck('name', 'id')->toArray()) ->options(SearchBox::query()->pluck('name', 'id')->toArray())
@@ -55,7 +55,7 @@ class CodecResource extends Resource
Tables\Columns\TextColumn::make('name')->label(__('label.search_box.taxonomy.name'))->searchable(), Tables\Columns\TextColumn::make('name')->label(__('label.search_box.taxonomy.name'))->searchable(),
Tables\Columns\TextColumn::make('sort_index')->label(__('label.search_box.taxonomy.sort_index'))->sortable(), Tables\Columns\TextColumn::make('sort_index')->label(__('label.search_box.taxonomy.sort_index'))->sortable(),
]) ])
->defaultSort('sort_index', 'asc') ->defaultSort('sort_index', 'desc')
->filters([ ->filters([
Tables\Filters\SelectFilter::make('mode') Tables\Filters\SelectFilter::make('mode')
->options(SearchBox::query()->pluck('name', 'id')->toArray()) ->options(SearchBox::query()->pluck('name', 'id')->toArray())
+1 -1
View File
@@ -176,7 +176,7 @@ class SearchBoxRepository extends BaseRepository
$select .= sprintf('<option value="%s">%s</option>', 0, nexus_trans('nexus.select_one_please')); $select .= sprintf('<option value="%s">%s</option>', 0, nexus_trans('nexus.select_one_please'));
$list = NexusDB::table($table)->where(function (Builder $query) use ($searchBox) { $list = NexusDB::table($table)->where(function (Builder $query) use ($searchBox) {
return $query->where('mode', $searchBox->id)->orWhere('mode', 0); return $query->where('mode', $searchBox->id)->orWhere('mode', 0);
})->get(); })->orderBy('sort_index', 'desc')->get();
foreach ($list as $item) { foreach ($list as $item) {
$selected = ''; $selected = '';
if (isset($torrentInfo[$torrentField]) && $torrentInfo[$torrentField] == $item->id) { if (isset($torrentInfo[$torrentField]) && $torrentInfo[$torrentField] == $item->id) {
+18 -18
View File
@@ -752,7 +752,7 @@ e.g. [i]Command And Conquer Red Alert 3 Uprising-RELOADED[/i]
'title' => '管理组成员退休待遇', 'title' => '管理组成员退休待遇',
'text' => '满足以下条件可获得的退休待遇: 'text' => '满足以下条件可获得的退休待遇:
[code]
[b]对于 [color=#DC143C]上传员 (Uploaders)[/color]: [/b] [b]对于 [color=#DC143C]上传员 (Uploaders)[/color]: [/b]
成为 [color=#1cc6d5][b]养老族 (Retiree) [/b]: [/color] 成为 [color=#1cc6d5][b]养老族 (Retiree) [/b]: [/color]
@@ -763,9 +763,9 @@ e.g. [i]Command And Conquer Red Alert 3 Uprising-RELOADED[/i]
其他: 其他:
成为 [color=#F88C00][b]Extreme User[/b][/color] (如果你的条件满足 [color=#F88C00][b]Extreme User[/b][/color] 及以上, 则成为 [color=#38ACEC][b]Nexus Master[/b][/color]) . 成为 [color=#F88C00][b]Extreme User[/b][/color] (如果你的条件满足 [color=#F88C00][b]Extreme User[/b][/color] 及以上, 则成为 [color=#38ACEC][b]Nexus Master[/b][/color]) .
[/code]
[code]
[b]对于 [color=#6495ED]管理员 (Moderators)[/color]: [/b] [b]对于 [color=#6495ED]管理员 (Moderators)[/color]: [/b]
成为 [color=#1cc6d5][b]养老族 (Retiree)[/b]: [/color] 成为 [color=#1cc6d5][b]养老族 (Retiree)[/b]: [/color]
@@ -773,13 +773,13 @@ e.g. [i]Command And Conquer Red Alert 3 Uprising-RELOADED[/i]
成为 [color=#009F00][b]VIP[/b]: [/color] 成为 [color=#009F00][b]VIP[/b]: [/color]
若不满足成为 [color=#1cc6d5][b]养老族 (Retiree)[/b][/color] 的条件, 你可以[b]无条件[/b]成为 [color=#009F00][b]VIP[/b][/color] . 若不满足成为 [color=#1cc6d5][b]养老族 (Retiree)[/b][/color] 的条件, 你可以[b]无条件[/b]成为 [color=#009F00][b]VIP[/b][/color] .
[/code]
[code]
[b]对于 [color=#4b0082]总管理员 (Administrators)[/color] 及 以上等级: [/b] [b]对于 [color=#4b0082]总管理员 (Administrators)[/color] 及 以上等级: [/b]
可以[b]直接[/b]成为 [color=#1cc6d5][b]养老族 (Retiree)[/b][/color] . 可以[b]直接[/b]成为 [color=#1cc6d5][b]养老族 (Retiree)[/b][/color] .
[/code]', ',
), ),
25 => 25 =>
array ( array (
@@ -787,7 +787,7 @@ e.g. [i]Command And Conquer Red Alert 3 Uprising-RELOADED[/i]
'lang_id' => 28, 'lang_id' => 28,
'title' => '管理組成員退休待遇', 'title' => '管理組成員退休待遇',
'text' => '滿足以下條件可獲得的退休待遇: 'text' => '滿足以下條件可獲得的退休待遇:
[code]
[b]對於 [color=#DC143C]上傳員 (Uploaders)[/color]: [/b] [b]對於 [color=#DC143C]上傳員 (Uploaders)[/color]: [/b]
成為 [color=#1cc6d5][b]養老族 (Retiree) [/b]: [/color] 成為 [color=#1cc6d5][b]養老族 (Retiree) [/b]: [/color]
升職一年以上; 上傳過200個以上的種子資源 (特殊情況如原碟發佈, 0day更新等可以由管理組投票表決; 須被認定為作出過重大及持久的貢獻). 升職一年以上; 上傳過200個以上的種子資源 (特殊情況如原碟發佈, 0day更新等可以由管理組投票表決; 須被認定為作出過重大及持久的貢獻).
@@ -795,18 +795,18 @@ e.g. [i]Command And Conquer Red Alert 3 Uprising-RELOADED[/i]
升職6個月以上; 上傳過100個以上的種子資源 (特殊情況如原碟發佈, 0day更新等可以由管理組投票表決). 升職6個月以上; 上傳過100個以上的種子資源 (特殊情況如原碟發佈, 0day更新等可以由管理組投票表決).
其他: 其他:
成為 [color=#F88C00][b]Extreme User[/b][/color] (如果你的條件滿足 [color=#F88C00][b]Extreme User[/b][/color] 及以上, 則成為 [color=#38ACEC][b]Nexus Master[/b][/color]) . 成為 [color=#F88C00][b]Extreme User[/b][/color] (如果你的條件滿足 [color=#F88C00][b]Extreme User[/b][/color] 及以上, 則成為 [color=#38ACEC][b]Nexus Master[/b][/color]) .
[/code]
[code]
[b]對於 [color=#6495ED]管理員 (Moderators)[/color]: [/b] [b]對於 [color=#6495ED]管理員 (Moderators)[/color]: [/b]
成為 [color=#1cc6d5][b]養老族 (Retiree)[/b]: [/color] 成為 [color=#1cc6d5][b]養老族 (Retiree)[/b]: [/color]
升職一年以上; 參加過至少2次站務組正式會議; 參與過 規則/答疑 的修訂工作. 升職一年以上; 參加過至少2次站務組正式會議; 參與過 規則/答疑 的修訂工作.
成為 [color=#009F00][b]VIP[/b]: [/color] 成為 [color=#009F00][b]VIP[/b]: [/color]
若不滿足成為 [color=#1cc6d5][b]養老族 (Retiree)[/b][/color] 的條件, 你可以[b]無條件[/b]成為 [color=#009F00][b]VIP[/b][/color] . 若不滿足成為 [color=#1cc6d5][b]養老族 (Retiree)[/b][/color] 的條件, 你可以[b]無條件[/b]成為 [color=#009F00][b]VIP[/b][/color] .
[/code]
[code]
[b]對於 [color=#4b0082]總管理員 (Administrators)[/color] 及 以上等級: [/b] [b]對於 [color=#4b0082]總管理員 (Administrators)[/color] 及 以上等級: [/b]
可以[b]直接[/b]成為 [color=#1cc6d5][b]養老族 (Retiree)[/b][/color] . 可以[b]直接[/b]成為 [color=#1cc6d5][b]養老族 (Retiree)[/b][/color] .
[/code]', ',
), ),
26 => 26 =>
array ( array (
@@ -885,7 +885,7 @@ Please refer to [url=http://www.nexushd.org/forums.php?action=viewtopic&forumid=
'title' => 'Staff\'s retirement benefits', 'title' => 'Staff\'s retirement benefits',
'text' => 'You can get retirement benefits when meeting these condition(s) below: 'text' => 'You can get retirement benefits when meeting these condition(s) below:
[code]
[b]for [color=#DC143C]Uploaders[/color]: [/b] [b]for [color=#DC143C]Uploaders[/color]: [/b]
To join [color=#1cc6d5][b]Retiree[/b]: [/color] To join [color=#1cc6d5][b]Retiree[/b]: [/color]
@@ -896,9 +896,9 @@ Been promoted for more than 6 months; have posted 100 or more torrents (special
Others: Others:
Demoted to [color=#F88C00][b]Extreme User[/b][/color] (if your profile meets the corresponding condition of classes [color=#F88C00][b]Extreme User[/b][/color] and above, then promoted to [color=#38ACEC][b]Nexus Master[/b][/color]). Demoted to [color=#F88C00][b]Extreme User[/b][/color] (if your profile meets the corresponding condition of classes [color=#F88C00][b]Extreme User[/b][/color] and above, then promoted to [color=#38ACEC][b]Nexus Master[/b][/color]).
[/code]
[code]
[b]for [color=#6495ED]Moderators[/color]: [/b] [b]for [color=#6495ED]Moderators[/color]: [/b]
To join [color=#1cc6d5][b]Retiree[/b]: [/color] To join [color=#1cc6d5][b]Retiree[/b]: [/color]
@@ -906,13 +906,13 @@ Been promoted for more than 1 year; Have participated at least 2 Staff [b]Offici
To join [color=#009F00][b]VIP[/b]: [/color] To join [color=#009F00][b]VIP[/b]: [/color]
If you don\'t meet the condition of joining [color=#1cc6d5][b]Retiree[/b][/color], you can join [color=#009F00][b]VIP[/b][/color] [b]unconditionally[/b]. If you don\'t meet the condition of joining [color=#1cc6d5][b]Retiree[/b][/color], you can join [color=#009F00][b]VIP[/b][/color] [b]unconditionally[/b].
[/code]
[code]
[b]for [color=#4b0082]Administrators[/color] and above: [/b] [b]for [color=#4b0082]Administrators[/color] and above: [/b]
You can join [color=#1cc6d5][b]Retiree[/b][/color] [b]unconditionally[/b]. You can join [color=#1cc6d5][b]Retiree[/b][/color] [b]unconditionally[/b].
[/code]', ',
), ),
29 => 29 =>
array ( array (
+1 -1
View File
@@ -1,6 +1,6 @@
<?php <?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.1'); defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.1');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-04-20'); defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-04-21');
defined('IN_TRACKER') || define('IN_TRACKER', false); defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP"); defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org"); defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
+4 -5
View File
@@ -3282,10 +3282,10 @@ function genrelist($catmode = 1) {
global $Cache; global $Cache;
if (!$ret = $Cache->get_value('category_list_mode_'.$catmode)){ if (!$ret = $Cache->get_value('category_list_mode_'.$catmode)){
$ret = array(); $ret = array();
$res = sql_query("SELECT id, mode, name, image FROM categories WHERE mode = ".sqlesc($catmode)." ORDER BY sort_index, id"); $res = sql_query("SELECT id, mode, name, image FROM categories WHERE mode = ".sqlesc($catmode)." ORDER BY sort_index desc");
while ($row = mysql_fetch_array($res)) while ($row = mysql_fetch_array($res))
$ret[] = $row; $ret[] = $row;
$Cache->cache_value('category_list_mode_'.$catmode, $ret, 152800); $Cache->cache_value('category_list_mode_'.$catmode, $ret, 3600);
} }
return $ret; return $ret;
} }
@@ -6124,7 +6124,7 @@ function build_search_box_category_table($mode, $checkboxValue, $categoryHrefPre
//Category //Category
$html .= sprintf('<tr><td class="embedded" align="left">%s</td></tr>', nexus_trans('label.search_box.category')); $html .= sprintf('<tr><td class="embedded" align="left">%s</td></tr>', nexus_trans('label.search_box.category'));
/** @var \Illuminate\DataBase\Eloquent\Collection $categoryCollection */ /** @var \Illuminate\DataBase\Eloquent\Collection $categoryCollection */
$categoryCollection = $searchBox->categories; $categoryCollection = $searchBox->categories()->orderBy('sort_index', 'desc')->get();
if (!empty($options['select_unselect'])) { if (!empty($options['select_unselect'])) {
$categoryCollection->push(new \App\Models\Category(['mode' => -1])); $categoryCollection->push(new \App\Models\Category(['mode' => -1]));
} }
@@ -6189,8 +6189,7 @@ TD;
->where(function (\Illuminate\Database\Query\Builder $query) use ($mode) { ->where(function (\Illuminate\Database\Query\Builder $query) use ($mode) {
return $query->where('mode', $mode)->orWhere('mode', 0); return $query->where('mode', $mode)->orWhere('mode', 0);
}) })
->orderBy('sort_index', 'asc') ->orderBy('sort_index', 'desc')
->orderBy('id', 'asc')
->get() ->get()
; ;
$modelName = \App\Models\SearchBox::$taxonomies[$torrentField]['model']; $modelName = \App\Models\SearchBox::$taxonomies[$torrentField]['model'];