mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-01-22 12:17:54 -05:00
* feature(normal) - Remember opened categories in the left menu
Session storage based implementation to remember opened categories in left menu
Issue Ref: #2248
* lib_phpQuery updates
* Updates covering feedback points and functionality fixes
* Feedback updates
* Revert "lib_phpQuery updates"
This reverts commit dcd23b9418.
* First review
Change variable name to "remember" instead of "open".
Start using localStorage instead of sessionStorage.
Simplify code.
* Simplify remember categories init function
Replace 'session' with 'local' in function names and comment
Set open categories CSS as same as when category is opened in 'active' unfold mode
* Remove URLSearchParams check in remember categories init function
* Delete open categories on login and logout
* JSHint check fix
* Second review
* Make new mode the default for new users
* Always open active category
* Reduce / simplify code
* i18n French
* Revert default value
Wait a bit more for this decision / change
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
148 lines
7.0 KiB
PHTML
148 lines
7.0 KiB
PHTML
<?php
|
|
$actual_view = Minz_Request::actionName();
|
|
$class = '';
|
|
if (FreshRSS_Context::$user_conf->hide_read_feeds &&
|
|
FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) &&
|
|
!FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ)) {
|
|
$class = ' state_unread';
|
|
}
|
|
?>
|
|
|
|
<div class="aside aside_feed<?= $class ?>" id="aside_feed">
|
|
<a class="toggle_aside" href="#close"><?= _i('close') ?></a>
|
|
|
|
<?php if (FreshRSS_Auth::hasAccess()) { ?>
|
|
<div class="stick configure-feeds">
|
|
<a id="btn-subscription" class="btn btn-important" href="<?= _url('subscription', 'index') ?>"><?= _t('index.menu.subscription') ?></a>
|
|
<a id="btn-add" class="btn btn-important" href="<?= _url('subscription', 'add') ?>"><?= _i('add-white') ?></a>
|
|
</div>
|
|
<?php } elseif (FreshRSS_Auth::accessNeedsLogin()) { ?>
|
|
<a href="<?= _url('index', 'about') ?>"><?= _t('index.menu.about') ?></a>
|
|
<?php } ?>
|
|
|
|
<form id="mark-read-aside" method="post">
|
|
<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
|
|
<ul id="sidebar" class="tree">
|
|
<li class="tree-folder category all<?= FreshRSS_Context::isCurrentGet('a') ? ' active' : '' ?>">
|
|
<div class="tree-folder-title">
|
|
<?= _i('all') ?> <a class="title" data-unread="<?= format_number(FreshRSS_Context::$total_unread) ?>" href="<?= _url('index', $actual_view) ?>"><?= _t('index.menu.main_stream') ?></a>
|
|
</div>
|
|
</li>
|
|
|
|
<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 ?>">
|
|
<?= _t('index.menu.favorites', format_number(FreshRSS_Context::$total_starred['all'])) ?>
|
|
</a>
|
|
</div>
|
|
</li>
|
|
|
|
<?php
|
|
$t_active = FreshRSS_Context::isCurrentGet('T');
|
|
$t_show = ($t_active && in_array(FreshRSS_Context::$user_conf->display_categories, [ 'active', 'remember' ])) || FreshRSS_Context::$user_conf->display_categories === 'all';
|
|
?>
|
|
<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>
|
|
</div>
|
|
<ul class="tree-folder-items<?= $t_show ? ' active' : '' ?>">
|
|
<?php
|
|
foreach ($this->tags as $tag):
|
|
?>
|
|
<li id="t_<?= $tag->id() ?>" class="item feed<?= FreshRSS_Context::isCurrentGet('t_' . $tag->id()) ? ' active' : '' ?>" data-unread="<?= $tag->nbUnread() ?>">
|
|
<div class="dropdown no-mobile">
|
|
<div class="dropdown-target"></div>
|
|
<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>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
</li>
|
|
|
|
<?php
|
|
foreach ($this->categories as $cat) {
|
|
$feeds = $cat->feeds();
|
|
$position = $cat->attributes('position');
|
|
if (!empty($feeds)) {
|
|
$c_active = FreshRSS_Context::isCurrentGet('c_' . $cat->id());
|
|
$c_show = ($c_active && in_array(FreshRSS_Context::$user_conf->display_categories, [ 'active', 'remember' ])) || FreshRSS_Context::$user_conf->display_categories === 'all';
|
|
?>
|
|
<li id="c_<?= $cat->id() ?>" class="tree-folder category<?= $c_active ? ' active' : '' ?>"<?= null === $position ? '' : "data-position='$position'" ?> data-unread="<?= $cat->nbNotRead() ?>">
|
|
<div class="tree-folder-title">
|
|
<a class="dropdown-toggle" href="#"><?= _i($c_show ? 'up' : 'down') ?></a>
|
|
<a class="title<?= $cat->hasFeedsWithError() ? ' error' : '' ?>" data-unread="<?= format_number($cat->nbNotRead()) ?>" href="<?= _url('index', $actual_view, 'get', 'c_' . $cat->id()) ?>"><?= $cat->name() ?></a>
|
|
</div>
|
|
|
|
<ul class="tree-folder-items<?= $c_show ? ' active' : '' ?>">
|
|
<?php
|
|
foreach ($feeds as $feed) {
|
|
$f_active = FreshRSS_Context::isCurrentGet('f_' . $feed->id());
|
|
?>
|
|
<li id="f_<?= $feed->id() ?>" class="item feed<?= $f_active ? ' active' : '', $feed->mute() ? ' mute' : '' ?><?= $feed->inError() ? ' error' : '' ?><?= $feed->nbEntries() <= 0 ? ' empty' : '' ?>" data-unread="<?= $feed->nbNotRead() ?>" data-priority="<?= $feed->priority() ?>">
|
|
<div class="dropdown no-mobile">
|
|
<div class="dropdown-target"></div>
|
|
<a class="dropdown-toggle" data-fweb="<?= $feed->website() ?>"><?= _i('configure') ?></a>
|
|
<?php /* feed_config_template */ ?>
|
|
</div>
|
|
<?php if (FreshRSS_Context::$user_conf->show_favicons): ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?>
|
|
<a class="item-title" data-unread="<?= format_number($feed->nbNotRead()) ?>" href="<?= _url('index', $actual_view, 'get', 'f_' . $feed->id()) ?>"><?= $feed->name() ?></a>
|
|
</li>
|
|
<?php } ?>
|
|
</ul>
|
|
</li>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
<li class="tree-bottom"></li>
|
|
</ul>
|
|
</form>
|
|
</div>
|
|
|
|
<div id="first_load" class="loading"></div>
|
|
<?php flush(); ?>
|
|
|
|
<script id="tag_config_template" type="text/html">
|
|
<ul class="dropdown-menu">
|
|
<li class="dropdown-close"><a href="#close">❌</a></li>
|
|
<li class="item">
|
|
<button class="as-link confirm" disabled="disabled"
|
|
form="mark-read-aside" formaction="<?= _url('tag', 'delete', 'id_tag', '------') ?>"
|
|
type="submit"><?= _t('gen.action.remove') ?></button>
|
|
</li>
|
|
</ul>
|
|
</script>
|
|
|
|
<script id="feed_config_template" type="text/html">
|
|
<ul class="dropdown-menu">
|
|
<li class="dropdown-close"><a href="#close">❌</a></li>
|
|
<li class="item"><a href="<?= _url('index', $actual_view, 'get', 'f_------') ?>"><?= _t('gen.action.filter') ?></a></li>
|
|
<?php if (FreshRSS_Auth::hasAccess()) { ?>
|
|
<li class="item"><a href="<?= _url('stats', 'repartition', 'id', '------') ?>"><?= _t('index.menu.stats') ?></a></li>
|
|
<?php } ?>
|
|
<li class="item"><a target="_blank" rel="noreferrer" href="http://example.net/"><?= _t('gen.action.see_website') ?></a></li>
|
|
<?php if (FreshRSS_Auth::hasAccess()) { ?>
|
|
<li class="separator"></li>
|
|
<li class="item"><a href="<?= _url('subscription', 'index', 'id', '------') ?>"><?= _t('gen.action.manage') ?></a></li>
|
|
<li class="item"><a href="<?= _url('feed', 'actualize', 'id', '------') ?>"><?= _t('gen.action.actualize') ?></a></li>
|
|
<li class="item">
|
|
<?php $confirm = FreshRSS_Context::$user_conf->reading_confirm ? 'confirm" disabled="disabled' : ''; ?>
|
|
<button class="read_all as-link <?= $confirm ?>"
|
|
form="mark-read-aside"
|
|
formaction="<?= _url('entry', 'read', 'get', 'f_------') ?>"
|
|
type="submit"><?= _t('gen.action.mark_read') ?></button>
|
|
</li>
|
|
<?php } ?>
|
|
</ul>
|
|
</script>
|