فهرست منبع

Added option to display authors under article titles (#2487)

This feature is particularly useful to display authors underneath scientific articles.
Joris Kinable 6 سال پیش
والد
کامیت
cb31874085

+ 1 - 0
app/Controllers/configureController.php

@@ -48,6 +48,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 			FreshRSS_Context::$user_conf->topline_favorite = Minz_Request::param('topline_favorite', false);
 			FreshRSS_Context::$user_conf->topline_date = Minz_Request::param('topline_date', false);
 			FreshRSS_Context::$user_conf->topline_link = Minz_Request::param('topline_link', false);
+			FreshRSS_Context::$user_conf->topline_display_authors = Minz_Request::param('topline_display_authors', false);
 			FreshRSS_Context::$user_conf->bottomline_read = Minz_Request::param('bottomline_read', false);
 			FreshRSS_Context::$user_conf->bottomline_favorite = Minz_Request::param('bottomline_favorite', false);
 			FreshRSS_Context::$user_conf->bottomline_sharing = Minz_Request::param('bottomline_sharing', false);

+ 3 - 0
app/Models/ConfigurationSetter.php

@@ -257,6 +257,9 @@ class FreshRSS_ConfigurationSetter {
 	private function _topline_read(&$data, $value) {
 		$data['topline_read'] = $this->handleBool($value);
 	}
+	private function _topline_display_authors(&$data, $value) {
+		$data['topline_display_authors'] = $this->handleBool($value);
+	}
 
 	/**
 	 * The (not so long) list of setters for system configuration.

+ 1 - 0
app/i18n/cz/conf.php

@@ -21,6 +21,7 @@ return array(
 			'publication_date' => 'Datum vydání',
 			'related_tags' => 'Související tagy',	//TODO - Translation
 			'sharing' => 'Sdílení',
+			'display_authors' => 'Authors',  //TODO - Translation
 			'top_line' => 'Horní řádek',
 		),
 		'language' => 'Jazyk',

+ 1 - 0
app/i18n/de/conf.php

@@ -21,6 +21,7 @@ return array(
 			'publication_date' => 'Datum der Veröffentlichung',
 			'related_tags' => 'Verwandte Tags',
 			'sharing' => 'Teilen',
+			'display_authors' => 'Authors',  //TODO - Translation
 			'top_line' => 'Kopfzeile',
 		),
 		'language' => 'Sprache',

+ 1 - 0
app/i18n/en/conf.php

@@ -21,6 +21,7 @@ return array(
 			'publication_date' => 'Date of publication',
 			'related_tags' => 'Article tags',
 			'sharing' => 'Sharing',
+			'display_authors' => 'Authors',
 			'top_line' => 'Top line',
 		),
 		'language' => 'Language',

+ 1 - 0
app/i18n/es/conf.php

@@ -21,6 +21,7 @@ return array(
 			'publication_date' => 'Fecha de publicación',
 			'related_tags' => 'Etiquetas relacionadas',
 			'sharing' => 'Compartir',
+			'display_authors' => 'Authors',  //TODO - Translation
 			'top_line' => 'Línea superior',
 		),
 		'language' => 'Idioma',

+ 1 - 0
app/i18n/fr/conf.php

@@ -21,6 +21,7 @@ return array(
 			'publication_date' => 'Date de publication',
 			'related_tags' => 'Tags de l’article',
 			'sharing' => 'Partage',
+			'display_authors' => 'Authors',  //TODO - Translation
 			'top_line' => 'Ligne du haut',
 		),
 		'language' => 'Langue',

+ 1 - 0
app/i18n/he/conf.php

@@ -21,6 +21,7 @@ return array(
 			'publication_date' => 'תאריך הפרסום',
 			'related_tags' => 'תגיות קשורות',	//TODO - Translation
 			'sharing' => 'שיתוף',
+			'display_authors' => 'Authors',  //TODO - Translation
 			'top_line' => 'שורה עליונה',
 		),
 		'language' => 'שפה',

+ 1 - 0
app/i18n/it/conf.php

@@ -21,6 +21,7 @@ return array(
 			'publication_date' => 'Data di pubblicazione',
 			'related_tags' => 'Tags correlati',	//TODO - Translation
 			'sharing' => 'Condivisione',
+			'display_authors' => 'Authors',  //TODO - Translation
 			'top_line' => 'Barra in alto',
 		),
 		'language' => 'Lingua',

+ 1 - 0
app/i18n/kr/conf.php

@@ -21,6 +21,7 @@ return array(
 			'publication_date' => '발행일',
 			'related_tags' => '관련 태그',
 			'sharing' => '공유',
+			'display_authors' => 'Authors',  //TODO - Translation
 			'top_line' => '상단',
 		),
 		'language' => '언어',

+ 1 - 0
app/i18n/nl/conf.php

@@ -21,6 +21,7 @@ return array(
 			'publication_date' => 'Publicatie datum',
 			'related_tags' => 'Gerelateerde labels',
 			'sharing' => 'Delen',
+			'display_authors' => 'Auteurs',
 			'top_line' => 'Bovenaan',
 		),
 		'language' => 'Taal',

+ 1 - 0
app/i18n/oc/conf.php

@@ -21,6 +21,7 @@ return array(
 			'publication_date' => 'Data de publicacion',
 			'related_tags' => 'Etiquetas ligadas',
 			'sharing' => 'Partatge',
+			'display_authors' => 'Authors',  //TODO - Translation
 			'top_line' => 'Linha amont',
 		),
 		'language' => 'Lenga',

+ 1 - 0
app/i18n/pt-br/conf.php

@@ -21,6 +21,7 @@ return array(
 			'publication_date' => 'Data da publicação',
 			'related_tags' => 'Tags relacionadas',	//TODO - Translation
 			'sharing' => 'Compartilhar',
+			'display_authors' => 'Authors',  //TODO - Translation
 			'top_line' => 'Linha superior',
 		),
 		'language' => 'Ídioma',

+ 1 - 0
app/i18n/ru/conf.php

@@ -21,6 +21,7 @@ return array(
 			'publication_date' => 'Date of publication',	//TODO - Translation
 			'related_tags' => 'Related tags',	//TODO - Translation
 			'sharing' => 'Sharing',	//TODO - Translation
+			'display_authors' => 'Authors',  //TODO - Translation
 			'top_line' => 'Top line',	//TODO - Translation
 		),
 		'language' => 'Язык',

+ 1 - 0
app/i18n/tr/conf.php

@@ -21,6 +21,7 @@ return array(
 			'publication_date' => 'Yayınlama Tarihi',
 			'related_tags' => 'İlgili etiketler',	//TODO - Translation
 			'sharing' => 'Paylaşım',
+			'display_authors' => 'Authors',  //TODO - Translation
 			'top_line' => 'Üst çizgi',
 		),
 		'language' => 'Dil',

+ 1 - 0
app/i18n/zh-cn/conf.php

@@ -21,6 +21,7 @@ return array(
 			'publication_date' => '更新日期',
 			'related_tags' => '相关标签',
 			'sharing' => '分享',
+			'display_authors' => 'Authors',  //TODO - Translation
 			'top_line' => '顶栏',
 		),
 		'language' => '语言',

+ 3 - 0
app/views/configure/display.phtml

@@ -81,6 +81,7 @@
 						<th title="<?php echo _t('gen.action.mark_favorite'); ?>"><?php echo _i('bookmark'); ?></th>
 						<th><?php echo _t('conf.display.icon.related_tags'); ?></th>
 						<th><?php echo _t('conf.display.icon.sharing'); ?></th>
+						<th><?php echo _t('conf.display.icon.display_authors'); ?></th>
 						<th><?php echo _t('conf.display.icon.publication_date'); ?></th>
 						<th><?php echo _i('link'); ?></th>
 					</tr>
@@ -92,6 +93,7 @@
 						<td><input type="checkbox" name="topline_favorite" value="1"<?php echo FreshRSS_Context::$user_conf->topline_favorite ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->topline_favorite; ?>"/></td>
 						<td><input type="checkbox" disabled="disabled" /></td>
 						<td><input type="checkbox" disabled="disabled" /></td>
+						<td><input type="checkbox" name="topline_display_authors" value="1"<?php echo FreshRSS_Context::$user_conf->topline_display_authors ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->topline_display_authors; ?>"/></td>
 						<td><input type="checkbox" name="topline_date" value="1"<?php echo FreshRSS_Context::$user_conf->topline_date ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->topline_date; ?>"/></td>
 						<td><input type="checkbox" name="topline_link" value="1"<?php echo FreshRSS_Context::$user_conf->topline_link ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->topline_link; ?>"/></td>
 					</tr><tr>
@@ -100,6 +102,7 @@
 						<td><input type="checkbox" name="bottomline_favorite" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_favorite ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_favorite; ?>"/></td>
 						<td><input type="checkbox" name="bottomline_tags" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_tags ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_tags; ?>"/></td>
 						<td><input type="checkbox" name="bottomline_sharing" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_sharing ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_sharing; ?>"/></td>
+						<td><input type="checkbox" disabled="disabled" /></td>
 						<td><input type="checkbox" name="bottomline_date" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_date ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_date; ?>"/></td>
 						<td><input type="checkbox" name="bottomline_link" value="1"<?php echo FreshRSS_Context::$user_conf->bottomline_link ? ' checked="checked"' : ''; ?> data-leave-validation="<?php echo FreshRSS_Context::$user_conf->bottomline_link; ?>"/></td>
 					</tr>

+ 16 - 1
app/views/helpers/index/normal/entry_header.phtml

@@ -1,6 +1,7 @@
 <?php
 	$topline_read = FreshRSS_Context::$user_conf->topline_read;
 	$topline_favorite = FreshRSS_Context::$user_conf->topline_favorite;
+	$topline_display_authors = FreshRSS_Context::$user_conf->topline_display_authors;
 	$topline_date = FreshRSS_Context::$user_conf->topline_date;
 	$topline_link = FreshRSS_Context::$user_conf->topline_link;
 ?><ul class="horizontal-list flux_header"><?php
@@ -27,7 +28,21 @@
 		}
 	}
 	?><li class="item website"><a href="<?php echo _url('index', 'index', 'get', 'f_' . $this->feed->id()); ?>"><img class="favicon" src="<?php echo $this->feed->favicon(); ?>" alt="✇" /> <span><?php echo $this->feed->name(); ?></span></a></li>
-	<li class="item title"><a target="_blank" rel="noreferrer" href="<?php echo $this->entry->link(); ?>"><?php echo $this->entry->title(); ?></a></li>
+        <li class="item title"><a target="_blank" rel="noreferrer" href="<?php echo $this->entry->link(); ?>"><?php echo $this->entry->title(); ?></a><?php
+		if ($topline_display_authors) {
+                    ?><div class="item author">
+                    <?php 
+                    $authors = $this->entry->authors();
+                    if (is_array($authors)):
+                            $first = true;
+                            foreach ($authors as $author):
+                                    echo $first ? $author : ', ' . $author;
+                                    $first = false;
+                            endforeach;
+                    endif;		
+                    ?></div><?php
+                }
+        ?></li>
 	<?php if ($topline_date) { ?><li class="item date"><?php echo $this->entry->date(); ?> </li><?php } ?>
 	<?php if ($topline_link) { ?><li class="item link"><a target="_blank" rel="noreferrer" href="<?php echo $this->entry->link(); ?>"><?php echo _i('link'); ?></a></li><?php } ?>
 </ul>

+ 1 - 0
config-user.default.php

@@ -67,6 +67,7 @@ return array (
 	),
 	'topline_read' => true,
 	'topline_favorite' => true,
+	'topline_display_authors' => false,
 	'topline_date' => true,
 	'topline_link' => true,
 	'bottomline_read' => true,

+ 6 - 0
p/themes/base-theme/template.css

@@ -569,6 +569,12 @@ a.btn {
 	color: #000;
 	text-decoration: none;
 }
+.flux .item.author {
+	color: #555;
+	font-size: .7rem;
+	font-weight: normal;
+	white-space: normal;
+}
 .flux .item.date {
 	width: 155px;
 	text-align: right;