Skip to content

Commit

Permalink
IBX-7159: Fix preview back button 500 (#1005)
Browse files Browse the repository at this point in the history
  • Loading branch information
tischsoic authored Nov 23, 2023
1 parent 9c42a75 commit 244788f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/bundle/Controller/ContentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ public function previewAction(
?Location $location = null
): Response {
$preselectedSiteAccess = $request->query->get('preselectedSiteAccess');
$referrer = $request->query->get('referrer');

if (null === $languageCode) {
$languageCode = $content->contentInfo->mainLanguageCode;
Expand Down Expand Up @@ -396,6 +397,7 @@ public function previewAction(
'siteaccesses' => $siteAccessesList,
'version_no' => $versionNo ?? $content->getVersionInfo()->versionNo,
'preselected_site_access' => $preselectedSiteAccess,
'referrer' => $referrer ?? 'content_draft_edit',
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,23 @@
{% block header_row %}
<div class="ibexa-preview-header">
<div class="ibexa-preview-header__item ibexa-preview-header__item--back">
{% if referrer == 'content_draft_edit' %}
{% set back_url = url('ibexa.content.draft.edit', {
contentId: content.id,
versionNo: version_no,
language: language_code,
locationId: is_published ? location.id : null,
}) %}
{% else %}
{% set back_url = url('ibexa.content.view', {
contentId: content.id,
locationId: location.id,
}) %}
{% endif %}

<a
class="ibexa-preview-header__link btn ibexa-btn ibexa-btn--ghost"
href="{{ url('ibexa.content.draft.edit', {'contentId': content.id, 'versionNo': version_no, 'language': language_code, 'locationId': is_published ? location.id : null}) }}"
href="{{ back_url }}"
>
<svg class="ibexa-icon ibexa-icon--small-medium">
<use xlink:href="{{ ibexa_icon_path('back') }}"></use>
Expand Down
1 change: 1 addition & 0 deletions src/lib/Menu/ContentRightSidebarBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ private function getContentPreviewItem(
'versionNo' => $content->getVersionInfo()->versionNo,
'languageCode' => $languageCode,
'locationId' => $location->id,
'referrer' => 'content_view',
],
];
} else {
Expand Down

0 comments on commit 244788f

Please # to comment.