aboutsummaryrefslogtreecommitdiff
path: root/app/views/helpers/index
diff options
context:
space:
mode:
authorGravatar maTh <1645099+math-GH@users.noreply.github.com> 2024-09-07 23:24:05 +0200
committerGravatar GitHub <noreply@github.com> 2024-09-07 23:24:05 +0200
commitf7235bcb54e9f24e4de1f83d7428fa3ff970bb05 (patch)
tree10e23a26d0ec5a8758ac2c760251ad82887ef944 /app/views/helpers/index
parent93c102d7eab69fee76f50fe207f9d3f4022372ca (diff)
Improved: refactor the sharing menu to use a template instead of duplicated HTML code (#6751)
* <script> --> <template> * sharing menu * normal view, global view (reader view does not have a share button) * fix
Diffstat (limited to 'app/views/helpers/index')
-rw-r--r--app/views/helpers/index/normal/entry_bottom.phtml3
-rw-r--r--app/views/helpers/index/normal/entry_header.phtml5
-rw-r--r--app/views/helpers/index/normal/entry_share_menu.phtml11
3 files changed, 7 insertions, 12 deletions
diff --git a/app/views/helpers/index/normal/entry_bottom.phtml b/app/views/helpers/index/normal/entry_bottom.phtml
index f8cf0eda3..1de8395bc 100644
--- a/app/views/helpers/index/normal/entry_bottom.phtml
+++ b/app/views/helpers/index/normal/entry_bottom.phtml
@@ -76,8 +76,7 @@
<a class="dropdown-toggle" href="#dropdown-share-<?= $this->entry->id() ?>">
<?= _i('share') ?><?= _t('index.share') ?>
</a>
- <?php $this->renderHelper('index/normal/entry_share_menu'); ?>
- <a class="dropdown-close" href="#close">❌</a>
+ <?php /* entry_share_menu */ ?>
</div>
<?php } ?>
</li><?php
diff --git a/app/views/helpers/index/normal/entry_header.phtml b/app/views/helpers/index/normal/entry_header.phtml
index bcd4a7c98..ecaf0f0d6 100644
--- a/app/views/helpers/index/normal/entry_header.phtml
+++ b/app/views/helpers/index/normal/entry_header.phtml
@@ -11,7 +11,7 @@
$topline_date = FreshRSS_Context::userConf()->topline_date;
$topline_link = FreshRSS_Context::userConf()->topline_link;
$lazyload = FreshRSS_Context::userConf()->lazyload;
-?><ul class="horizontal-list flux_header website<?= $topline_website ?>"><?php
+?><ul class="horizontal-list flux_header website<?= $topline_website ?>" data-website-name="<?= $this->feed->name() ?>" data-article-authors="<?= implode(', ', $this->entry->authors()) ?>"><?php
if (FreshRSS_Auth::hasAccess()) {
if ($topline_read) {
?><li class="item manage"><?php
@@ -80,8 +80,7 @@
<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>
+ <?php /* entry_share_menu */ ?>
</div>
</li>
<?php } ?>
diff --git a/app/views/helpers/index/normal/entry_share_menu.phtml b/app/views/helpers/index/normal/entry_share_menu.phtml
index 62d1f5244..af699210a 100644
--- a/app/views/helpers/index/normal/entry_share_menu.phtml
+++ b/app/views/helpers/index/normal/entry_share_menu.phtml
@@ -1,29 +1,26 @@
<?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());
+ $link = '--link--';
+ $title = '--titleText----websiteName----articleAuthors--';
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>
+ <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>
+ <button type="button" class="as-link" data-url="<?= $share->url() ?>" data-type="<?= $share->type() ?>" data-title="<?= htmlspecialchars($title) ?>"><?= $share->name() ?></button>
<?php
}
} else {?>