Add a page to display all items by subscription
This commit is contained in:
parent
bb7c2f0e31
commit
e2121cc72d
20
index.php
20
index.php
@ -231,6 +231,26 @@ Router\get_action('history', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Display feed items page
|
||||||
|
Router\get_action('feed-items', function() {
|
||||||
|
|
||||||
|
$feed_id = Request\int_param('feed_id', 0);
|
||||||
|
$offset = Request\int_param('offset', 0);
|
||||||
|
$nb_items = Model\count_feed_items($feed_id);
|
||||||
|
$feed = Model\get_feed($feed_id);
|
||||||
|
|
||||||
|
Response\html(Template\layout('feed_items', array(
|
||||||
|
'feed' => $feed,
|
||||||
|
'items' => Model\get_feed_items($feed_id, $offset, Model\get_config_value('items_per_page')),
|
||||||
|
'nb_items' => $nb_items,
|
||||||
|
'offset' => $offset,
|
||||||
|
'items_per_page' => Model\get_config_value('items_per_page'),
|
||||||
|
'menu' => 'feeds',
|
||||||
|
'title' => '('.$nb_items.') '.$feed['title']
|
||||||
|
)));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Display bookmarks page
|
// Display bookmarks page
|
||||||
Router\get_action('bookmarks', function() {
|
Router\get_action('bookmarks', function() {
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
'No item' => 'Aucun élément',
|
||||||
|
'items' => 'éléments',
|
||||||
'The following feeds are empty, there is maybe an error: %s' =>
|
'The following feeds are empty, there is maybe an error: %s' =>
|
||||||
'Les abonnements suivants sont vides, il y a peut-être une erreur : %s',
|
'Les abonnements suivants sont vides, il y a peut-être une erreur : %s',
|
||||||
'Items per page' => 'Nombre d\'éléments par page',
|
'Items per page' => 'Nombre d\'éléments par page',
|
||||||
|
25
model.php
25
model.php
@ -362,6 +362,31 @@ function get_bookmarks($offset = null, $limit = null)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function count_feed_items($feed_id)
|
||||||
|
{
|
||||||
|
return \PicoTools\singleton('db')
|
||||||
|
->table('items')
|
||||||
|
->eq('feed_id', $feed_id)
|
||||||
|
->in('status', array('read', 'unread'))
|
||||||
|
->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_feed_items($feed_id, $offset = null, $limit = null)
|
||||||
|
{
|
||||||
|
return \PicoTools\singleton('db')
|
||||||
|
->table('items')
|
||||||
|
->columns('items.id', 'items.title', 'items.updated', 'items.url', 'items.status', 'items.bookmark', 'feeds.site_url')
|
||||||
|
->join('feeds', 'id', 'feed_id')
|
||||||
|
->in('status', array('read', 'unread'))
|
||||||
|
->eq('feed_id', $feed_id)
|
||||||
|
->desc('updated')
|
||||||
|
->offset($offset)
|
||||||
|
->limit($limit)
|
||||||
|
->findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function get_item($id)
|
function get_item($id)
|
||||||
{
|
{
|
||||||
return \PicoTools\singleton('db')
|
return \PicoTools\singleton('db')
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<link rel="apple-touch-icon" sizes="72x72" href="./assets/img/touch-icon-ipad.png">
|
<link rel="apple-touch-icon" sizes="72x72" href="./assets/img/touch-icon-ipad.png">
|
||||||
<link rel="apple-touch-icon" sizes="114x114" href="./assets/img/touch-icon-iphone-retina.png">
|
<link rel="apple-touch-icon" sizes="114x114" href="./assets/img/touch-icon-iphone-retina.png">
|
||||||
<link rel="apple-touch-icon" sizes="144x144" href="./assets/img/touch-icon-ipad-retina.png">
|
<link rel="apple-touch-icon" sizes="144x144" href="./assets/img/touch-icon-ipad-retina.png">
|
||||||
<title><?= isset($title) ? $title : 'miniflux' ?></title>
|
<title><?= isset($title) ? Helper\escape($title) : 'miniflux' ?></title>
|
||||||
<link href="./assets/css/app.css?v<?= filemtime('assets/css/app.css') ?>" rel="stylesheet" media="screen">
|
<link href="./assets/css/app.css?v<?= filemtime('assets/css/app.css') ?>" rel="stylesheet" media="screen">
|
||||||
<script type="text/javascript" src="./assets/js/app.js?v<?= filemtime('assets/js/app.js') ?>" defer></script>
|
<script type="text/javascript" src="./assets/js/app.js?v<?= filemtime('assets/js/app.js') ?>" defer></script>
|
||||||
</head>
|
</head>
|
||||||
|
54
templates/feed_items.php
Normal file
54
templates/feed_items.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php if (empty($items)): ?>
|
||||||
|
|
||||||
|
<p class="alert alert-info"><?= t('No item') ?></p>
|
||||||
|
|
||||||
|
<?php else: ?>
|
||||||
|
|
||||||
|
<div class="page-header">
|
||||||
|
<h2><?= Helper\escape($feed['title']) ?> (<?= $nb_items ?>)</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<section class="items" id="listing">
|
||||||
|
<?php foreach ($items as $item): ?>
|
||||||
|
<?php $item_id = Model\encode_item_id($item['id']) ?>
|
||||||
|
<article id="item-<?= $item_id ?>" data-item-id="<?= $item_id ?>">
|
||||||
|
<h2>
|
||||||
|
<?= $item['bookmark'] ? '★ ' : '' ?>
|
||||||
|
<a
|
||||||
|
href="?action=show&id=<?= $item_id ?>"
|
||||||
|
data-item-id="<?= $item_id ?>"
|
||||||
|
id="open-<?= $item_id ?>"
|
||||||
|
>
|
||||||
|
<?= Helper\escape($item['title']) ?>
|
||||||
|
</a>
|
||||||
|
</h2>
|
||||||
|
<p>
|
||||||
|
<?= Helper\get_host_from_url($item['url']) ?> |
|
||||||
|
<?= dt('%e %B %Y %k:%M', $item['updated']) ?> |
|
||||||
|
|
||||||
|
<a
|
||||||
|
href="<?= $item['url'] ?>"
|
||||||
|
id="original-<?= $item_id ?>"
|
||||||
|
rel="noreferrer"
|
||||||
|
target="_blank"
|
||||||
|
data-item-id="<?= $item_id ?>"
|
||||||
|
>
|
||||||
|
<?= t('original link') ?>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</article>
|
||||||
|
<?php endforeach ?>
|
||||||
|
|
||||||
|
<nav id="items-paging">
|
||||||
|
<?php if ($offset > 0): ?>
|
||||||
|
<a id="previous-page" href="?action=bookmarks&offset=<?= ($offset - $items_per_page) ?>">⇽ <?= t('Previous page') ?></a>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<?php if (($nb_items - $offset) > $items_per_page): ?>
|
||||||
|
<a id="next-page" href="?action=bookmarks&offset=<?= ($offset + $items_per_page) ?>"><?= t('Next page') ?> ⇾</a>
|
||||||
|
<?php endif ?>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<?php endif ?>
|
@ -29,6 +29,7 @@
|
|||||||
<a href="<?= $feed['site_url'] ?>" rel="noreferrer" target="_blank"><?= Helper\get_host_from_url($feed['site_url']) ?></a> |
|
<a href="<?= $feed['site_url'] ?>" rel="noreferrer" target="_blank"><?= Helper\get_host_from_url($feed['site_url']) ?></a> |
|
||||||
<a href="<?= Helper\escape($feed['feed_url']) ?>" rel="noreferrer" target="_blank"><?= t('feed link') ?></a> |
|
<a href="<?= Helper\escape($feed['feed_url']) ?>" rel="noreferrer" target="_blank"><?= t('feed link') ?></a> |
|
||||||
<a href="?action=confirm-remove-feed&feed_id=<?= $feed['id'] ?>"><?= t('remove') ?></a> |
|
<a href="?action=confirm-remove-feed&feed_id=<?= $feed['id'] ?>"><?= t('remove') ?></a> |
|
||||||
|
<a href="?action=feed-items&feed_id=<?= $feed['id'] ?>"><?= t('items') ?></a> |
|
||||||
<a href="?action=refresh-feed&feed_id=<?= $feed['id'] ?>" data-feed-id="<?= $feed['id'] ?>" data-action="refresh-feed"><?= t('refresh') ?></a>
|
<a href="?action=refresh-feed&feed_id=<?= $feed['id'] ?>" data-feed-id="<?= $feed['id'] ?>" data-action="refresh-feed"><?= t('refresh') ?></a>
|
||||||
</p>
|
</p>
|
||||||
</article>
|
</article>
|
||||||
|
Loading…
Reference in New Issue
Block a user