Browse Source

enhancement subscription management page (#3893)

* wip

* wip2

* i18n

* Update app/views/helpers/category/update.phtml

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>

* fixed box layout

* Revert "i18n"

This reverts commit a2e4d8ace661df806997a8310f069a67d71910f4.

* i18n

This reverts commit 55236930cfc7165ff883ea2a9538d3502b8922eb.

Co-authored-by: Frans de Jonge <fransdejonge@gmail.com>
maTh 4 years ago
parent
commit
3623a5421d

+ 15 - 0
app/Controllers/subscriptionController.php

@@ -21,6 +21,21 @@ class FreshRSS_subscription_Controller extends Minz_ActionController {
 		$feedDAO->updateTTL();
 		$this->view->categories = $catDAO->listSortedCategories(false);
 		$this->view->default_category = $catDAO->getDefault();
+
+		$signalError = false;
+		foreach ($this->view->categories as $cat) {
+			$feeds = $cat->feeds();
+			foreach ($feeds as $feed) {
+				if ($feed->inError()) {
+					$signalError = true;
+				}
+			}
+			if ($signalError) {
+				break;
+			}
+		}
+
+		$this->view->signalError = $signalError;
 	}
 
 	/**

+ 1 - 1
app/i18n/cz/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'Feed and category creation has been moved <a href=\'%s\'>here</a>. It is also accessible from the menu on the left and from the ✚ icon available on the main page.',	// TODO - Translation
 	'api' => array(
 		'documentation' => 'Copy the following URL to use it within an external tool.',	// TODO - Translation
 		'title' => 'API',	// TODO - Translation
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'Kategorie',
+		'add' => 'Přidat kategorie',
 		'archiving' => 'Archivace',
 		'empty' => 'Vyprázdit kategorii',
 		'information' => 'Informace',

+ 1 - 1
app/i18n/de/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'Die Erstellung von Kategorien und Feeds wurde verschoben und findet sich ab sofort <a href=\'%s\'>hier</a>. Zusätzlich ist ein Zugriff über den linken Menüpunkt oder über das ✚ Symbol auf der Hauptseite möglich.',
 	'api' => array(
 		'documentation' => 'Kopieren Sie die folgende URL, um sie in einem externen Tool zu verwenden.',
 		'title' => 'API',
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'Kategorie',
+		'add' => 'Kategorie hinzufügen',
 		'archiving' => 'Archivierung',
 		'empty' => 'Leere Kategorie',
 		'information' => 'Information',

+ 1 - 1
app/i18n/en-us/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'Feed and category creation has been moved <a href=\'%s\'>here</a>. It is also accessible from the menu on the left and from the ✚ icon available on the main page.',
 	'api' => array(
 		'documentation' => 'Copy the following URL to use it within an external tool.',
 		'title' => 'API',
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'Category',
+		'add' => 'Add a category',
 		'archiving' => 'Archiving',
 		'empty' => 'Empty category',
 		'information' => 'Information',

+ 1 - 1
app/i18n/en/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'Feed and category creation has been moved <a href=\'%s\'>here</a>. It is also accessible from the menu on the left and from the ✚ icon available on the main page.',
 	'api' => array(
 		'documentation' => 'Copy the following URL to use it within an external tool.',
 		'title' => 'API',
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'Category',
+		'add' => 'Add a category',
 		'archiving' => 'Archiving',
 		'empty' => 'Empty category',
 		'information' => 'Information',

+ 1 - 1
app/i18n/es/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'Feed and category creation has been moved <a href=\'%s\'>here</a>. It is also accessible from the menu on the left and from the ✚ icon available on the main page.',	// TODO - Translation
 	'api' => array(
 		'documentation' => 'Copy the following URL to use it within an external tool.',	// TODO - Translation
 		'title' => 'API',	// TODO - Translation
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'Categoría',
+		'add' => 'Añadir categoría',
 		'archiving' => 'Archivo',
 		'empty' => 'Vaciar categoría',
 		'information' => 'Información',

+ 1 - 1
app/i18n/fr/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'L\'ajout de flux et de catégories se fait désormais <a href=\'%s\'>ici</a>. Il est possible d\'y accéder depuis le menu de gauche ou depuis l\'icône ✚ présente sur la page principale.',
 	'api' => array(
 		'documentation' => 'Copier l’URL suivante dans l’outil qui utilisera l’API.',
 		'title' => 'API',
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'Catégorie',
+		'add' => 'Ajouter catégorie',
 		'archiving' => 'Archivage',
 		'empty' => 'Catégorie vide',
 		'information' => 'Informations',

+ 1 - 1
app/i18n/he/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'Feed and category creation has been moved <a href=\'%s\'>here</a>. It is also accessible from the menu on the left and from the ✚ icon available on the main page.',	// TODO - Translation
 	'api' => array(
 		'documentation' => 'Copy the following URL to use it within an external tool.',	// TODO - Translation
 		'title' => 'API',	// TODO - Translation
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'קטגוריה',
+		'add' => 'Add a category', // TODO - Translation
 		'archiving' => 'ארכוב',
 		'empty' => 'Empty category',	// TODO - Translation
 		'information' => 'מידע',

+ 1 - 1
app/i18n/it/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'Feed and category creation has been moved <a href=\'%s\'>here</a>. It is also accessible from the menu on the left and from the ✚ icon available on the main page.',	// TODO - Translation
 	'api' => array(
 		'documentation' => 'Copy the following URL to use it within an external tool.',	// TODO - Translation
 		'title' => 'API',	// TODO - Translation
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'Categoria',
+		'add' => 'Aggiungi categoria',
 		'archiving' => 'Archiviazione',
 		'empty' => 'Categoria vuota',
 		'information' => 'Informazioni',

+ 1 - 1
app/i18n/ja/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => '<a href=\'%s\'>ここへ</a>フィードとカテゴリは移動されました。また左側のメニューや ✚ アイコンからフィードとカテゴリへ移動できます。',
 	'api' => array(
 		'documentation' => '外部ツール内で使うURLをコピーします。',
 		'title' => 'API',
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'カテゴリ',
+		'add' => 'Add a category', // TODO - Translation
 		'archiving' => 'アーカイブ',
 		'empty' => 'からのカテゴリ',
 		'information' => 'インフォメーション',

+ 1 - 1
app/i18n/kr/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'Feed and category creation has been moved <a href=\'%s\'>here</a>. It is also accessible from the menu on the left and from the ✚ icon available on the main page.',	// TODO - Translation
 	'api' => array(
 		'documentation' => '외부 도구에서 API를 사용하기 위해서 아래 URL을 사용하세요.',
 		'title' => 'API',
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => '카테고리',
+		'add' => 'Add a category', // TODO - Translation
 		'archiving' => '보관',
 		'empty' => '빈 카테고리',
 		'information' => '정보',

+ 1 - 1
app/i18n/nl/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'Het toevoegen van feeds en categorieën is <a href=\'%s\'>hierheen</a> verplaatst. Deze functionaliteit is ook toegankelijk via het menu links en via het ✚ icoon op de hoofdpagina.',
 	'api' => array(
 		'documentation' => 'Kopieer de volgende URL om deze in een externe toepassing te gebruiken.',
 		'title' => 'API',
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'Categorie',
+		'add' => 'Voeg categorie',
 		'archiving' => 'Archiveren',
 		'empty' => 'Lege categorie',
 		'information' => 'Informatie',

+ 1 - 1
app/i18n/oc/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'La creacion de flux e categoria es desplaçada <a href=\'%s\'>aquí</a>. I avètz tanben accès del menú a man esquèrra e de l’icòna ✚ sus la pagina principala.',
 	'api' => array(
 		'documentation' => 'Copiatz l’URL seguenta per l’utilizaire dins d’una aisina extèrna.',
 		'title' => 'API',
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'Categoria',
+		'add' => 'Ajustar categoria',
 		'archiving' => 'Archivar',
 		'empty' => 'Categoria voida',
 		'information' => 'Informacions',

+ 1 - 1
app/i18n/pl/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'Dodawanie nowych kanałów i kategorii zostało przeniesione <a href=\'%s\'>tutaj</a>. Jest również dostępne w menu po lewej stronie, a także za pomocą ikony ✚ dostępnej na głównej stronie.',
 	'api' => array(
 		'documentation' => 'Skopiuj następujący URL, by wykorzystać go w zewnętrznym narzędziu.',
 		'title' => 'API',
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'Kategoria',
+		'add' => 'Dodaj kategoria',
 		'archiving' => 'Archiwizacja',
 		'empty' => 'Pusta kategoria',
 		'information' => 'Informacje',

+ 1 - 1
app/i18n/pt-br/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'Feed and category creation has been moved <a href=\'%s\'>here</a>. It is also accessible from the menu on the left and from the ✚ icon available on the main page.',	// TODO - Translation
 	'api' => array(
 		'documentation' => 'Copie a seguinte URL para utilizar com uma ferramenta externa',
 		'title' => 'API',
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'Categoria',
+		'add' => 'Adicionar categoria',
 		'archiving' => 'Arquivar',
 		'empty' => 'Categoria vazia',
 		'information' => 'Informações',

+ 1 - 1
app/i18n/ru/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'Создание лент и категорий перемещено <a href=\'%s\'>сюда</a>. Оно также доступно из меню слева и по нажатию на иконку ✚ на главной странице.',
 	'api' => array(
 		'documentation' => 'Скопируйте URL для использования во внешнем инструменте.',
 		'title' => 'API',	// TODO - Translation
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'Категория',
+		'add' => 'Добавить категория',
 		'archiving' => 'Архивирование',
 		'empty' => 'Пустая категория',
 		'information' => 'Информация',

+ 1 - 1
app/i18n/sk/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'Feed and category creation has been moved <a href=\'%s\'>here</a>. It is also accessible from the menu on the left and from the ✚ icon available on the main page.',	// TODO - Translation
 	'api' => array(
 		'documentation' => 'Skopírujte tento odkaz a použite ho v inom programe.',
 		'title' => 'API',
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'Kategória',
+		'add' => 'Pridať kategória',
 		'archiving' => 'Archiving',	// TODO - Translation
 		'empty' => 'Prázdna kategória',
 		'information' => 'Informácia',

+ 1 - 1
app/i18n/tr/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => 'Akış ve kategori oluşturma menüsü <a href=\'%s\'>buraya</a> taşındı. Ayrıca sol menüden ve anasayfadaki ✚ simgesinden de ulaşılabilir.',
 	'api' => array(
 		'documentation' => 'URL\'yi harici bir araçla kullanmak için kopyala.',
 		'title' => 'API',
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => 'Kategori',
+		'add' => 'Kategori ekle',
 		'archiving' => 'Arşiv',
 		'empty' => 'Boş kategori',
 		'information' => 'Bilgi',

+ 1 - 1
app/i18n/zh-cn/sub.php

@@ -1,7 +1,6 @@
 <?php
 
 return array(
-	'add' => '订阅源和分类的创建已被移至 <a href=\'%s\'>这里</a>。 也可从左侧菜单或主页的 ✚ 图标访问。',
 	'api' => array(
 		'documentation' => '复制以下地址,以供外部工具使用',
 		'title' => 'API',
@@ -13,6 +12,7 @@ return array(
 	),
 	'category' => array(
 		'_' => '分类',
+		'add' => 'Add a category', // TODO - Translation
 		'archiving' => '归档',
 		'empty' => '空分类',
 		'information' => '信息',

+ 23 - 10
app/views/helpers/category/update.phtml

@@ -7,6 +7,7 @@
 
 	<form method="post" action="<?= _url('subscription', 'category', 'id', $this->category->id()) ?>" autocomplete="off">
 		<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
+
 		<legend><?= _t('sub.category.information') ?></legend>
 		<div class="form-group">
 			<label class="group-name" for="name"><?= _t('sub.category.title') ?></label>
@@ -28,16 +29,8 @@
 		<div class="form-group form-actions">
 			<div class="group-controls">
 				<button class="btn btn-important"><?= _t('gen.action.submit') ?></button>
-				<button class="btn btn-attention confirm"
-					data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
-					formaction="<?= _url('category', 'empty', 'id', $this->category->id()) ?>"
-					formmethod="post"><?= _t('gen.action.empty') ?></button>
-				<?php if (!$this->category->isDefault()): ?>
-				<button class="btn btn-attention confirm"
-					data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
-					formaction="<?= _url('category', 'delete', 'id', $this->category->id()) ?>"
-					formmethod="post"><?= _t('gen.action.remove') ?></button>
-				<?php endif;?>
+				<button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
+				
 			</div>
 		</div>
 
@@ -165,5 +158,25 @@
 				<button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
 			</div>
 		</div>
+
+		<?php if (!$this->category->isDefault()): ?>
+		<p class="alert alert-warn">
+			<?= _t('sub.feed.moved_category_deleted', $this->default_category->name()) ?>
+		</p>
+		<?php endif;?>
+		<div class="form-group form-actions">
+			<div class="group-controls">
+				<button class="btn btn-attention confirm"
+					data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
+					formaction="<?= _url('category', 'empty', 'id', $this->category->id()) ?>"
+					formmethod="post"><?= _t('gen.action.empty') ?></button>
+				<?php if (!$this->category->isDefault()): ?>
+				<button class="btn btn-attention confirm"
+					data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
+					formaction="<?= _url('category', 'delete', 'id', $this->category->id()) ?>"
+					formmethod="post"><?= _t('gen.action.remove') ?></button>
+				<?php endif;?>
+			</div>
+		</div>
 	</form>
 </div>

+ 21 - 16
app/views/subscription/index.phtml

@@ -7,25 +7,28 @@
 
 	<h1><?= _t('sub.title') ?></h1>
 
-	<p class="alert alert-warn">
-		<?= _t('sub.feed.moved_category_deleted', $this->default_category->name()) ?>
-	</p>
-
-	<p class="alert alert-warn">
-		<?= _t('sub.add', _url('subscription', 'add')) ?>
-	</p>
-
 	<?php if ($this->onlyFeedsWithError): ?>
-	<p class="alert alert-warn">
+	<div class="link-showAllFeeds-wrapper">
+		<a href="<?= _url('subscription', 'index') ?>">← <?= _t('sub.feed.show.all') ?></a>
+	</div>
+		<p class="alert alert-warn">
 		<?= _t('sub.feed.showing.error') ?>
 	</p>
+	
 	<?php endif; ?>
 
+	<?php if (!$this->onlyFeedsWithError && $this->signalError){ ?>
+		<div>
+			<a class="btn" href="<?= _url('subscription', 'index', 'error', 1) ?>"><?= _i('look') ?> <?= _t('sub.feed.show.error') ?></a>
+		</div>
+	<?php } ?>
+
 	<form id="controller-category" method="post" aria-hidden="true">
 		<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
 	</form>
 
 	<?php
+		$signalError = false;
 		foreach ($this->categories as $cat) {
 			$feeds = $cat->feeds();
 	?>
@@ -57,17 +60,19 @@
 			?>
 			<li class="item feed disabled" dropzone="move"><div class="alert-warn"><?= _t('sub.category.empty') ?></div></li>
 			<?php } ?>
+			<li class="item feed">✚ <a href="<?= _url('subscription', 'add') ?>"><?= _t('sub.feed.add') ?></a></li>
 		</ul>
 	</div>
 	<?php } ?>
 
-	<ul>
-		<?php if ($this->onlyFeedsWithError): ?>
-		<li><a href="<?= _url('subscription', 'index') ?>"><?= _t('sub.feed.show.all') ?></a></li>
-		<?php else: ?>
-		<li><a href="<?= _url('subscription', 'index', 'error', 1) ?>"><?= _t('sub.feed.show.error') ?></a></li>
-		<?php endif; ?>
-	</ul>
+	<div class="box visible-semi">
+		<div class="box-title">
+			✚ <a href="<?= _url('subscription', 'add') ?>"><?= _t('sub.category.add') ?></a>
+		</div>
+		<ul class="box-content">
+		</ul>
+	</div>
+
 </div>
 
 <?php $class = $this->displaySlider ? ' class="active"' : ''; ?>

+ 2 - 2
p/scripts/category.js

@@ -24,8 +24,8 @@ function dragend_process(t) {
 		const p = t.parentElement;
 		t.remove();
 
-		if (p.childElementCount <= 0) {
-			p.insertAdjacentHTML('beforeend', '<li class="item feed disabled" dropzone="move"><div class="alert-warn">' + context.i18n.category_empty + '</div></li>');
+		if (p.childElementCount <= 1) {
+			p.insertAdjacentHTML('afterbegin', '<li class="item feed disabled" dropzone="move"><div class="alert-warn">' + context.i18n.category_empty + '</div></li>');
 		}
 	}
 }

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

@@ -465,7 +465,7 @@ a.btn {
 
 /*=== Boxes */
 .box {
-	margin: 20px 10px;
+	margin: 20px 20px 20px 0;
 	display: inline-block;
 	max-width: 95%;
 	width: 20rem;
@@ -473,6 +473,11 @@ a.btn {
 	vertical-align: top;
 }
 
+.box.visible-semi {
+	border-style: dashed;
+	opacity: 0.5;
+}
+
 .box .box-title {
 	position: relative;
 	font-size: 1.2rem;