Add option to select display mode on lists (summaries or full contents)

This commit is contained in:
silvus 2014-05-29 16:57:23 +02:00
parent c765a7e0f0
commit 655e8fda68
17 changed files with 43 additions and 22 deletions

View File

@ -430,7 +430,7 @@ nav .active a {
}
.item-menu,
.items p {
.items .preview {
color: #aaa;
font-size: 70%;
}

View File

@ -46,6 +46,7 @@ Router\get_action('bookmarks', function() {
Response\html(Template\layout('bookmarks', array(
'order' => '',
'direction' => '',
'display_mode' => Model\Config\get('items_display_mode'),
'items' => Model\Item\get_bookmarks($offset, Model\Config\get('items_per_page')),
'nb_items' => $nb_items,
'offset' => $offset,

View File

@ -104,6 +104,7 @@ Router\get_action('config', function() {
'paging_options' => Model\Config\get_paging_options(),
'theme_options' => Model\Config\get_themes(),
'sorting_options' => Model\Config\get_sorting_directions(),
'display_mode' => Model\Config\get_display_mode(),
'redirect_nothing_to_read_options' => Model\Config\get_nothing_to_read_redirections(),
'menu' => 'config',
'title' => t('Preferences')
@ -139,6 +140,7 @@ Router\post_action('config', function() {
'theme_options' => Model\Config\get_themes(),
'sorting_options' => Model\Config\get_sorting_directions(),
'redirect_nothing_to_read_options' => Model\Config\get_nothing_to_read_redirections(),
'display_mode' => Model\Config\get_display_mode(),
'menu' => 'config',
'title' => t('Preferences')
)));

View File

@ -22,6 +22,7 @@ Router\get_action('history', function() {
),
'order' => '',
'direction' => '',
'display_mode' => Model\Config\get('items_display_mode'),
'nb_items' => $nb_items,
'offset' => $offset,
'items_per_page' => Model\Config\get('items_per_page'),

View File

@ -26,6 +26,7 @@ Router\get_action('unread', function() {
Response\html(Template\layout('unread_items', array(
'order' => $order,
'direction' => $direction,
'display_mode' => Model\Config\get('items_display_mode'),
'items' => $items,
'nb_items' => $nb_items,
'nb_unread_items' => $nb_items,
@ -86,6 +87,7 @@ Router\get_action('feed-items', function() {
Response\html(Template\layout('feed_items', array(
'order' => $order,
'direction' => $direction,
'display_mode' => Model\Config\get('items_display_mode'),
'feed' => $feed,
'items' => $items,
'nb_items' => $nb_items,

View File

@ -225,4 +225,7 @@ return array(
'Create' => 'Créer',
'Unknown' => 'Inconnu',
'Remember Me' => 'Connexion automatique',
'Display items on lists' => 'Mode d\'affichage en listes',
'Summaries' => 'Résumés',
'Full contents' => 'Contenus complets'
);

View File

@ -8,7 +8,7 @@ use PicoDb\Database;
use PicoFeed\Config as ReaderConfig;
use PicoFeed\Logging;
const DB_VERSION = 26;
const DB_VERSION = 27;
const HTTP_USER_AGENT = 'Miniflux (http://miniflux.net)';
// Get PicoFeed config
@ -116,6 +116,15 @@ function get_sorting_directions()
);
}
// Display summaries or full contents on lists
function get_display_mode()
{
return array(
'summaries' => t('Summaries'),
'full' => t('Full contents')
);
}
// Autoflush choices for items
function get_autoflush_options()
{
@ -237,6 +246,7 @@ function get_all()
'auth_google_token',
'auth_mozilla_token',
'items_sorting_direction',
'items_display_mode',
'redirect_nothing_to_read',
'auto_update_url'
)

View File

@ -2,6 +2,10 @@
namespace Schema;
function version_27($pdo)
{
$pdo->exec('ALTER TABLE config ADD COLUMN items_display_mode TEXT DEFAULT "summaries"');
}
function version_26($pdo)
{

View File

@ -12,7 +12,7 @@
<section class="items" id="listing">
<?php foreach ($items as $item): ?>
<?= \PicoFarad\Template\load('item', array('item' => $item, 'menu' => $menu, 'offset' => $offset, 'hide' => false)) ?>
<?= \PicoFarad\Template\load('item', array('item' => $item, 'menu' => $menu, 'offset' => $offset, 'hide' => false, 'display_mode' => $display_mode)) ?>
<?php endforeach ?>
<?= \PicoFarad\Template\load('paging', array('menu' => $menu, 'nb_items' => $nb_items, 'items_per_page' => $items_per_page, 'offset' => $offset, 'order' => $order, 'direction' => $direction)) ?>

View File

@ -28,6 +28,9 @@
<?= Helper\form_label(t('Default sorting order for items'), 'items_sorting_direction') ?>
<?= Helper\form_select('items_sorting_direction', $sorting_options, $values, $errors) ?><br/>
<?= Helper\form_label(t('Display items on lists'), 'items_display_mode') ?>
<?= Helper\form_select('items_display_mode', $display_mode, $values, $errors) ?><br/>
<?= Helper\form_label(t('When there is nothing to read, redirect me to this page'), 'redirect_nothing_to_read') ?>
<?= Helper\form_select('redirect_nothing_to_read', $redirect_nothing_to_read_options, $values, $errors) ?><br/>

View File

@ -18,7 +18,7 @@
<section class="items" id="listing">
<?php foreach ($items as $item): ?>
<?= \PicoFarad\Template\load('item', array('item' => $item, 'menu' => $menu, 'offset' => $offset, 'hide' => false)) ?>
<?= \PicoFarad\Template\load('item', array('item' => $item, 'menu' => $menu, 'offset' => $offset, 'hide' => false, 'display_mode' => $display_mode)) ?>
<?php endforeach ?>
<div id="bottom-menu">

View File

@ -15,7 +15,7 @@
<section class="items" id="listing">
<?php foreach ($items as $item): ?>
<?= \PicoFarad\Template\load('item', array('item' => $item, 'menu' => $menu, 'offset' => $offset, 'hide' => true)) ?>
<?= \PicoFarad\Template\load('item', array('item' => $item, 'menu' => $menu, 'offset' => $offset, 'hide' => true, 'display_mode' => $display_mode)) ?>
<?php endforeach ?>
<?= \PicoFarad\Template\load('paging', array('menu' => $menu, 'nb_items' => $nb_items, 'items_per_page' => $items_per_page, 'offset' => $offset, 'order' => $order, 'direction' => $direction)) ?>

View File

@ -18,9 +18,15 @@
<?= Helper\escape($item['title']) ?>
</a>
</h2>
<?php if($display_mode === 'full'): ?>
<div class="preview" <?= Helper\isRTL($item['language']) ? 'dir="rtl"' : '' ?>>
<?= $item['content'] ?>
</div>
<?php else: ?>
<p class="preview" <?= Helper\isRTL($item['language']) ? 'dir="rtl"' : '' ?>>
<?= Helper\escape(Helper\summary(strip_tags($item['content']), 50, 300)) ?>
</p>
<?php endif ?>
<ul class="item-menu">
<li>
<?php if (! isset($item['feed_title'])): ?>

View File

@ -16,7 +16,7 @@
<section class="items" id="listing">
<?php foreach ($items as $item): ?>
<?= \PicoFarad\Template\load('item', array('item' => $item, 'menu' => $menu, 'offset' => $offset, 'hide' => true)) ?>
<?= \PicoFarad\Template\load('item', array('item' => $item, 'menu' => $menu, 'offset' => $offset, 'hide' => true, 'display_mode' => $display_mode)) ?>
<?php endforeach ?>
<div id="bottom-menu">

View File

@ -159,10 +159,6 @@ section.page {
font-family: 'Muli', sans-serif;
}
.items li {
font-family: 'Muli', sans-serif;
}
form {
border: none;
padding-left: 10px;

View File

@ -33,7 +33,7 @@ pre, code {
margin-top: 20px
}
.items p {
.items .preview {
color: #666;
}

View File

@ -52,10 +52,6 @@ pre, code {
font-weight : normal;
}
.items p {
color: #666;
}
.items article:hover .preview,
.items #current-item .preview {
color: #666;
@ -66,13 +62,10 @@ pre, code {
font-family: roboto;
}
.preview p {
color: #ff0000;
}
.items .preview {
font-family: roboto;
text-align: justify;
color: #aaa;
}
.items a:hover {