Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Language Change Behavior on Single Post Page #184

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,17 @@ public function posts(Request $request, Response $response, PostTransformer $tra

/**
* Action - get single post
* @param Request $request
* @param Response $response
* @param ViewFactory $view
* @param PostTransformer $transformer
* @param string|null $lang
* @param string $postId
*/
public function post(Response $response, ViewFactory $view, PostTransformer $transformer, ?string $lang, string $postId)
public function post(Request $request, Response $response, ViewFactory $view, PostTransformer $transformer, ?string $lang, string $postId)
{
$ref = $request->get(\'ref\', \'posts\');

$post = $this->postService->getPost($postId);

if (!$post->asArray()) {
Expand All @@ -112,7 +115,8 @@ public function post(Response $response, ViewFactory $view, PostTransformer $tra
$view->setParams([
\'title\' => $post->title . \' | \' . config()->get(\'app_name\'),
\'langs\' => config()->get(\'langs\'),
\'post\' => current(transform([$post], $transformer))
\'post\' => current(transform([$post], $transformer)),
\'referer\' => $ref,
]);

$response->html($view->render(\'post/single\'));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return "
<a class=\"back-btn\" title=\"Back\" href=\"<?php echo get_referrer() ?: base_url(true) . '/' . current_lang() . '/posts'; ?>\">
<i class=\"material-icons\">arrow_back</i>
return '
<a class=\'back-btn\' title=\'Back\' href="<?php echo base_url(true) . \'/\' . current_lang() . \'/\' . $referer; ?>">
<i class=\'material-icons\'>arrow_back</i>
</a>
";
';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<img src="<?php echo base_url() ?>/assets/images/no-image.png" class="circle img-my-post">
<?php endif; ?>
<span class="title post-title" title="<?php echo $post[\'title\'] ?>">
<a class="teal-text post-title" href="<?php echo base_url(true) . \'/\' . current_lang() . \'/post/\' . $post[\'id\'] ?>">
<a class="teal-text post-title" href="<?php echo base_url(true) . \'/\' . current_lang() . \'/post/\' . $post[\'id\'] ?>?ref=my-posts">
<?php echo $post[\'title\'] ?>
</a>
</span>
Expand Down
Loading