Skip to content

Commit

Permalink
Merge pull request #1225 from ezsystems/ezp-30639-deprecate-view-loca…
Browse files Browse the repository at this point in the history
…tion

EZP-30639: Used Content view instead of deprecated Location view
  • Loading branch information
lserwatka authored Feb 27, 2020
2 parents 7842f03 + 20a7a73 commit ba2bcf0
Showing 33 changed files with 102 additions and 75 deletions.
15 changes: 10 additions & 5 deletions src/bundle/Controller/ContentController.php
Original file line number Diff line number Diff line change
@@ -244,7 +244,8 @@ public function editAction(Request $request): Response
$contentInfo = $data->getContentInfo();

if (null !== $contentInfo) {
return $this->redirectToRoute('_ezpublishLocation', [
return $this->redirectToRoute('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
]);
}
@@ -284,7 +285,8 @@ public function updateMainLocationAction(Request $request): Response
'content'
);

return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
return new RedirectResponse($this->generateUrl('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
'_fragment' => 'ez-tab-location-view-locations',
]));
@@ -300,7 +302,8 @@ public function updateMainLocationAction(Request $request): Response
$contentInfo = $data->getContentInfo();

if (null !== $contentInfo) {
return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
return new RedirectResponse($this->generateUrl('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
'_fragment' => 'ez-tab-location-view-locations',
]));
@@ -381,7 +384,8 @@ public function updateMainTranslationAction(Request $request): Response
'content'
);

return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
return new RedirectResponse($this->generateUrl('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
'_fragment' => 'ez-tab-location-view-translations',
]));
@@ -394,7 +398,8 @@ public function updateMainTranslationAction(Request $request): Response
$data = $form->getData();
$contentInfo = $data->getContentInfo();
if (null !== $contentInfo) {
return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
return new RedirectResponse($this->generateUrl('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
'_fragment' => 'ez-tab-location-view-translations',
]));
3 changes: 2 additions & 1 deletion src/bundle/Controller/Controller.php
Original file line number Diff line number Diff line change
@@ -25,7 +25,8 @@ public function performAccessCheck()
*/
public function redirectToLocation(Location $location, string $uriFragment = ''): RedirectResponse
{
return $this->redirectToRoute('_ezpublishLocation', [
return $this->redirectToRoute('_ez_content_view', [
'contentId' => $location->contentId,
'locationId' => $location->id,
'_fragment' => $uriFragment,
]);
49 changes: 32 additions & 17 deletions src/bundle/Controller/LocationController.php
Original file line number Diff line number Diff line change
@@ -157,7 +157,8 @@ public function moveAction(Request $request): Response
'location'
);

return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
return new RedirectResponse($this->generateUrl('_ez_content_view', [
'contentId' => $location->contentId,
'locationId' => $location->id,
]));
});
@@ -167,7 +168,8 @@ public function moveAction(Request $request): Response
}
}

return $this->redirect($this->generateUrl('_ezpublishLocation', [
return $this->redirect($this->generateUrl('_ez_content_view', [
'contentId' => $location->contentId,
'locationId' => $location->id,
]));
}
@@ -213,7 +215,8 @@ public function copyAction(Request $request): Response
'location'
);

return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
return new RedirectResponse($this->generateUrl('_ez_content_view', [
'contentId' => $newLocation->contentId,
'locationId' => $newLocation->id,
]));
});
@@ -223,7 +226,8 @@ public function copyAction(Request $request): Response
}
}

return $this->redirect($this->generateUrl('_ezpublishLocation', [
return $this->redirect($this->generateUrl('_ez_content_view', [
'contentId' => $location->contentId,
'locationId' => $location->id,
]));
}
@@ -310,7 +314,8 @@ public function swapAction(Request $request): Response
'location'
);

return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
return new RedirectResponse($this->generateUrl('_ez_content_view', [
'contentId' => $currentLocation->contentId,
'locationId' => $newLocation->id,
'_fragment' => LocationsTab::URI_FRAGMENT,
]));
@@ -321,7 +326,8 @@ public function swapAction(Request $request): Response
}
}

return $this->redirect($this->generateUrl('_ezpublishLocation', [
return $this->redirect($this->generateUrl('_ez_content_view', [
'contentId' => $location->contentId,
'locationId' => $location->id,
'_fragment' => LocationsTab::URI_FRAGMENT,
]));
@@ -424,7 +430,8 @@ private function handleTrashLocationForm($data): RedirectResponse
)
);

return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
return new RedirectResponse($this->generateUrl('_ez_content_view', [
'contentId' => $parentLocation->contentId,
'locationId' => $parentLocation->id,
]));
}
@@ -462,7 +469,8 @@ public function removeAction(Request $request): Response
);
}

return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
return new RedirectResponse($this->generateUrl('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
'_fragment' => LocationsTab::URI_FRAGMENT,
]));
@@ -473,7 +481,8 @@ public function removeAction(Request $request): Response
}
}

return $this->redirect($this->generateUrl('_ezpublishLocation', [
return $this->redirect($this->generateUrl('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
'_fragment' => LocationsTab::URI_FRAGMENT,
]));
@@ -511,7 +520,8 @@ public function addAction(Request $request): Response
);
}

return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
return new RedirectResponse($this->generateUrl('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
'_fragment' => LocationsTab::URI_FRAGMENT,
]));
@@ -522,7 +532,8 @@ public function addAction(Request $request): Response
}
}

return $this->redirect($this->generateUrl('_ezpublishLocation', [
return $this->redirect($this->generateUrl('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
'_fragment' => LocationsTab::URI_FRAGMENT,
]));
@@ -610,19 +621,23 @@ public function updateAction(Request $request): Response
'location'
);

return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
'locationId' => $location->getContentInfo()->mainLocationId,
'_fragment' => DetailsTab::URI_FRAGMENT,
]));
return new RedirectResponse($this->generateUrl('_ez_content_view', [
'contentId' => $location->contentId,
'locationId' => $location->getContentInfo()->mainLocationId,
'_fragment' => DetailsTab::URI_FRAGMENT,
]));
});

if ($result instanceof Response) {
return $result;
}
}

return $this->redirect($this->generateUrl('_ezpublishLocation', [
'locationId' => $location->getContentInfo()->mainLocationId,
$contentInfo = $location->getContentInfo();

return $this->redirect($this->generateUrl('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
'_fragment' => DetailsTab::URI_FRAGMENT,
]));
}
3 changes: 2 additions & 1 deletion src/bundle/Controller/ObjectStateController.php
Original file line number Diff line number Diff line change
@@ -350,7 +350,8 @@ public function updateContentStateAction(
}
}

return $this->redirectToRoute('_ezpublishLocation', [
return $this->redirectToRoute('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
'_fragment' => 'ez-tab-location-view-details',
]);
11 changes: 8 additions & 3 deletions src/bundle/Controller/TranslationController.php
Original file line number Diff line number Diff line change
@@ -90,7 +90,10 @@ public function addAction(Request $request): Response
}

$redirectionUrl = null !== $location
? $this->generateUrl('_ezpublishLocation', ['locationId' => $location->id])
? $this->generateUrl('_ez_content_view', [
'contentId' => $location->contentId,
'locationId' => $location->id,
])
: $this->generateUrl('ezplatform.dashboard');

return $this->redirect($redirectionUrl);
@@ -127,7 +130,8 @@ public function removeAction(Request $request): Response
);
}

return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
return new RedirectResponse($this->generateUrl('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
'_fragment' => TranslationsTab::URI_FRAGMENT,
]));
@@ -138,7 +142,8 @@ public function removeAction(Request $request): Response
}
}

return $this->redirect($this->generateUrl('_ezpublishLocation', [
return $this->redirect($this->generateUrl('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
'_fragment' => TranslationsTab::URI_FRAGMENT,
]));
3 changes: 2 additions & 1 deletion src/bundle/Controller/User/UserDeleteController.php
Original file line number Diff line number Diff line change
@@ -91,7 +91,8 @@ public function userDeleteAction(Request $request): Response
'content'
);

return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
return new RedirectResponse($this->generateUrl('_ez_content_view', [
'contentId' => $location->contentId,
'locationId' => $location->parentLocationId,
]));
});
6 changes: 4 additions & 2 deletions src/bundle/Controller/VersionController.php
Original file line number Diff line number Diff line change
@@ -109,7 +109,8 @@ public function removeAction(Request $request): Response
'version'
);

return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
return new RedirectResponse($this->generateUrl('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
'_fragment' => VersionsTab::URI_FRAGMENT,
]));
@@ -120,7 +121,8 @@ public function removeAction(Request $request): Response
}
}

return $this->redirect($this->generateUrl('_ezpublishLocation', [
return $this->redirect($this->generateUrl('_ez_content_view', [
'contentId' => $contentInfo->id,
'locationId' => $contentInfo->mainLocationId,
'_fragment' => VersionsTab::URI_FRAGMENT,
]));
14 changes: 0 additions & 14 deletions src/bundle/Resources/config/routing.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
#
# System routes
#

_ezpublishLocation:
path: /content/location/{locationId}/{languageCode}/{viewType}/{layout}
options:
expose: true
defaults:
_controller: ez_content:viewLocation
viewType: full
layout: true
languageCode: null

#
# Dashboard
#
Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@
})
.catch(eZ.helpers.notification.showErrorNotification);
};
const generateLink = (locationId) => Routing.generate('_ezpublishLocation', { locationId });
const generateLink = (locationId, contentId) => Routing.generate('_ez_content_view', { contentId, locationId });
const setModalTableTitle = (title) => {
const modalTableTitleNode = doc.querySelector(`${SELECTOR_MODAL_BULK_ACTION_FAIL} .ez-table-header__headline`);

2 changes: 1 addition & 1 deletion src/bundle/Resources/public/js/scripts/cotf/create.js
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
const onConfirm = (items) => {
closeUDW();

global.location.href = Routing.generate('_ezpublishLocation', { locationId: items[0].id });
global.location.href = Routing.generate('_ez_content_view', { contentId: items[0].ContentInfo.Content._id, locationId: items[0].id });
};
const onCancel = () => closeUDW();
const openUDW = (event) => {
Original file line number Diff line number Diff line change
@@ -120,7 +120,8 @@
const previewAlt = preview.querySelector('.ez-field-edit-preview__image-alt input');
const previewActionPreview = preview.querySelector('.ez-field-edit-preview__action--preview');
const assetNameContainer = preview.querySelector('.ez-field-edit-preview__asset-name a');
const destinationLocationUrl = Routing.generate('_ezpublishLocation', {
const destinationLocationUrl = Routing.generate('_ez_content_view', {
contentId: destinationContentId,
locationId: destinationLocationId,
});

2 changes: 1 addition & 1 deletion src/bundle/Resources/public/js/scripts/udw/browse.js
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
const onConfirm = (items) => {
closeUDW();

global.location.href = Routing.generate('_ezpublishLocation', { locationId: items[0].id });
global.location.href = Routing.generate('_ez_content_view', { contentId: items[0].ContentInfo.Content._id, locationId: items[0].id });
};
const onCancel = () => closeUDW();
const openUDW = (event) => {
Original file line number Diff line number Diff line change
@@ -55,8 +55,8 @@
<use xlink:href="{{ ez_content_type_icon(bookmark.contentType.identifier) }}"></use>
</svg>
</td>
<td class="ez-table__cell ez-table__cell--name ez-table__cell--after-icon">
<a href="{{ path('_ezpublishLocation', { 'locationId': bookmark.id }) }}" title="{{ content_name }}">
<td class="ez-table__cell ez-table__cell--after-icon">
<a href="{{ path('_ez_content_view', { 'contentId': bookmark.contentInfo.id, 'locationId': bookmark.id }) }}">
{{ content_name }}
</a>
</td>
@@ -65,7 +65,7 @@
{% if bookmark.pathLocations|length > 1 %}
{% for location in bookmark.pathLocations %}
{% if loop.revindex > 1 %}
<a href="{{ path('_ezpublishLocation', {'locationId': location.id}) }}">
<a href="{{ path('_ez_content_view', { 'contentId': location.contentId, 'locationId': location.id}) }}">
{{ ez_content_name(location.contentInfo) }}
</a>
{% if loop.revindex > 2 %}/{% endif %}
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
<div class="ez-edit-header">
<div class="ez-edit-header__content-type-name">
{% block close_button %}
<a class="ez-content-edit-container__close" href="{{ path('_ezpublishLocation', {'locationId': parent_location.id}) }}">
<a class="ez-content-edit-container__close" href="{{ path('_ez_content_view', { 'contentId': parent_location.contentId, 'locationId': parent_location.id}) }}">
<svg class="ez-icon ez-icon--small-medium">
<use xlink:href="/bundles/ezplatformadminui/img/ez-icons.svg#discard"></use>
</svg>
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
<div class="ez-edit-header__content-type-name">
{% block close_button %}
{% set referrer_location = is_published ? location : parent_location %}
<a class="ez-content-edit-container__close" href="{{ path('_ezpublishLocation', {'locationId': referrer_location.id }) }}">
<a class="ez-content-edit-container__close" href="{{ path('_ez_content_view', { 'contentId': referrer_location.contentId, 'locationId': referrer_location.id }) }}">
<svg class="ez-icon ez-icon--small-medium">
<use xlink:href="/bundles/ezplatformadminui/img/ez-icons.svg#discard"></use>
</svg>
@@ -93,6 +93,7 @@
}) %}
{{ knp_menu_render(content_edit_sidebar_right, {'template': '@ezdesign/ui/menu/sidebar_right.html.twig'}) }}
{% endblock %}

{% block form_before %}
{{ ez_render_component_group('content-edit-form-before', {
'content': content,
Original file line number Diff line number Diff line change
@@ -36,7 +36,10 @@
{% if not loop.last %}
{% set items = items|merge([{
'value': ez_content_name(path_location.contentInfo),
'url': path('_ezpublishLocation', {'locationId': path_location.id})
'url': path('_ez_content_view', {
'contentId': path_location.contentId,
'locationId': path_location.id
})
}]) %}
{% endif %}
{% endfor %}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<td>
<a {% if not content.contentInfo.trashed %}
href="{{ path('_ezpublishLocation', { 'locationId': content.contentInfo.mainLocationId } ) }}"
href="{{ path('_ez_content_view', { 'contentId': content.id, 'locationId': content.contentInfo.mainLocationId } ) }}"
{% endif %}>
{{ content.getName() }}
{% if content.contentInfo.trashed %}
Loading

0 comments on commit ba2bcf0

Please # to comment.