From 92a0cc39a9790132fe96a1b783a09f13a19631f9 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 13 Jun 2013 21:29:34 -0400 Subject: [PATCH 1/8] Add pages titles and the number of unread items --- index.php | 33 ++++++++++++++++++++++----------- locales/fr_FR/translations.php | 2 +- templates/app_header.php | 2 +- templates/unread_items.php | 2 +- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/index.php b/index.php index 34b90f3..a44c778 100644 --- a/index.php +++ b/index.php @@ -57,7 +57,6 @@ Router\before(function($action) { Router\get_action('logout', function() { Session\close(); - Response\redirect('?action=login'); }); @@ -173,7 +172,8 @@ Router\get_action('history', function() { Response\html(Template\layout('history', array( '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( '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() { 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( 'feeds' => Model\get_feeds(), '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( 'values' => 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( '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( '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()), 'languages' => Model\get_languages(), '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()), 'languages' => Model\get_languages(), 'autoflush_options' => Model\get_autoflush_options(), - 'menu' => 'config' + 'menu' => 'config', + 'title' => t('Preferences') ))); }); @@ -394,14 +402,17 @@ Router\notfound(function() { Model\autoflush(); $items = Model\get_unread_items(); + $nb_items = count($items); - if (empty($items)) { + if ($nb_items === 0) { Response\redirect('?action=feeds¬hing_to_read=1'); } Response\html(Template\layout('unread_items', array( 'items' => $items, + 'nb_items' => $nb_items, + 'title' => 'miniflux ('.$nb_items.')', 'menu' => 'unread' ))); }); diff --git a/locales/fr_FR/translations.php b/locales/fr_FR/translations.php index e3abc4d..38a6efc 100644 --- a/locales/fr_FR/translations.php +++ b/locales/fr_FR/translations.php @@ -36,7 +36,7 @@ return array( 'About' => 'A propos', 'Miniflux version:' => 'Version de Miniflux :', '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', 'original link' => 'lien original', 'mark as read' => 'marquer comme lu', diff --git a/templates/app_header.php b/templates/app_header.php index 2ccee69..f4eef4c 100644 --- a/templates/app_header.php +++ b/templates/app_header.php @@ -9,7 +9,7 @@ - miniflux + <?= isset($title) ? $title : 'miniflux' ?> diff --git a/templates/unread_items.php b/templates/unread_items.php index 71c0a35..54cc801 100644 --- a/templates/unread_items.php +++ b/templates/unread_items.php @@ -5,7 +5,7 @@