Skip to content
Permalink
Browse files

Fix bad success url for image form

  • Loading branch information
lopes-vincent committed Dec 30, 2019
1 parent 39dc45f commit ac2eb1690a3980ca5edbf5813aea97f1e0ea70a7
@@ -310,7 +310,14 @@ public function getImageListAjaxAction($parentId, $parentType)
{
$this->checkAuth($this->getAdminResources()->getResource($parentType, static::MODULE_RIGHT), array(), AccessManager::UPDATE);
$this->checkXmlHttpRequest();
$args = array('imageType' => $parentType, 'parentId' => $parentId);

$successUrl = $this->getRequest()->get('successUrl');

$args = [
'imageType' => $parentType,
'parentId' => $parentId,
'successUrl' => $successUrl
];

return $this->render('includes/image-upload-list-ajax', $args);
}
@@ -344,7 +351,13 @@ public function getImageFormAjaxAction($parentId, $parentType)
{
$this->checkAuth($this->getAdminResources()->getResource($parentType, static::MODULE_RIGHT), array(), AccessManager::UPDATE);
$this->checkXmlHttpRequest();
$args = array('imageType' => $parentType, 'parentId' => $parentId);
$successUrl = $this->getRequest()->get('successUrl');

$args = [
'imageType' => $parentType,
'parentId' => $parentId,
'successUrl' => $successUrl
];

return $this->render('includes/image-upload-form', $args);
}
@@ -58,6 +58,9 @@ $(function($){
$.ajax({
type: "POST",
url: imageListUrl,
data: {
successUrl: imageSuccessUrl
},
statusCode: {
404: function() {
$imageListArea.html(
@@ -44,11 +44,15 @@
</div>
</form>

{if !$successUrl}
{$successUrl = {navigate to="current"}}
{/if}
<div class="existing-image">
{include file='includes/image-upload-list-ajax.html'
imageType=$imageType
parentId=$parentId
resource=$resource
successUrl=$successUrl
}
</div>

@@ -59,6 +63,7 @@
<script>
var imageDropZoneUrl = "{url path="/admin/image/type/%image/%id/save-ajax" image=$imageType id=$parentId}";
var imageListUrl = "{url path="/admin/image/type/%image/%id/list-ajax" image=$imageType id=$parentId}";
var imageSuccessUrl = "{$successUrl nofilter}";
var imageReorder = "{url path="/admin/image/type/%image/%id/update-position" image=$imageType id=$parentId}";
var imageListErrorMessage = "{intl l='Can\'t load images, please refresh this page.'}";
var imageReorderErrorMessage = "{intl l='Can\'t reorder images, please refresh this page.'}";
@@ -55,8 +55,11 @@
</div>
</div>

{if !$successUrl}
{$successUrl = {navigate to="current"}}
{/if}
<form method="POST" action="{url path="/admin/image/type/%image/%id/update-title" image=$imageType id=$ID}" class="clearfix">
<input type="hidden" name="success_url" value="{navigate to='current'}"/>
<input type="hidden" name="success_url" value="{$successUrl}"/>
<input type="hidden" name="locale" value="{$edit_language_locale}"/>

<div class="input-group">

0 comments on commit ac2eb16

Please sign in to comment.
You can’t perform that action at this time.