Skip to content

Commit

Permalink
EZP-30639: Used Content view instead of deprecated Location view
Browse files Browse the repository at this point in the history
  • Loading branch information
Nattfarinn committed Feb 5, 2020
1 parent d7df11d commit ca90f01
Show file tree
Hide file tree
Showing 32 changed files with 99 additions and 73 deletions.
15 changes: 10 additions & 5 deletions src/bundle/Controller/ContentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
}
Expand Down Expand Up @@ -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',
]));
Expand All @@ -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',
]));
Expand Down Expand Up @@ -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',
]));
Expand All @@ -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',
]));
Expand Down
3 changes: 2 additions & 1 deletion src/bundle/Controller/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
Expand Down
49 changes: 32 additions & 17 deletions src/bundle/Controller/LocationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]));
});
Expand All @@ -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,
]));
}
Expand Down Expand Up @@ -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' => $location->contentId,
'locationId' => $newLocation->id,
]));
});
Expand All @@ -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,
]));
}
Expand Down Expand Up @@ -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' => $newLocation->contentId,
'locationId' => $newLocation->id,
'_fragment' => LocationsTab::URI_FRAGMENT,
]));
Expand All @@ -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,
]));
Expand Down Expand Up @@ -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,
]));
}
Expand Down Expand Up @@ -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,
]));
Expand All @@ -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,
]));
Expand Down Expand Up @@ -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,
]));
Expand All @@ -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,
]));
Expand Down Expand Up @@ -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,
]));
}
Expand Down
3 changes: 2 additions & 1 deletion src/bundle/Controller/ObjectStateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]);
Expand Down
11 changes: 8 additions & 3 deletions src/bundle/Controller/TranslationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
]));
Expand All @@ -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,
]));
Expand Down
3 changes: 2 additions & 1 deletion src/bundle/Controller/User/UserDeleteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]));
});
Expand Down
6 changes: 4 additions & 2 deletions src/bundle/Controller/VersionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]));
Expand All @@ -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,
]));
Expand Down
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
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
})
.catch(eZ.helpers.notification.showErrorNotification);
};
const generateLink = (locationId) => Routing.generate('_ezpublishLocation', { locationId });
const generateLink = (contentId, locationId) => Routing.generate('_ez_content_view', { contentId, locationId });
const setModalTableTitle = (title) => {
const modalTableTitleNode = doc.querySelector(`${SELECTOR_MODAL_BULK_ACTION_FAIL} .ez-table-header__headline`);

Expand Down
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
Expand Up @@ -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].contentId, locationId: items[0].id });
};
const onCancel = () => closeUDW();
const openUDW = (event) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});

Expand Down
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
Expand Up @@ -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].contentId, locationId: items[0].id });
};
const onCancel = () => closeUDW();
const openUDW = (event) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@
<use xlink:href="{{ ez_content_type_icon(bookmark.contentType.identifier) }}"></use>
</svg>
</td>
<td class="ez-table__cell ez-table__cell--after-icon"><a href="{{ path('_ezpublishLocation', { 'locationId': bookmark.id }) }}">{{ ez_content_name(bookmark.contentInfo) }}</a></td>
<td class="ez-table__cell ez-table__cell--after-icon"><a href="{{ path('_ez_content_view', { 'contentId': bookmark.contentInfo.id, 'locationId': bookmark.id }) }}">{{ ez_content_name(bookmark.contentInfo) }}</a></td>
<td class="ez-table__cell">{{ bookmark.contentType.name }}</td>
<td class="ez-table__cell">
{% 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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{% endblock %}

{% block close_button %}
<a class="ez-content-edit-container__close" href="{{ path('_ezpublishLocation', {'locationId': parent_location.id}) }}"></a>
<a class="ez-content-edit-container__close" href="{{ path('_ez_content_view', { 'contentId': parent_location.contentId, 'locationId': parent_location.id}) }}"></a>
{% endblock %}

{% block form_before %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

{% 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>
<a class="ez-content-edit-container__close" href="{{ path('_ez_content_view', { 'contentId': referrer_location.contentId, 'locationId': referrer_location.id }) }}"></a>
{% endblock %}

{% block form_before %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<form class="form-inline ez-content-preview-collapse collapse show">
<select class="form-control ez-location-language-change">
{% for language in languages %}
<option value="{{ path('_ezpublishLocation', {'locationId': location.id, 'languageCode': language.languageCode}) }}"
<option value="{{ path('_ez_content_view', { 'contentId': location.contentId, 'locationId': location.id, 'languageCode': language.languageCode}) }}"
{% if current_language == language.languageCode %} selected="selected" {% endif %}
>{{ language.name }}</option>
{% endfor %}
Expand Down
Loading

0 comments on commit ca90f01

Please sign in to comment.