Skip to content

Commit

Permalink
Fix mix linking
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlaefer committed Mar 14, 2020
1 parent 8bd4778 commit e43a285
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Template/Element/entry/thread_cached_init.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ foreach ($entriesSub as $entrySub) :
<i class="fa fa-fw fa-thread-open" title="<?= $l10nCache['collapse'] ?>";></i>
</button>

<a href="<?= $this->Posting->urlToMix($entrySub)?>"
<a href="<?= $this->Posting->urlToMix($entrySub, false)?>"
class="btn btn-link threadBox-tools-btn"
title="<?= $l10nCache['mix'] ?>"
rel="nofollow">
Expand Down
2 changes: 1 addition & 1 deletion src/Template/Entries/view.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $this->start('headerSubnavRight');
$mixTitle = h(__('gn.btn.mix.t'));
echo $this->Layout->navbarItem(
$this->Layout->textWithIcon($mixTitle, 'mix'),
$this->Posting->urlToMix($entry),
$this->Posting->urlToMix($entry, true, false),
['rel' => 'nofollow', 'escape' => false, 'title' => $mixTitle]
);
$this->end();
Expand Down
10 changes: 7 additions & 3 deletions src/View/Helper/PostingHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,17 @@ public function getSubject(BasicPostingInterface $posting)
*
* @param PostingInterface $posting Posting to generate URL for
* @param bool $jump Jump to posting in mix view
* @param bool $base Add base in front
* @return string
*/
public function urlToMix(PostingInterface $posting, bool $jump = true): string
public function urlToMix(PostingInterface $posting, bool $jump = true, bool $base = true): string
{
$tid = $posting->get('tid');
$webroot = $this->getView()->getRequest()->getAttribute('webroot');
$url = "${webroot}entries/mix/${tid}";
$url = '';
if ($base) {
$url .= $this->getView()->getRequest()->getAttribute('base');
}
$url .= "/entries/mix/${tid}";
$url .= $jump ? '#' . $posting->get('id') : '';

return $url;
Expand Down

0 comments on commit e43a285

Please sign in to comment.