Skip to content

Commit

Permalink
Updated entry bottom and header views to latest version
Browse files Browse the repository at this point in the history
Fixes: #2
  • Loading branch information
christian-putzke authored and Joedmin committed Oct 17, 2024
1 parent c9736e0 commit f658ae4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 51 deletions.
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Readeck Button",
"author": "Joedmin",
"description": "Add articles to Readeck with one simple button click or a keyboard shortcut.",
"version": 0.3,
"version": 0.4,
"entrypoint": "ReadeckButton",
"type": "user"
}
43 changes: 5 additions & 38 deletions views/helpers/index/normal/entry_bottom.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
$bottomline_link = FreshRSS_Context::userConf()->bottomline_link;
?><ul class="horizontal-list bottom"><?php
if (FreshRSS_Auth::hasAccess()) {

if ($bottomline_read) {
?><li class="item manage"><?php
$arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $this->entry->id()));
$arUrl = ['c' => 'entry', 'a' => 'read', 'params' => ['id' => $this->entry->id()]];
if ($this->entry->isRead()) {
$arUrl['params']['is_read'] = 0;
$arUrl['params']['is_read'] = '0';
}
?><a class="item-element read" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?php
echo _i($this->entry->isRead() ? 'read' : 'unread'); ?></a><?php
Expand All @@ -33,9 +32,9 @@

if ($bottomline_favorite) {
?><li class="item manage"><?php
$arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $this->entry->id()));
$arUrl = ['c' => 'entry', 'a' => 'bookmark', 'params' => ['id' => $this->entry->id()]];
if ($this->entry->isFavorite()) {
$arUrl['params']['is_favorite'] = 0;
$arUrl['params']['is_favorite'] = '0';
}
?><a class="item-element bookmark" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?php
echo _i($this->entry->isFavorite() ? 'starred' : 'non-starred'); ?></a><?php
Expand Down Expand Up @@ -87,39 +86,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 } ?>
Expand Down
36 changes: 24 additions & 12 deletions views/helpers/index/normal/entry_header.phtml
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?php
declare(strict_types=1);
/** @var FreshRSS_View $this */
if ($this->feed === null) {
throw new FreshRSS_Context_Exception('Feed not initialised!');
}
$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;
Expand All @@ -17,9 +15,9 @@
if (FreshRSS_Auth::hasAccess()) {
if ($topline_read) {
?><li class="item manage"><?php
$arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $this->entry->id()));
$arUrl = ['c' => 'entry', 'a' => 'read', 'params' => ['id' => $this->entry->id()]];
if ($this->entry->isRead()) {
$arUrl['params']['is_read'] = 0;
$arUrl['params']['is_read'] = '0';
}
?><a class="item-element read" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_read') ?>"><?php
echo _i($this->entry->isRead() ? 'read' : 'unread'); ?></a><?php
Expand All @@ -37,9 +35,9 @@

if ($topline_favorite) {
?><li class="item manage"><?php
$arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $this->entry->id()));
$arUrl = ['c' => 'entry', 'a' => 'bookmark', 'params' => ['id' => $this->entry->id()]];
if ($this->entry->isFavorite()) {
$arUrl['params']['is_favorite'] = 0;
$arUrl['params']['is_favorite'] = '0';
}
?><a class="item-element bookmark" href="<?= Minz_Url::display($arUrl) ?>" title="<?= _t('conf.shortcut.mark_favorite') ?>"><?php
echo _i($this->entry->isFavorite() ? 'starred' : 'non-starred'); ?></a><?php
Expand All @@ -64,8 +62,8 @@
endif;
?></li><?php
endif; ?>

<li class="item title<?= (($topline_thumbnail !== 'none') || $topline_summary) ? ' multiline' : '' ?>" dir="auto"><a target="_blank" rel="noreferrer" href="<?= $this->entry->link() ?>" class="item-element"><?= $this->entry->title() ?><?php
<li class="item titleAuthorSummaryDate">
<a target="_blank" rel="noreferrer" href="<?= $this->entry->link() ?>" class="item-element title<?= (($topline_thumbnail !== 'none') || $topline_summary) ? ' multiline' : '' ?>" dir="auto"><?= $this->entry->title() ?><?php
if ($topline_display_authors):
?><span class="author"><?php
$authors = $this->entry->authors();
Expand All @@ -78,11 +76,25 @@
}
?></span><?php
endif;
?></a>
<?php
if ($topline_summary):
?><div class="summary"><?= trim(mb_substr(strip_tags($this->entry->content(false)), 0, 500, 'UTF-8')) ?></div><?php
endif;
?></a></li>
<?php if ($topline_date) { ?><li class="item date"><time datetime="<?= $this->entry->machineReadableDate() ?>" class="item-element"><?= $this->entry->date() ?></time>&nbsp;</li><?php } ?>
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>

0 comments on commit f658ae4

Please sign in to comment.