CategorizationStep implementation

pull/10/head
Jens Pelzetter 2021-08-02 21:24:30 +02:00
parent 2dc82dff7c
commit 46d21adcea
7 changed files with 49 additions and 28 deletions

View File

@ -45,6 +45,7 @@ import javax.mvc.Models;
import javax.transaction.Transactional;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@ -147,16 +148,13 @@ public class CategorizationStep extends AbstractMvcAuthoringStep {
*
* @return A redirect to the categorization step.
*/
@MvcAuthoringAction(
method = MvcAuthoringActionMethod.POST,
path = "/domains/"
)
@POST
@Path("/domains/{domain}")
@Transactional(Transactional.TxType.REQUIRED)
public String updateCategorization(
@PathParam("domain")
final String domainParam,
@FormParam("assignedCategories")
@FormParam("assigned-categories")
final Set<String> assignedCategoriesParam
) {
try {
@ -249,6 +247,12 @@ public class CategorizationStep extends AbstractMvcAuthoringStep {
} catch (ObjectNotAssignedToCategoryException ex) {
throw new UnexpectedErrorException(ex);
}
if (!category.getSubCategories().isEmpty()) {
for(final Category subCategory : category.getSubCategories()) {
updateAssignedCategories(subCategory, assignedCategoriesParam);
}
}
}
/**

View File

@ -10,27 +10,37 @@
<div class="d-flex">
<c:if test="#{!node.subCategories.isEmpty()}">
<button aria-label="#{CmsDefaultStepsMessageBundle['categorization.tree.show_subcategories']}"
class="btn btn-light p-0 subfolders-toggler"
class="btn btn-light p-0 subcategories-toggler"
data-toggle="collapse"
data-target="##{node.categoryUuid}-subcategories"
data-target="#subcategories-#{node.categoryUuid}"
aria-expanded="#{node.subCategoryAssigned or isRoot ? 'true' : 'false'}"
aria-controls="#{node.categoryUuid}-subcategories"
aria-controls="subcategories-#{node.categoryUuid}"
type="button">
<span class="sr-only">#{CmsAdminMessages['categorization.tree.expand']}
</span>
</button>
</c:if>
<label class="form-check-label"
for="#{node.categoryUuid}">
#{node.title}
<c:choose>
<c:when test="#{node.title != null and !node.title.isBlank()}">
#{node.title}
</c:when>
<c:otherwise>
#{node.categoryName}
</c:otherwise>
</c:choose>
</label>
<input class="form-check-input"
id="#{node.categoryUuid}"
name="assigned-categories"
type="checkbox"
value="#{node.categoryUuid}" />
</div>
<c:if test="#{!node.subCategories.isEmpty()}">
<ul class="#{node.subCategoryAssigned or isRoot ? 'collapse' : 'collapse.show'} "
id="#{node.categoryUuid}-subcategories">
<ul class="#{node.assigned or isRoot ? 'collapse.show' : 'collapse'} "
id="subcategories-#{node.categoryUuid}">
<c:forEach items="#{node.subCategories}"
var="subCat">
<ui:include src="categorization-tree-node.xhtml">

View File

@ -11,7 +11,7 @@
var="tree">
<h2>#{tree.domainTitle}</h2>
<div class="d-flex">
<div class="d-flex mb-3">
<span>#{CmsDefaultStepsMessageBundle['categorization.system.assigned.to']}</span>
<button class="btn btn-primary"
data-target="#edit-categorization-#{tree.domainKey}"
@ -25,27 +25,28 @@
</div>
<div aria-labelledby="edit-categorization-#{tree.domainKey}-title"
aria-hidden="true"
class="modal fade"
class="modal modal-xl fade"
id="edit-categorization-#{tree.domainKey}"
tabindex="-1">
<div class="modal-dialog">
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@authoringSteps/categorization/#{tree.domainKey}"
<form action="#{mvc.basePath}/#{ContentSectionModel.sectionName}/documents/#{CmsSelectedDocumentModel.itemPath}/@categorization/domains/#{tree.domainKey}"
class="modal-content"
method="post">
<div class="modal-header">
<h3 class="modal-title"
id="edit-categorization-#{tree.domainKey}-title">
#{CmsDefaultStepsMessageBundle.getMessage('categorization.edit.title', [tree.domainKey, CmsSelectedDocumentModel.itemTitle])}
<button aria-label="#{CmsDefaultStepsMessageBundle['categorization.edit.cancel']}"
class="close"
data-dismiss="modal"
type="button">
<bootstrap:svgIcon icon="x-circle" />
</button>
</h3>
<button aria-label="#{CmsDefaultStepsMessageBundle['categorization.edit.cancel']}"
class="close"
data-dismiss="modal"
type="button">
<bootstrap:svgIcon icon="x-circle" />
</button>
</div>
<div class="modal-body">
<ul class="#{tree.root.subCategoryAssigned ? 'collapse' : 'collapse.show'} "
<div class="modal-body categorizationtree">
<ul class="#{tree.root.subCategoryAssigned ? 'collapse' : 'collapse.show'}"
id="#{node.categoryUuid}-subcategories">
<ui:include src="categorization-tree-node.xhtml">
<ui:param name="node"

View File

@ -532,3 +532,4 @@ videoasset.editstep.legelmetadata.remove.message=Are you sure to remove the lega
videoasset.editstep.legelmetadata.remove.submit=Remove legal metadata
videoasset.editstep.legelmetadata.rightsholder=Rights Holder
videoasset.editstep.legelmetadata.creator=Creator
categorization.tree.expand=Expand/Hide subcategories

View File

@ -532,3 +532,4 @@ videoasset.editstep.legelmetadata.remove.message=Sind Sie sicher, dass Sie die r
videoasset.editstep.legelmetadata.remove.submit=Rechtliche Informationen entfernen
videoasset.editstep.legelmetadata.rightsholder=Rechteinhaber
videoasset.editstep.legelmetadata.creator=K\u00fcnstler
categorization.tree.expand=Unterkategorien anzeigen/verbergen

View File

@ -35,6 +35,11 @@ $carousel-control-icon-width: 1.25rem;
$pre-scrollable-max-height: 21.25rem;
// Buttons used a sort handlers
button.btn.cms-sort-handle:hover {
cursor: move;
}
// Navbar default colors have insufficient contrast
$navbar-dark-color: #fff;
@ -46,7 +51,7 @@ nav ul .list-group-item.active ul .list-group-item a {
color: #007bff;
}
nav.foldertree,nav.categorytree {
nav.foldertree,nav.categorytree, div.categorizationtree {
& > ul.nav {
margin-left: 1em;
margin-right: 1em;
@ -125,4 +130,5 @@ table.wor{
td.del-col {
width: 9em;
}
}
}

View File

@ -1,6 +1,4 @@
@import "custom";
@import "../../../../node_modules/bootstrap/scss/bootstrap";
button.btn.cms-sort-handle:hover {
cursor: move;
}