Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

LPS-123673 Create specific url for "Save and Add new One" Action instead of relying on currentURL which doesn't work in cases like edit #2941

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -105,6 +105,27 @@ public AssetCategoriesDisplayContext(
WebKeys.THEME_DISPLAY);
}

public String getAddCategoryRedirect() throws PortalException {
PortletURL addCategoryURL = _renderResponse.createRenderURL();

addCategoryURL.setParameter("mvcPath", "/edit_category.jsp");

long parentCategoryId = BeanParamUtil.getLong(
getCategory(), _httpServletRequest, "parentCategoryId");

if (parentCategoryId > 0) {
addCategoryURL.setParameter(
"parentCategoryId", String.valueOf(parentCategoryId));
}

if (getVocabularyId() > 0) {
addCategoryURL.setParameter(
"vocabularyId", String.valueOf(getVocabularyId()));
}

return addCategoryURL.toString();
}

public String getAssetType(AssetVocabulary vocabulary)
throws PortalException {

Expand Down
Expand Up @@ -254,7 +254,7 @@ renderResponse.setTitle(title);
<aui:script>
function <portlet:namespace />saveAndAddNew() {
document.querySelector('#<portlet:namespace />redirect').value =
'<%= currentURL %>';
'<%= assetCategoriesDisplayContext.getAddCategoryRedirect() %>';

submitForm(document.querySelector('#<portlet:namespace />fm'));
}
Expand Down