Add pages titles and the number of unread items

This commit is contained in:
Frederic Guillot 2013-06-13 21:29:34 -04:00
parent c2ca54385f
commit 92a0cc39a9
4 changed files with 25 additions and 14 deletions

View File

@ -57,7 +57,6 @@ Router\before(function($action) {
Router\get_action('logout', function() { Router\get_action('logout', function() {
Session\close(); Session\close();
Response\redirect('?action=login'); Response\redirect('?action=login');
}); });
@ -173,7 +172,8 @@ Router\get_action('history', function() {
Response\html(Template\layout('history', array( Response\html(Template\layout('history', array(
'items' => Model\get_read_items(), 'items' => Model\get_read_items(),
'menu' => 'history' 'menu' => 'history',
'title' => t('History')
))); )));
}); });
@ -184,7 +184,8 @@ Router\get_action('confirm-remove', function() {
Response\html(Template\layout('confirm_remove_feed', array( Response\html(Template\layout('confirm_remove_feed', array(
'feed' => Model\get_feed($id), 'feed' => Model\get_feed($id),
'menu' => 'feeds' 'menu' => 'feeds',
'title' => t('Confirmation')
))); )));
}); });
@ -242,7 +243,8 @@ Router\get_action('mark-as-read', function() {
Router\get_action('confirm-flush-history', function() { Router\get_action('confirm-flush-history', function() {
Response\html(Template\layout('confirm_flush_items', array( Response\html(Template\layout('confirm_flush_items', array(
'menu' => 'history' 'menu' => 'history',
'title' => t('Confirmation')
))); )));
}); });
@ -267,7 +269,8 @@ Router\get_action('feeds', function() {
Response\html(Template\layout('feeds', array( Response\html(Template\layout('feeds', array(
'feeds' => Model\get_feeds(), 'feeds' => Model\get_feeds(),
'nothing_to_read' => Request\int_param('nothing_to_read'), 'nothing_to_read' => Request\int_param('nothing_to_read'),
'menu' => 'feeds' 'menu' => 'feeds',
'title' => t('Subscriptions')
))); )));
}); });
@ -277,7 +280,8 @@ Router\get_action('add', function() {
Response\html(Template\layout('add', array( Response\html(Template\layout('add', array(
'values' => array(), 'values' => array(),
'errors' => array(), 'errors' => array(),
'menu' => 'feeds' 'menu' => 'feeds',
'title' => t('New subscription')
))); )));
}); });
@ -296,7 +300,8 @@ Router\post_action('add', function() {
Response\html(Template\layout('add', array( Response\html(Template\layout('add', array(
'values' => array('url' => $_POST['url']), 'values' => array('url' => $_POST['url']),
'menu' => 'feeds' 'menu' => 'feeds',
'title' => t('Subscriptions')
))); )));
}); });
@ -326,7 +331,8 @@ Router\get_action('import', function() {
Response\html(Template\layout('import', array( Response\html(Template\layout('import', array(
'errors' => array(), 'errors' => array(),
'menu' => 'feeds' 'menu' => 'feeds',
'title' => t('OPML Import')
))); )));
}); });
@ -354,7 +360,8 @@ Router\get_action('config', function() {
'db_size' => filesize(get_db_filename()), 'db_size' => filesize(get_db_filename()),
'languages' => Model\get_languages(), 'languages' => Model\get_languages(),
'autoflush_options' => Model\get_autoflush_options(), 'autoflush_options' => Model\get_autoflush_options(),
'menu' => 'config' 'menu' => 'config',
'title' => t('Preferences')
))); )));
}); });
@ -384,7 +391,8 @@ Router\post_action('config', function() {
'db_size' => filesize(get_db_filename()), 'db_size' => filesize(get_db_filename()),
'languages' => Model\get_languages(), 'languages' => Model\get_languages(),
'autoflush_options' => Model\get_autoflush_options(), 'autoflush_options' => Model\get_autoflush_options(),
'menu' => 'config' 'menu' => 'config',
'title' => t('Preferences')
))); )));
}); });
@ -394,14 +402,17 @@ Router\notfound(function() {
Model\autoflush(); Model\autoflush();
$items = Model\get_unread_items(); $items = Model\get_unread_items();
$nb_items = count($items);
if (empty($items)) { if ($nb_items === 0) {
Response\redirect('?action=feeds&nothing_to_read=1'); Response\redirect('?action=feeds&nothing_to_read=1');
} }
Response\html(Template\layout('unread_items', array( Response\html(Template\layout('unread_items', array(
'items' => $items, 'items' => $items,
'nb_items' => $nb_items,
'title' => 'miniflux ('.$nb_items.')',
'menu' => 'unread' 'menu' => 'unread'
))); )));
}); });

View File

@ -36,7 +36,7 @@ return array(
'About' => 'A propos', 'About' => 'A propos',
'Miniflux version:' => 'Version de Miniflux :', 'Miniflux version:' => 'Version de Miniflux :',
'Nothing to read' => 'Rien à lire', 'Nothing to read' => 'Rien à lire',
'Unread items' => léments non lus', '%d unread items' => '%d éléments non lus',
'mark all as read' => 'tout marquer comme lu', 'mark all as read' => 'tout marquer comme lu',
'original link' => 'lien original', 'original link' => 'lien original',
'mark as read' => 'marquer comme lu', 'mark as read' => 'marquer comme lu',

View File

@ -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>miniflux</title> <title><?= isset($title) ? $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>

View File

@ -5,7 +5,7 @@
<?php else: ?> <?php else: ?>
<div class="page-header"> <div class="page-header">
<h2><?= t('Unread items') ?></h2> <h2><?= t('%d unread items', $nb_items) ?></h2>
<ul> <ul>
<li><a href="?action=mark-as-read"><?= t('mark all as read') ?></a></li> <li><a href="?action=mark-as-read"><?= t('mark all as read') ?></a></li>
</ul> </ul>