add user pref on filters options

This commit is contained in:
Jean-Christian Denis 2021-09-29 01:01:25 +02:00
parent aadfd3bddb
commit fbda59abe3
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
4 changed files with 51 additions and 18 deletions

View file

@ -1,9 +1,10 @@
0.8.1 - dev
- [ ] update public templates
- [ ] fix javascript
- add user pref on sort filters (dc 2.20)
0.9 - 2021.09.11
- add user pref on cinecturlink list
- add user pref on table columns
- fix typo in admin menu
0.8 - 2021.09.09

View file

@ -2,7 +2,7 @@
[![Release version](https://img.shields.io/github/v/release/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/releases)
[![Release date](https://img.shields.io/github/release-date/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/releases)
[![Issue tracking](https://img.shields.io/github/issues/JcDenis/cinecturlink2)](https://github.com/JcDenis/pacKman/issues)
[![Issue tracking](https://img.shields.io/github/issues/JcDenis/cinecturlink2)](https://github.com/JcDenis/cinecturlink2/issues)
[![Dotclear version](https://img.shields.io/badge/dotclear-v2.19-blue.svg)](https://fr.dotclear.org/download)
[![License](https://img.shields.io/badge/license-GPL%20v2-blue.svg)](https://github.com/JcDenis/cinecturlink2/blob/master/LICENSE)

View file

@ -32,6 +32,11 @@ $core->addBehavior(
'adminColumnsLists',
['cinecturlink2AdminBehaviors', 'adminColumnsLists']
);
$core->addBehavior(
'adminSortsLists',
['cinecturlink2AdminBehaviors', 'adminSortsLists']
);
$core->addBehavior(
'adminDashboardFavorites',
['cinecturlink2AdminBehaviors', 'adminDashboardFavorites']
@ -42,17 +47,37 @@ class cinecturlink2AdminBehaviors
public static function adminColumnsLists($core, $cols)
{
$cols['c2link'] = [
__('Cinecturlink'), [
'date' => [true, __('Date')],
'cat' => [true, __('Category')],
__('Cinecturlink'),
[
'date' => [true, __('Date')],
'cat' => [true, __('Category')],
'author' => [true, __('Author')],
'desc' => [false, _('Category')],
'link' => [true, _('Liens')],
'note' => [true, __('Rating')],
'desc' => [false, __('Description')],
'link' => [true, __('Liens')],
'note' => [true, __('Rating')],
]
];
}
public static function adminSortsLists($core, $sorts)
{
$sorts['c2link'] = [
__('Cinecturlink'),
[
__('Date') => 'link_upddt',
__('Title') => 'link_title',
__('Category') => 'cat_id',
__('Author') => 'link_author',
__('Description') => 'link_desc',
__('Link') => 'link_url',
__('Rating') => 'link_note'
],
'link_upddt',
'desc',
null
];
}
public static function adminDashboardFavorites($core, $favs)
{
$favs->register('cinecturlink2', [

View file

@ -137,10 +137,13 @@ if ($part == 'updlinkscat') {
if ($part == 'links') {
$sortby_combo = [
__('Date') => 'link_upddt',
__('Title') => 'link_title',
__('Category') => 'cat_title',
__('Rating') => 'link_note',
__('Date') => 'link_upddt',
__('Title') => 'link_title',
__('Category') => 'cat_id',
__('Author') => 'link_author',
__('Description') => 'link_desc',
__('Liens') => 'link_url',
__('Rating') => 'link_note'
];
$order_combo = [
__('Descending') => 'desc',
@ -154,9 +157,13 @@ if ($part == 'links') {
$show_filters = false;
$page = !empty($_GET['page']) ? max(1, (integer) $_GET['page']) : 1;
$nb_per_page = $core->auth->user_prefs->interface->nb_posts_per_page ?: 30;
$default_sortby = 'link_upddt';
$default_order = 'desc';
$core->auth->user_prefs->addWorkspace('interface');
$sorts_user = @$core->auth->user_prefs->interface->sorts;
$default_sortby = $sorts_user['c2link'][0] ?? 'link_upddt';
$default_order = $sorts_user['c2link'][1] ?? 'desc';
$nb_per_page = !empty($sorts_user['c2link'][2]) ? $sorts_user['c2link'][2] : 30;
$sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : $default_sortby;
$order = !empty($_GET['order']) ? $_GET['order'] : $default_order;
@ -562,12 +569,12 @@ if ($part == "links") {
form::combo('order', $order_combo, $order) . '</p>' .
'</div><div class="cell">' .
'<p><span class="label ib">' . __('Show') . '</span> <label for="nb" class="classic">'.
form::field('nb', 3, 3, $nb_per_page) . ' ' .
form::field('nb', 0, 999, $nb_per_page) . ' ' .
__('entries per page') . '</label></p>' .
form::hidden('p', 'cinecturlink2') .
form::hidden('part', 'links') .
//form::hidden('filters-options-id', 'c2links') .
//'<p class="hidden-if-no-js"><a href="#" id="filter-options-save">' . __('Save current options') . '</a></p>' .
form::hidden('filters-options-id', 'c2link') .
'<p class="hidden-if-no-js"><a href="#" id="filter-options-save">' . __('Save current options') . '</a></p>' .
'</div>' .
'</div>' .