Sfoglia il codice sorgente

feat: create config to display website icon only / name only / icon and name / none on feeds (#4969)

* feat: create config to display website icon only / name only / icon and name / none on feeds

* fix title hovering

* reverted: column in .phtml

* Update app/i18n/fr/conf.php

---------

Co-authored-by: mathContao <math-home@web.de>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Sadetdin EYILI 3 anni fa
parent
commit
d3966befaf

+ 1 - 0
app/Controllers/configureController.php

@@ -51,6 +51,7 @@ class FreshRSS_configure_Controller extends FreshRSS_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_website = Minz_Request::param('topline_website', false);
 			FreshRSS_Context::$user_conf->topline_thumbnail = Minz_Request::param('topline_thumbnail', false);
 			FreshRSS_Context::$user_conf->topline_summary = Minz_Request::param('topline_summary', false);
 			FreshRSS_Context::$user_conf->topline_display_authors = Minz_Request::param('topline_display_authors', false);

+ 7 - 0
app/Models/ConfigurationSetter.php

@@ -272,6 +272,13 @@ class FreshRSS_ConfigurationSetter {
 	private function _topline_read(&$data, $value) {
 		$data['topline_read'] = $this->handleBool($value);
 	}
+	private function _topline_website(&$data, $value) {
+		$value = strtolower($value);
+		if (!in_array($value, array('none', 'icon', 'name', 'full'))) {
+			$value = 'full';
+		}
+		$data['topline_website'] = $value;
+	}
 	private function _topline_thumbnail(&$data, $value) {
 		$value = strtolower($value);
 		if (!in_array($value, array('none', 'portrait', 'square', 'landscape'))) {

+ 1 - 0
app/Models/UserConfiguration.php

@@ -61,6 +61,7 @@
  * @property bool $topline_link
  * @property bool $topline_read
  * @property bool $topline_summary
+ * @property string $topline_website
  * @property string $topline_thumbnail
  * @property int $ttl_default
  * @property int $dynamic_opml_ttl_default

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

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => 'Zobrazení',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => 'Šířka obsahu',
 			'large' => 'Široká',

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

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => 'Anzeige',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => 'Inhaltsbreite',
 			'large' => 'Groß',

+ 7 - 0
app/i18n/el/conf.php

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => 'Display',	// TODO
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => 'Content width',	// TODO
 			'large' => 'Wide',	// TODO

+ 7 - 0
app/i18n/en-us/conf.php

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// IGNORE
 		'title' => 'Display',	// IGNORE
+		'website' => array(
+			'full' => 'Icon and name',	// IGNORE
+			'icon' => 'Icon only',	// IGNORE
+			'label' => 'Website',	// IGNORE
+			'name' => 'Name only',	// IGNORE
+			'none' => 'None',	// IGNORE
+		),
 		'width' => array(
 			'content' => 'Content width',	// IGNORE
 			'large' => 'Wide',	// IGNORE

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

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',
 		'title' => 'Display',
+		'website' => array(
+			'full' => 'Icon and name',
+			'icon' => 'Icon only',
+			'label' => 'Website',
+			'name' => 'Name only',
+			'none' => 'None',
+		),
 		'width' => array(
 			'content' => 'Content width',
 			'large' => 'Wide',

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

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => 'Visualización',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => 'Ancho de contenido',
 			'large' => 'Grande',

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

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Fuseau horaire',
 		'title' => 'Affichage',
+		'website' => array(
+			'full' => 'Icône et nom',
+			'icon' => 'Icône seulement',
+			'label' => 'Site Web',
+			'name' => 'Nom seulement',
+			'none' => 'Aucun',
+		),
 		'width' => array(
 			'content' => 'Largeur du contenu',
 			'large' => 'Large',	// IGNORE

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

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => 'תצוגה',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => 'רוחב התוכן',
 			'large' => 'גדול',

+ 7 - 0
app/i18n/id/conf.php

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => 'Display',	// TODO
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => 'Content width',	// TODO
 			'large' => 'Wide',	// TODO

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

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => 'Visualizzazione',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => 'Larghezza contenuto',
 			'large' => 'Largo',

+ 7 - 0
app/i18n/ja/conf.php

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => 'ディスプレイ',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => 'コンテンツ幅',
 			'large' => '広い',

+ 7 - 0
app/i18n/ko/conf.php

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => '표시',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => '내용 표시 너비',
 			'large' => '넓게',

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

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Tijdzone',
 		'title' => 'Opmaak',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => 'Inhoud breedte',
 			'large' => 'Breed',

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

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => 'Afichatge',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => 'Largor del contengut',
 			'large' => 'Larga',

+ 7 - 0
app/i18n/pl/conf.php

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => 'Wyświetlanie',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => 'Rozmiar treści',
 			'large' => 'Szeroka',

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

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => 'Exibição',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => 'Largura do conteúdo',
 			'large' => 'Largo',

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

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => 'Отображение',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => 'Ширина содержимого',
 			'large' => 'Широкое',

+ 7 - 0
app/i18n/sk/conf.php

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => 'Zobraziť',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => 'Šírka obsahu',
 			'large' => 'Veľká',

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

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => 'Görünüm',
+		'website' => array(
+			'full' => 'simgesi and adı',
+			'icon' => 'Sadece simgesi',
+			'label' => 'Site',
+			'name' => 'Sadece adı',
+			'none' => 'Hiçbiri',
+		),
 		'width' => array(
 			'content' => 'İçerik genişliği',
 			'large' => 'Geniş',

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

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => '显示',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => '内容宽度',
 			'large' => '宽',

+ 7 - 0
app/i18n/zh-tw/conf.php

@@ -66,6 +66,13 @@ return array(
 		),
 		'timezone' => 'Time zone',	// TODO
 		'title' => '顯示',
+		'website' => array(
+			'full' => 'Icon and name',	// TODO
+			'icon' => 'Icon only',	// TODO
+			'label' => 'Website',	// TODO
+			'name' => 'Name only',	// TODO
+			'none' => 'None',	// TODO
+		),
 		'width' => array(
 			'content' => '內容寬度',
 			'large' => '寬',

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

@@ -136,6 +136,27 @@
 			</div>
 		</div>
 
+		<?php $topline_website = FreshRSS_Context::$user_conf->topline_website; ?>
+		<div class="form-group">
+			<label class="group-name" for="topline_website"><?= _t('conf.display.website.label') ?></label>
+			<div class="group-controls">
+				<select name="topline_website" id="topline_website" required="" data-leave-validation="<?= $topline_website ?>">
+					<option value="none" <?= $topline_website === 'none' ? 'selected="selected"' : '' ?>>
+						<?= _t('conf.display.website.none') ?>
+					</option>
+					<option value="icon" <?= $topline_website === 'icon' ? 'selected="selected"' : '' ?>>
+						<?= _t('conf.display.website.icon') ?>
+					</option>
+					<option value="name" <?= $topline_website === 'name' ? 'selected="selected"' : '' ?>>
+						<?= _t('conf.display.website.name') ?>
+					</option>
+					<option value="full" <?= $topline_website === 'full' ? 'selected="selected"' : '' ?>>
+						<?= _t('conf.display.website.full') ?>
+					</option>
+				</select>
+			</div>
+		</div>
+
 		<?php $topline_thumbnail = FreshRSS_Context::$user_conf->topline_thumbnail; ?>
 		<div class="form-group">
 			<label class="group-name" for="topline_thumbnail"><?= _t('conf.display.thumbnail.label') ?></label>

+ 8 - 4
app/views/helpers/index/normal/entry_header.phtml

@@ -2,13 +2,14 @@
 	/** @var FreshRSS_View $this */
 	$topline_read = FreshRSS_Context::$user_conf->topline_read;
 	$topline_favorite = FreshRSS_Context::$user_conf->topline_favorite;
+	$topline_website = FreshRSS_Context::$user_conf->topline_website;
 	$topline_thumbnail = FreshRSS_Context::$user_conf->topline_thumbnail;
 	$topline_summary = FreshRSS_Context::$user_conf->topline_summary;
 	$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;
 	$lazyload = FreshRSS_Context::$user_conf->lazyload;
-?><ul class="horizontal-list flux_header"><?php
+?><ul class="horizontal-list flux_header website<?= $topline_website ?>"><?php
 	if (FreshRSS_Auth::hasAccess()) {
 		if ($topline_read) {
 			?><li class="item manage"><?php
@@ -31,11 +32,14 @@
 			?></li><?php
 		}
 	}
-	?><li class="item website">
+
+	if ($topline_website !== 'none'):
+	?><li class="item website <?= $topline_website ?>">
 		<a href="<?= _url('index', 'index', 'get', 'f_' . $this->feed->id()) ?>" class="item-element" title="<?= _t('gen.action.filter') ?>: <?= $this->feed->name() ?>">
-			<?php if (FreshRSS_Context::$user_conf->show_favicons): ?><img class="favicon" src="<?= $this->feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?><span><?= $this->feed->name() ?></span>
+			<?php if (FreshRSS_Context::$user_conf->show_favicons && 'name' !== $topline_website): ?><img class="favicon" src="<?= $this->feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?><?php if ('icon' !== $topline_website): ?><span class="websiteName"><?= $this->feed->name() ?></span><?php endif; ?>
 		</a>
-	</li>
+		</li><?php
+	endif; ?>
 
 	<?php
 	if ($topline_thumbnail !== 'none'):

+ 1 - 0
config-user.default.php

@@ -100,6 +100,7 @@ return array (
 
 	'topline_read' => true,
 	'topline_favorite' => true,
+	'topline_website' => 'full',
 	'topline_thumbnail' => 'none',
 	'topline_summary' => false,
 	'topline_display_authors' => false,

+ 20 - 0
p/themes/base-theme/frss.css

@@ -1199,6 +1199,26 @@ input[type="search"] {
 	width: 200px;
 }
 
+.flux:not(.current):hover .websitenone .item.title {
+	max-width: calc(100% - 3 * (2 * var(--frss-padding-flux-items) + 16px));
+}
+
+.flux .websiteicon .item.website {
+	width: calc(2 * var(--frss-padding-flux-items) + 16px);
+}
+
+.flux:not(.current):hover .websiteicon .item.title {
+	max-width: calc(100% - 4 * (2 * var(--frss-padding-flux-items) + 16px));
+}
+
+.flux .websitename .item.website {
+	width: 150px;
+}
+
+.flux:not(.current):hover .websitename .item.title {
+	max-width: calc(100% - 3 * (2 * var(--frss-padding-flux-items) + 16px) - 150px);
+}
+
 .website a:hover .favicon,
 a.website:hover .favicon {
 	filter: grayscale(100%);

+ 20 - 0
p/themes/base-theme/frss.rtl.css

@@ -1199,6 +1199,26 @@ input[type="search"] {
 	width: 200px;
 }
 
+.flux:not(.current):hover .websitenone .item.title {
+	max-width: calc(100% - 3 * (2 * var(--frss-padding-flux-items) + 16px));
+}
+
+.flux .websiteicon .item.website {
+	width: calc(2 * var(--frss-padding-flux-items) + 16px);
+}
+
+.flux:not(.current):hover .websiteicon .item.title {
+	max-width: calc(100% - 4 * (2 * var(--frss-padding-flux-items) + 16px));
+}
+
+.flux .websitename .item.website {
+	width: 150px;
+}
+
+.flux:not(.current):hover .websitename .item.title {
+	max-width: calc(100% - 3 * (2 * var(--frss-padding-flux-items) + 16px) - 150px);
+}
+
 .website a:hover .favicon,
 a.website:hover .favicon {
 	filter: grayscale(100%);