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.transaction.Transactional;
import javax.ws.rs.FormParam; import javax.ws.rs.FormParam;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
@ -147,16 +148,13 @@ public class CategorizationStep extends AbstractMvcAuthoringStep {
* *
* @return A redirect to the categorization step. * @return A redirect to the categorization step.
*/ */
@MvcAuthoringAction( @POST
method = MvcAuthoringActionMethod.POST,
path = "/domains/"
)
@Path("/domains/{domain}") @Path("/domains/{domain}")
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public String updateCategorization( public String updateCategorization(
@PathParam("domain") @PathParam("domain")
final String domainParam, final String domainParam,
@FormParam("assignedCategories") @FormParam("assigned-categories")
final Set<String> assignedCategoriesParam final Set<String> assignedCategoriesParam
) { ) {
try { try {
@ -249,6 +247,12 @@ public class CategorizationStep extends AbstractMvcAuthoringStep {
} catch (ObjectNotAssignedToCategoryException ex) { } catch (ObjectNotAssignedToCategoryException ex) {
throw new UnexpectedErrorException(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"> <div class="d-flex">
<c:if test="#{!node.subCategories.isEmpty()}"> <c:if test="#{!node.subCategories.isEmpty()}">
<button aria-label="#{CmsDefaultStepsMessageBundle['categorization.tree.show_subcategories']}" <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-toggle="collapse"
data-target="##{node.categoryUuid}-subcategories" data-target="#subcategories-#{node.categoryUuid}"
aria-expanded="#{node.subCategoryAssigned or isRoot ? 'true' : 'false'}" aria-expanded="#{node.subCategoryAssigned or isRoot ? 'true' : 'false'}"
aria-controls="#{node.categoryUuid}-subcategories" aria-controls="subcategories-#{node.categoryUuid}"
type="button"> type="button">
<span class="sr-only">#{CmsAdminMessages['categorization.tree.expand']}
</span>
</button> </button>
</c:if> </c:if>
<label class="form-check-label" <label class="form-check-label"
for="#{node.categoryUuid}"> for="#{node.categoryUuid}">
<c:choose>
<c:when test="#{node.title != null and !node.title.isBlank()}">
#{node.title} #{node.title}
</c:when>
<c:otherwise>
#{node.categoryName}
</c:otherwise>
</c:choose>
</label> </label>
<input class="form-check-input" <input class="form-check-input"
id="#{node.categoryUuid}" id="#{node.categoryUuid}"
name="assigned-categories"
type="checkbox" type="checkbox"
value="#{node.categoryUuid}" /> value="#{node.categoryUuid}" />
</div> </div>
<c:if test="#{!node.subCategories.isEmpty()}"> <c:if test="#{!node.subCategories.isEmpty()}">
<ul class="#{node.subCategoryAssigned or isRoot ? 'collapse' : 'collapse.show'} " <ul class="#{node.assigned or isRoot ? 'collapse.show' : 'collapse'} "
id="#{node.categoryUuid}-subcategories"> id="subcategories-#{node.categoryUuid}">
<c:forEach items="#{node.subCategories}" <c:forEach items="#{node.subCategories}"
var="subCat"> var="subCat">
<ui:include src="categorization-tree-node.xhtml"> <ui:include src="categorization-tree-node.xhtml">

View File

@ -11,7 +11,7 @@
var="tree"> var="tree">
<h2>#{tree.domainTitle}</h2> <h2>#{tree.domainTitle}</h2>
<div class="d-flex"> <div class="d-flex mb-3">
<span>#{CmsDefaultStepsMessageBundle['categorization.system.assigned.to']}</span> <span>#{CmsDefaultStepsMessageBundle['categorization.system.assigned.to']}</span>
<button class="btn btn-primary" <button class="btn btn-primary"
data-target="#edit-categorization-#{tree.domainKey}" data-target="#edit-categorization-#{tree.domainKey}"
@ -25,27 +25,28 @@
</div> </div>
<div aria-labelledby="edit-categorization-#{tree.domainKey}-title" <div aria-labelledby="edit-categorization-#{tree.domainKey}-title"
aria-hidden="true" aria-hidden="true"
class="modal fade" class="modal modal-xl fade"
id="edit-categorization-#{tree.domainKey}" id="edit-categorization-#{tree.domainKey}"
tabindex="-1"> tabindex="-1">
<div class="modal-dialog"> <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" class="modal-content"
method="post"> method="post">
<div class="modal-header"> <div class="modal-header">
<h3 class="modal-title" <h3 class="modal-title"
id="edit-categorization-#{tree.domainKey}-title"> id="edit-categorization-#{tree.domainKey}-title">
#{CmsDefaultStepsMessageBundle.getMessage('categorization.edit.title', [tree.domainKey, CmsSelectedDocumentModel.itemTitle])} #{CmsDefaultStepsMessageBundle.getMessage('categorization.edit.title', [tree.domainKey, CmsSelectedDocumentModel.itemTitle])}
</h3>
<button aria-label="#{CmsDefaultStepsMessageBundle['categorization.edit.cancel']}" <button aria-label="#{CmsDefaultStepsMessageBundle['categorization.edit.cancel']}"
class="close" class="close"
data-dismiss="modal" data-dismiss="modal"
type="button"> type="button">
<bootstrap:svgIcon icon="x-circle" /> <bootstrap:svgIcon icon="x-circle" />
</button> </button>
</h3>
</div> </div>
<div class="modal-body"> <div class="modal-body categorizationtree">
<ul class="#{tree.root.subCategoryAssigned ? 'collapse' : 'collapse.show'} " <ul class="#{tree.root.subCategoryAssigned ? 'collapse' : 'collapse.show'}"
id="#{node.categoryUuid}-subcategories"> id="#{node.categoryUuid}-subcategories">
<ui:include src="categorization-tree-node.xhtml"> <ui:include src="categorization-tree-node.xhtml">
<ui:param name="node" <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.remove.submit=Remove legal metadata
videoasset.editstep.legelmetadata.rightsholder=Rights Holder videoasset.editstep.legelmetadata.rightsholder=Rights Holder
videoasset.editstep.legelmetadata.creator=Creator 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.remove.submit=Rechtliche Informationen entfernen
videoasset.editstep.legelmetadata.rightsholder=Rechteinhaber videoasset.editstep.legelmetadata.rightsholder=Rechteinhaber
videoasset.editstep.legelmetadata.creator=K\u00fcnstler 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; $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 default colors have insufficient contrast
$navbar-dark-color: #fff; $navbar-dark-color: #fff;
@ -46,7 +51,7 @@ nav ul .list-group-item.active ul .list-group-item a {
color: #007bff; color: #007bff;
} }
nav.foldertree,nav.categorytree { nav.foldertree,nav.categorytree, div.categorizationtree {
& > ul.nav { & > ul.nav {
margin-left: 1em; margin-left: 1em;
margin-right: 1em; margin-right: 1em;
@ -126,3 +131,4 @@ table.wor{
width: 9em; width: 9em;
} }
} }

View File

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