Skip to content
New issue

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

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

Already on GitHub? # to your account

IBX-7159: Fix preview back button 500 #1005

Merged
merged 3 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
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,15 @@
{% block header_row %}
<div class="ibexa-preview-header">
<div class="ibexa-preview-header__item ibexa-preview-header__item--back">
{% if referrer == 'content_view' %}
{% set back_url = url('ibexa.content.view', { 'contentId': content.id, 'locationId': location.id }) %}
{% elseif 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}) %}
{% 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|default('') }}"
tischsoic marked this conversation as resolved.
Show resolved Hide resolved
>
<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
Loading