Display list of groups for each subscription
This commit is contained in:
parent
d3207cda53
commit
c01619d835
@ -127,7 +127,7 @@ Router\get_action('feeds', function () {
|
||||
$user_id = SessionStorage::getInstance()->getUserId();
|
||||
$nothing_to_read = Request\int_param('nothing_to_read');
|
||||
$nb_unread_items = Model\Item\count_by_status($user_id, 'unread');
|
||||
$feeds = Model\Feed\get_feeds_with_items_count($user_id);
|
||||
$feeds = Model\Feed\get_feeds_with_items_count_and_groups($user_id);
|
||||
|
||||
if ($nothing_to_read === 1 && $nb_unread_items > 0) {
|
||||
Response\redirect('?action=unread');
|
||||
@ -140,7 +140,7 @@ Router\get_action('feeds', function () {
|
||||
'nb_unread_items' => $nb_unread_items,
|
||||
'nb_failed_feeds' => Model\Feed\count_failed_feeds($user_id),
|
||||
'menu' => 'feeds',
|
||||
'title' => t('Subscriptions')
|
||||
'title' => t('Subscriptions'),
|
||||
)));
|
||||
});
|
||||
|
||||
|
@ -120,3 +120,9 @@ function relative_time($timestamp, $fallback_date_format = '%e %B %Y %k:%M')
|
||||
|
||||
return \dt($fallback_date_format, $timestamp);
|
||||
}
|
||||
|
||||
function link($label, $action, array $params = array())
|
||||
{
|
||||
$params['action'] = $action;
|
||||
return sprintf('<a href="?%s">%s</a>', http_build_query($params, '', '&'), escape($label));
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ function get_feeds($user_id)
|
||||
->findAll();
|
||||
}
|
||||
|
||||
function get_feeds_with_items_count($user_id)
|
||||
function get_feeds_with_items_count_and_groups($user_id)
|
||||
{
|
||||
$feeds_count = array();
|
||||
$feeds = get_feeds($user_id);
|
||||
@ -82,6 +82,7 @@ function get_feeds_with_items_count($user_id)
|
||||
foreach ($feeds as &$feed) {
|
||||
$feed['items_unread'] = isset($feeds_count[$feed['id']]) ? $feeds_count[$feed['id']]['unread'] : 0;
|
||||
$feed['items_total'] = isset($feeds_count[$feed['id']]) ? $feeds_count[$feed['id']]['total'] : 0;
|
||||
$feed['groups'] = Group\get_feed_groups($feed['id']);
|
||||
}
|
||||
|
||||
return $feeds;
|
||||
|
@ -51,6 +51,17 @@
|
||||
<?php echo t('An error occurred during the last check: "%s".', $feed['parsing_error_message']) ?>
|
||||
</span>
|
||||
</h2>
|
||||
|
||||
<?php if (! empty($feed['groups'])): ?>
|
||||
<ul class="feed-groups">
|
||||
<?php foreach ($feed['groups'] as $group): ?>
|
||||
<li>
|
||||
<?php echo Miniflux\Helper\link($group['title'], 'unread', array('group_id' => $group['id'])) ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
|
||||
<ul class="item-menu">
|
||||
<li>
|
||||
<a href="<?php echo $feed['site_url'] ?>" rel="noreferrer" target="_blank"><?php echo Miniflux\Helper\get_host_from_url($feed['site_url']) ?></a>
|
||||
|
@ -514,6 +514,29 @@ nav .active a {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.feed-groups li {
|
||||
display: inline;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.feed-groups li a:after {
|
||||
content: ', ';
|
||||
}
|
||||
|
||||
.feed-groups li:last-child a:after {
|
||||
content: '';
|
||||
}
|
||||
|
||||
.feed-groups a {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.items .feed-groups a:focus,
|
||||
.items .feed-groups a:hover {
|
||||
color: #777;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* items listing */
|
||||
.items article[data-feed-error] .feed-parsing-error {
|
||||
visibility: visible;
|
||||
|
2
assets/css/app.min.css
vendored
2
assets/css/app.min.css
vendored
File diff suppressed because one or more lines are too long
@ -104,7 +104,7 @@ class FeedModelTest extends BaseTest
|
||||
$feed->setSiteUrl('site url');
|
||||
$this->assertEquals(2, Model\Feed\create(1, $feed, 'etag', 'last modified'));
|
||||
|
||||
$feeds = Model\Feed\get_feeds_with_items_count(1);
|
||||
$feeds = Model\Feed\get_feeds_with_items_count_and_groups(1);
|
||||
$this->assertCount(2, $feeds);
|
||||
|
||||
$this->assertEquals(1, $feeds[0]['items_unread']);
|
||||
|
Loading…
Reference in New Issue
Block a user