aboutsummaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2024-01-03 11:23:06 +0100
committerGravatar GitHub <noreply@github.com> 2024-01-03 11:23:06 +0100
commit70e71b8364c1317af04f92fd86df4541fa269e0c (patch)
tree193f4db62a85a218e227ee79ce7554a32eade390 /app/views
parent1e5f5078ed029640f69bdcc5ba51dd4dc69574ca (diff)
Auto-label (#5954)
Add labels automatically to incoming articles fix https://github.com/FreshRSS/FreshRSS/issues/2380 fix https://github.com/FreshRSS/FreshRSS/issues/2420 fix https://github.com/FreshRSS/FreshRSS/issues/3279 fix https://github.com/FreshRSS/FreshRSS/discussions/4947 fix https://github.com/FreshRSS/FreshRSS/issues/5728 fix https://github.com/FreshRSS/FreshRSS/issues/5599
Diffstat (limited to 'app/views')
-rw-r--r--app/views/tag/index.phtml64
-rw-r--r--app/views/tag/update.phtml69
2 files changed, 77 insertions, 56 deletions
diff --git a/app/views/tag/index.phtml b/app/views/tag/index.phtml
index eed8906c4..3f6cf8945 100644
--- a/app/views/tag/index.phtml
+++ b/app/views/tag/index.phtml
@@ -27,60 +27,12 @@
</div>
</form>
- <h2><?= _t('sub.title.rename_label') ?></h2>
- <?php
- $disabled = '';
- if (count($this->tags) < 1) {
- $disabled = ' disabled="disabled"';
- } ?>
- <form id="rename_tag" method="post" action="<?= _url('tag', 'rename') ?>" autocomplete="off">
- <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
- <div class="form-group">
- <label class="group-name" for="id_tag"><?= _t('sub.tag.old_name') ?></label>
- <div class="group-controls">
- <select name="id_tag" id="id_tag"<?= $disabled?>>
- <?php foreach ($this->tags as $tag): ?>
- <option value="<?= $tag->id() ?>"><?= $tag->name() ?></option>
- <?php endforeach; ?>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="group-name" for="rename_new_name"><?= _t('sub.tag.new_name') ?></label>
- <div class="group-controls">
- <input id="rename_new_name" name="name" type="text" autocomplete="off"<?= $disabled?>/>
- </div>
- </div>
-
- <div class="form-group form-actions">
- <div class="group-controls">
- <?php if (!$disabled) { ?>
- <button type="submit" class="btn btn-attention confirm"><?= _t('gen.action.rename') ?></button>
- <?php } ?>
- </div>
- </div>
- </form>
-
- <h2><?= _t('sub.title.delete_label') ?></h2>
- <form id="delete_tag" method="post" action="<?= _url('tag', 'delete') ?>" autocomplete="off">
- <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
- <div class="form-group">
- <label class="group-name" for="id_tag_delete"><?= _t('sub.tag.name') ?></label>
- <div class="group-controls">
- <select name="id_tag" id="id_tag_delete"<?= $disabled?>>
- <?php foreach ($this->tags as $tag): ?>
- <option value="<?= $tag->id() ?>"><?= $tag->name() ?></option>
- <?php endforeach; ?>
- </select>
- </div>
- </div>
-
- <div class="form-group form-actions">
- <div class="group-controls">
- <?php if (!$disabled) { ?>
- <button type="submit" class="btn btn-attention confirm"><?= _t('gen.action.remove') ?></button>
- <?php } ?>
- </div>
- </div>
- </form>
+ <?php if (count($this->tags) > 0): ?>
+ <h2><?= _t('gen.action.manage') ?></h2>
+ <ul>
+ <?php foreach ($this->tags as $tag): ?>
+ <li><a href="<?= _url('tag', 'update', 'id', $tag->id()) ?>"><?= $tag->name() ?></a></li>
+ <?php endforeach; ?>
+ </ul>
+ <?php endif; ?>
</main>
diff --git a/app/views/tag/update.phtml b/app/views/tag/update.phtml
new file mode 100644
index 000000000..69cc096f4
--- /dev/null
+++ b/app/views/tag/update.phtml
@@ -0,0 +1,69 @@
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+
+ if (!Minz_Request::paramBoolean('ajax')) {
+ $this->partial('aside_subscription');
+ }
+ if ($this->tag === null) {
+ throw new FreshRSS_Context_Exception('Tag not initialised!');
+ }
+?>
+<div class="post">
+ <h2>
+ <?= $this->tag->name() ?>
+ </h2>
+
+ <div>
+ <a href="<?= _url('index', 'index', 'get', 't_' . $this->tag->id()) ?>"><?= _i('link') ?> <?= _t('gen.action.filter') ?></a>
+ </div>
+
+ <form method="post" action="<?= _url('tag', 'update', 'id', $this->tag->id(), '#', 'slider') ?>" 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.tag.name') ?></label>
+ <div class="group-controls">
+ <input type="text" name="name" id="name" value="<?= $this->tag->name() ?>" />
+ </div>
+ </div>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
+ <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
+ </div>
+ </div>
+
+ <legend><?= _t('sub.feed.filteractions') ?></legend>
+ <div class="form-group">
+ <label class="group-name" for="filteractions_label"><?= _t('sub.tag.auto_label') ?></label>
+ <div class="group-controls">
+ <textarea name="filteractions_label" id="filteractions_label" class="w100"><?php
+ foreach ($this->tag->filtersAction('label') as $filterRead) {
+ echo $filterRead->getRawInput(), PHP_EOL;
+ }
+ ?></textarea>
+ <p class="help"><?= _i('help') ?> <?= _t('sub.feed.filteractions.help') ?></p>
+ </div>
+ </div>
+
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
+ <button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
+ </div>
+ </div>
+ </form>
+
+ <h2><?= _t('sub.title.delete_label') ?></h2>
+ <form id="delete_tag" method="post" action="<?= _url('tag', 'delete', 'id_tag', $this->tag->id()) ?>">
+ <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
+ <div class="form-group form-actions">
+ <div class="group-controls">
+ <button type="submit" class="btn btn-attention confirm"><?= _t('gen.action.remove') ?></button>
+ </div>
+ </div>
+ </form>
+</div>