"Show all" option on labels (#3472)

It uses the favorite option to keep a similar experience through out the application and also to limit the number of options.

See #3263
This commit is contained in:
Alexis Degrugillier
2021-02-26 17:31:01 -05:00
committed by GitHub
parent a127f7dae3
commit 449fee7a2c
22 changed files with 36 additions and 13 deletions

View File

@@ -292,9 +292,10 @@ class FreshRSS_Context {
self::$get_unread = $tag->nbUnread();
break;
case 'T':
$tagDAO = FreshRSS_Factory::createTagDao();
self::$current_get['tags'] = true;
self::$name = _t('index.menu.tags');
self::$get_unread = 0;
self::$get_unread = $tagDAO->countNotRead();
break;
default:
throw new FreshRSS_Context_Exception('Invalid getter: ' . $get);

View File

@@ -259,12 +259,19 @@ class FreshRSS_TagDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
return $res[0]['count'];
}
public function countNotRead($id) {
public function countNotRead($id = null) {
$sql = 'SELECT COUNT(*) AS count FROM `_entrytag` et '
. 'INNER JOIN `_entry` e ON et.id_entry=e.id '
. 'WHERE et.id_tag=? AND e.is_read=0';
. 'WHERE e.is_read=0';
$values = null;
if (null !== $id) {
$sql .= ' AND et.id_tag=?';
$values = [$id];
}
$stm = $this->pdo->prepare($sql);
$values = array($id);
$stm->execute($values);
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
return $res[0]['count'];

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Remember open categories', // TODO - Translation
'unread' => 'Zobrazit jen nepřečtené',
),
'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation
'sides_close_article' => 'Clicking outside of article text area closes the article', // TODO - Translation
'sort' => array(
'_' => 'Řazení',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Geöffnete Kategorien merken',
'unread' => 'Nur ungelesene zeigen',
),
'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation
'sides_close_article' => 'Klick außerhalb des Artikel-Textes schließt den Artikel',
'sort' => array(
'_' => 'Sortierreihenfolge',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Remember open categories',
'unread' => 'Show only unread',
),
'show_fav_unread_help' => 'Applies also on labels',
'sides_close_article' => 'Clicking outside of article text area closes the article',
'sort' => array(
'_' => 'Sort order',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Remember open categories',
'unread' => 'Show only unread',
),
'show_fav_unread_help' => 'Applies also on labels',
'sides_close_article' => 'Clicking outside of article text area closes the article',
'sort' => array(
'_' => 'Sort order',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Remember open categories', // TODO - Translation
'unread' => 'Mostrar solo pendientes',
),
'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation
'sides_close_article' => 'Pinchar fuera del área de texto del artículo lo cerrará',
'sort' => array(
'_' => 'Orden',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Se souvenir des catégories dépliées',
'unread' => 'Afficher les non lus',
),
'show_fav_unread_help' => 'Sapplique aussi aux étiquettes',
'sides_close_article' => 'Cliquer hors de la zone de texte ferme larticle',
'sort' => array(
'_' => 'Ordre de tri',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Remember open categories', // TODO - Translation
'unread' => 'הצגת מאמרים שלא נקראו בלבד',
),
'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation
'sides_close_article' => 'Clicking outside of article text area closes the article', // TODO - Translation
'sort' => array(
'_' => 'סדר המיון',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Remember open categories', // TODO - Translation
'unread' => 'Mostra solo non letti',
),
'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation
'sides_close_article' => 'Clicking outside of article text area closes the article', // TODO - Translation
'sort' => array(
'_' => 'Ordinamento',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Remember open categories', // TODO - Translation
'unread' => '읽지 않은 글만 표시',
),
'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation
'sides_close_article' => '글 영역 바깥을 클릭하면 글 접기',
'sort' => array(
'_' => '정렬 순서',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Open categorieën herinneren',
'unread' => 'Bekijk alleen ongelezen',
),
'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation
'sides_close_article' => 'Sluit het artikel door buiten de artikeltekst te klikken',
'sort' => array(
'_' => 'Sorteer volgorde',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Se remembrar de las categorias dobèrtas',
'unread' => 'Mostrar pas que los pas legits',
),
'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation
'sides_close_article' => 'Clicar fòra de la zòna de tèxte tampa larticle',
'sort' => array(
'_' => 'Òrdre de tria',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Remember open categories', // TODO - Translation
'unread' => 'Tylko nieprzeczytane',
),
'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation
'sides_close_article' => 'Kliknięcie poza zawartością wiadomości zamyka widok wiadomości',
'sort' => array(
'_' => 'Porządek sortowania',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Remember open categories', // TODO - Translation
'unread' => 'Exibir apenas não lido',
),
'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation
'sides_close_article' => 'Clicando fora da área do texto do artigo fecha o mesmo',
'sort' => array(
'_' => 'Ordem de visualização',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Remember open categories', // TODO - Translation
'unread' => 'Show only unread', // TODO - Translation
),
'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation
'sides_close_article' => 'Clicking outside of article text area closes the article', // TODO - Translation
'sort' => array(
'_' => 'Sort order', // TODO - Translation

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Remember open categories', // TODO - Translation
'unread' => 'Zobraziť iba neprečítané',
),
'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation
'sides_close_article' => 'Po kliknutí mimo textu článku sa článok zatvorí',
'sort' => array(
'_' => 'Poradie',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => 'Remember open categories', // TODO - Translation
'unread' => 'Sadece okunmamış makaleleri göster',
),
'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation
'sides_close_article' => 'Clicking outside of article text area closes the article', // TODO - Translation
'sort' => array(
'_' => 'Sıralama',

View File

@@ -138,6 +138,7 @@ return array(
'remember_categories' => '记住打开的分类',
'unread' => '只显示未读',
),
'show_fav_unread_help' => 'Applies also on labels', // TODO - Translation
'sides_close_article' => '点击文章区域外以关闭',
'sort' => array(
'_' => '排列顺序',

View File

@@ -6,6 +6,8 @@
!FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ)) {
$class = ' state_unread';
}
$state_filter = FreshRSS_Context::$user_conf->show_fav_unread ? '&state=3' : '';
?>
<div class="aside aside_feed<?= $class ?>" id="aside_feed">
@@ -31,14 +33,8 @@
<li class="tree-folder category favorites<?= FreshRSS_Context::isCurrentGet('s') ? ' active' : '' ?>">
<div class="tree-folder-title">
<?php
$url_starred = _url('index', $actual_view, 'get', 's');
if (FreshRSS_Context::$user_conf->show_fav_unread) {
$url_starred = $url_starred . '&state=3';
}
?>
<?= _i('bookmark') ?>
<a class="title" data-unread="<?= format_number(FreshRSS_Context::$total_starred['unread']) ?>" href="<?= $url_starred ?>">
<a class="title" data-unread="<?= format_number(FreshRSS_Context::$total_starred['unread']) ?>" href="<?= _url('index', $actual_view, 'get', 's') . $state_filter ?>">
<?= _t('index.menu.favorites', format_number(FreshRSS_Context::$total_starred['all'])) ?>
</a>
</div>
@@ -51,7 +47,7 @@
<li id="tags" class="tree-folder category tags<?= $t_active ? ' active' : '' ?>">
<div class="tree-folder-title">
<a class="dropdown-toggle" href="#"><?= _i($t_active ? 'up' : 'down') ?></a>
<a class="title" data-unread="<?= format_number($this->nbUnreadTags) ?>" href="<?= _url('index', $actual_view, 'get', 'T') ?>"><?= _t('index.menu.tags') ?></a>
<a class="title" data-unread="<?= format_number($this->nbUnreadTags) ?>" href="<?= _url('index', $actual_view, 'get', 'T') . $state_filter ?>"><?= _t('index.menu.tags') ?></a>
</div>
<ul class="tree-folder-items<?= $t_show ? ' active' : '' ?>">
<?php
@@ -63,7 +59,7 @@
<a class="dropdown-toggle"><?= _i('configure') ?></a>
<?php /* tag_config_template */ ?>
</div>
<?= FreshRSS_Themes::alt('label') ?> <a class="item-title" data-unread="<?= format_number($tag->nbUnread()) ?>" href="<?= _url('index', $actual_view, 'get', 't_' . $tag->id()) ?>"><?= $tag->name() ?></a>
<?= FreshRSS_Themes::alt('label') ?> <a class="item-title" data-unread="<?= format_number($tag->nbUnread()) ?>" href="<?= _url('index', $actual_view, 'get', 't_' . $tag->id()) . $state_filter ?>"><?= $tag->name() ?></a>
</li>
<?php endforeach; ?>
</ul>

View File

@@ -73,6 +73,7 @@
<label class="checkbox" for="show_fav_unread">
<input type="checkbox" name="show_fav_unread" id="show_fav_unread" value="1"<?= FreshRSS_Context::$user_conf->show_fav_unread ? ' checked="checked"' : '' ?> data-leave-validation="<?= FreshRSS_Context::$user_conf->show_fav_unread ?>"/>
<?= _t('conf.reading.always_show_favorites') ?>
<p class="help"><?= _i('help') ?> <?= _t('conf.reading.show_fav_unread_help') ?></p>
</label>
</div>
</div>

View File

@@ -244,6 +244,7 @@ return array(
'conf.reading.show.no_category',
'conf.reading.show.remember_categories',
'conf.reading.show.unread',
'conf.reading.show_fav_unread_help',
'conf.reading.sides_close_article',
'conf.reading.sort._',
'conf.reading.sort.newer_first',