aboutsummaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorGravatar maTh <1645099+math-GH@users.noreply.github.com> 2024-07-01 01:13:54 +0200
committerGravatar GitHub <noreply@github.com> 2024-07-01 01:13:54 +0200
commit7aa3d9f87309620b54dc9ff5f726dc22d1e6ea0c (patch)
tree86f019bd5faa286feda5e3825610108cba62a479 /app/views
parentde477e15eca72d9e4d9dd99c0c694dc52500d4d5 (diff)
New: Sharing articles from the article title line (#6395)
* enable option * Update entry_header.phtml * frss.css * fix print sharing * Light refactoring * fix --------- Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'app/views')
-rw-r--r--app/views/configure/display.phtml4
-rw-r--r--app/views/helpers/index/normal/entry_bottom.phtml34
-rw-r--r--app/views/helpers/index/normal/entry_header.phtml13
-rw-r--r--app/views/helpers/index/normal/entry_share_menu.phtml37
4 files changed, 54 insertions, 34 deletions
diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml
index ce140c439..9584f37ea 100644
--- a/app/views/configure/display.phtml
+++ b/app/views/configure/display.phtml
@@ -212,7 +212,9 @@
data-leave-validation="<?= FreshRSS_Context::userConf()->topline_favorite ?>" /></td>
<td><input type="checkbox" disabled="disabled" /></td>
<td><input type="checkbox" disabled="disabled" /></td>
- <td><input type="checkbox" disabled="disabled" /></td>
+ <td><input type="checkbox" name="topline_sharing" value="1"<?=
+ FreshRSS_Context::userConf()->topline_sharing ? ' checked="checked"' : '' ?>
+ data-leave-validation="<?= FreshRSS_Context::userConf()->topline_sharing ?>" /></td>
<td><input type="checkbox" name="topline_summary" value="1"<?=
FreshRSS_Context::userConf()->topline_summary ? 'checked="checked"' : '' ?>
data-leave-validation="<?= FreshRSS_Context::userConf()->topline_summary ?>" /></td>
diff --git a/app/views/helpers/index/normal/entry_bottom.phtml b/app/views/helpers/index/normal/entry_bottom.phtml
index 21bd1d355..f8cf0eda3 100644
--- a/app/views/helpers/index/normal/entry_bottom.phtml
+++ b/app/views/helpers/index/normal/entry_bottom.phtml
@@ -76,39 +76,7 @@
<a class="dropdown-toggle" href="#dropdown-share-<?= $this->entry->id() ?>">
<?= _i('share') ?><?= _t('index.share') ?>
</a>
-
- <ul class="dropdown-menu">
- <li class="dropdown-header"><?= _t('index.share') ?> <a href="<?= _url('configure', 'integration') ?>"><?= _i('configure') ?></a></li><?php
- $id = $this->entry->id();
- $link = $this->entry->link();
- $title = $this->entry->title() . ' · ' . ($this->feed === null ? '' : $this->feed->name());
- foreach (FreshRSS_Context::userConf()->sharing as $share_options) {
- $share = FreshRSS_Share::get($share_options['type']);
- if ($share === null) {
- continue;
- }
- $cssClass = $share->isDeprecated() ? ' error' : '';
- $share_options['id'] = $id;
- $share_options['link'] = $link;
- $share_options['title'] = $title;
- $share->update($share_options);
- ?><li class="item share<?= $cssClass ?>">
- <?php if ('GET' === $share->method()) {
- if ($share->HTMLtag() !== 'button') {?>
- <a target="_blank" rel="noreferrer" href="<?= $share->url() ?>" data-type="<?= $share->type() ?>"><?= $share->name() ?></a>
- <?php } else { ?>
- <button type="button" class="as-link" data-url="<?= $share->url() ?>" data-type="<?= $share->type() ?>" data-title="<?= htmlspecialchars($title) ?>"><?= $share->name() ?></button>
- <?php
- }
- } else {?>
- <a href="POST"><?= $share->name() ?></a>
- <form method="POST" action="<?= $share->url() ?>" disabled="disabled">
- <input type="hidden" value="<?= $link ?>" name="<?= $share->field() ?>"/>
- </form>
- <?php } ?>
- </li><?php
- }
- ?></ul>
+ <?php $this->renderHelper('index/normal/entry_share_menu'); ?>
<a class="dropdown-close" href="#close">❌</a>
</div>
<?php } ?>
diff --git a/app/views/helpers/index/normal/entry_header.phtml b/app/views/helpers/index/normal/entry_header.phtml
index e4befb346..bcd4a7c98 100644
--- a/app/views/helpers/index/normal/entry_header.phtml
+++ b/app/views/helpers/index/normal/entry_header.phtml
@@ -3,6 +3,7 @@
/** @var FreshRSS_View $this */
$topline_read = FreshRSS_Context::userConf()->topline_read;
$topline_favorite = FreshRSS_Context::userConf()->topline_favorite;
+ $topline_sharing = FreshRSS_Context::userConf()->topline_sharing;
$topline_website = FreshRSS_Context::userConf()->topline_website;
$topline_thumbnail = FreshRSS_Context::userConf()->topline_thumbnail;
$topline_summary = FreshRSS_Context::userConf()->topline_summary;
@@ -72,6 +73,18 @@
endif; ?>
<?php if ($topline_date) { ?><span class="item-element date"><time datetime="<?= $this->entry->machineReadableDate() ?>"><?= $this->entry->date() ?></time>&nbsp;</span><?php } ?>
</li>
+ <?php if ($topline_sharing) { ?>
+ <li class="item share">
+ <div class="item-element dropdown">
+ <div id="dropdown-share2-<?= $this->entry->id() ?>" class="dropdown-target"></div>
+ <a class="dropdown-toggle" href="#dropdown-share2-<?= $this->entry->id() ?>" title="<?= _t('index.share') ?>">
+ <?= _i('share') ?>
+ </a>
+ <?php $this->renderHelper('index/normal/entry_share_menu'); ?>
+ <a class="dropdown-close" href="#close">❌</a>
+ </div>
+ </li>
+ <?php } ?>
<?php if ($topline_link) { ?><li class="item link"><a target="_blank" rel="noreferrer" href="<?= $this->entry->link() ?>" class="item-element" title="<?=
_t('conf.shortcut.see_on_website') ?>"><?= _i('link') ?></a></li><?php } ?>
</ul>
diff --git a/app/views/helpers/index/normal/entry_share_menu.phtml b/app/views/helpers/index/normal/entry_share_menu.phtml
new file mode 100644
index 000000000..62d1f5244
--- /dev/null
+++ b/app/views/helpers/index/normal/entry_share_menu.phtml
@@ -0,0 +1,37 @@
+<?php
+ declare(strict_types=1);
+ /** @var FreshRSS_View $this */
+ //TODO: To reduce output size, replace by an on-demand JavaScript menu, potentially using HTML template element
+?>
+<ul class="dropdown-menu">
+ <li class="dropdown-header"><?= _t('index.share') ?> <a href="<?= _url('configure', 'integration') ?>"><?= _i('configure') ?></a></li><?php
+ $id = $this->entry->id();
+ $link = $this->entry->link();
+ $title = $this->entry->title() . ' · ' . ($this->feed === null ? '' : $this->feed->name());
+ foreach (FreshRSS_Context::userConf()->sharing as $share_options) {
+ $share = FreshRSS_Share::get($share_options['type']);
+ if ($share === null) {
+ continue;
+ }
+ $cssClass = $share->isDeprecated() ? ' error' : '';
+ $share_options['id'] = $id;
+ $share_options['link'] = $link;
+ $share_options['title'] = $title;
+ $share->update($share_options);
+ ?><li class="item share<?= $cssClass ?>">
+ <?php if ('GET' === $share->method()) {
+ if ($share->HTMLtag() !== 'button') {?>
+ <a target="_blank" rel="noreferrer" href="<?= $share->url() ?>" data-type="<?= $share->type() ?>"><?= $share->name() ?></a>
+ <?php } else { ?>
+ <button type="button" class="as-link" data-url="<?= $share->url() ?>" data-type="<?= $share->type() ?>" data-title="<?= htmlspecialchars($title) ?>"><?= $share->name() ?></button>
+ <?php
+ }
+ } else {?>
+ <a href="POST"><?= $share->name() ?></a>
+ <form method="POST" action="<?= $share->url() ?>" disabled="disabled">
+ <input type="hidden" value="<?= $link ?>" name="<?= $share->field() ?>"/>
+ </form>
+ <?php } ?>
+ </li><?php
+ }
+?></ul>