Some additional components

Former-commit-id: f2455c3160
pull/7/head
Jens Pelzetter 2020-11-16 20:32:04 +01:00
parent d44ad3c5d0
commit cb9a1f049d
4 changed files with 160 additions and 78 deletions

View File

@ -38,6 +38,7 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
import javax.mvc.Controller; import javax.mvc.Controller;
import javax.mvc.Models; import javax.mvc.Models;
import javax.mvc.MvcContext;
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;
@ -71,7 +72,7 @@ public class CategoriesController {
@Inject @Inject
private Models models; private Models models;
@GET @GET
@Path("/{categoryIdentifier}") @Path("/{categoryIdentifier}")
@AuthorizationRequired @AuthorizationRequired

View File

@ -0,0 +1,79 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:bootstrap="http://xmlns.jcp.org/jsf/composite/components/bootstrap"
xmlns:cc="http://xmlns.jcp.org/jsf/composite"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
<cc:interface shortDescription="Component for showing messages (org.libreccm.ui.Message).">
<cc:attribute name="actionTarget"
required="true"
shortDescription="URL to which the form is send." />
<cc:attribute name="buttonClass"
default="btn-secondary"
required="false"
shortDescription="Bootstrap button context class to use for the button toggleing the modal form, eg. button-info."
type="String" />
<cc:attribute name="buttonIcon"
default=""
required="false"
shortDescription="Name of the icon to use in the button. If empty no icon will be used."
type="String" />
<cc:attribute name="buttonText"
required="true"
shortDescription="Text for the button toggleing the modal form."
type="String" />
<cc:attribute name="buttonTextClass"
default=""
required="false"
shortDescription="Class used for aligning the button. Either text-left, text-center or text-right."
type="String" />
<cc:attribute name="dialogId"
required="true"
shortDescription="ID for the dialog."
type="String" />
<cc:attribute name="method"
default="post"
required="false"
shortDescription="Method used to send to form. Defaults to POST."
type="String" />
<cc:facet name="body" required="true" />
<cc:facet name="footer" required="true"/>
<cc:facet name="title" required="true" />
</cc:interface>
<cc:implementation>
<div class="#{cc.attrs.buttonTextClass}">
<button aria-labelledby="#{cc.attrs.dialogId}-title"
class="btn #{cc.attrs.buttonClass}"
data-target="##{cc.attrs.dialogId}"
data-toggle="modal"
type="button">
<c:if test="#{!cc.attrs.buttonIcon.isEmpty()}">
<bootstrap:svgIcon icon="#{cc.attrs.buttonIcon}" />
</c:if>
<span>#{cc.attrs.buttonText}</span>
</button>
</div>
<div class="modal fade"
data-backdrop="static"
id="#{cc.attrs.dialogId}"
tabindex="-1">
<div class="modal-dialog">
<form action="#{cc.attrs.actionTarget}"
class="modal-content"
method="#{cc.attrs.method}">
<div class="modal-header">
<div class="modal-title"
id="#{cc.attrs.dialogId}-title">
<cc:renderFacet name="title" />
</div>
</div>
<div class="modal-body">
<cc:renderFacet name="body" />
</div>
<div class="modal-footer">
<cc:renderFacet name="footer" />
</div>
</form>
</div>
</div>
</cc:implementation>
</html>

View File

@ -0,0 +1,21 @@
<!DOCTYPE html [<!ENTITY times '&#215;'>]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:cc="http://xmlns.jcp.org/jsf/composite"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
<cc:interface shortDescription="Component for showing messages (org.libreccm.ui.Message).">
<cc:attribute name="messages"
required="true"
shortDescription="The messages to show"
type="java.util.Collection" />
</cc:interface>
<cc:implementation>
<div>
<c:forEach items="#{cc.attrs.message}" var="message">
<div class="alert alert-#{message.messageTypeClass}"
role="alert">
#{message.message}
</div>
</c:forEach>
</div>
</cc:implementation>
</html>

View File

@ -4,7 +4,8 @@
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm" xmlns:libreccm="http://xmlns.jcp.org/jsf/composite/components/libreccm"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<ui:composition template="/WEB-INF/views/org/libreccm/ui/admin/ccm-admin.xhtml"> <ui:composition template="/WEB-INF/views/org/libreccm/ui/admin/ccm-admin.xhtml">
<ui:param name="activePage" value="categories" /> <ui:param name="activePage" value="categories" />
@ -25,6 +26,8 @@
<div class="container"> <div class="container">
<h1>#{AdminMessages.getMessage('categorysystems.details.title', [CategorySystemDetailsModel.domainKey])}</h1> <h1>#{AdminMessages.getMessage('categorysystems.details.title', [CategorySystemDetailsModel.domainKey])}</h1>
<libreccm:messages messages="#{CategorySystemDetailsModel.messages}" />
<dl> <dl>
<div> <div>
<dt> <dt>
@ -154,82 +157,60 @@
#{AdminMessages['categorysystems.details.owners.heading']} #{AdminMessages['categorysystems.details.owners.heading']}
</h2> </h2>
<div class="mb-2"> <div class="mb-2">
<div class="text-right"> <bootstrap:modalForm actionTarget="#{mvc.uri('CategorySystemsController#addOwner', {'categorySystemIdentifier': CategorySystemDetailsModel.identifier })}"
<button class="btn btn-secondary" buttonIcon="plus-circle"
data-target="#categorysystem-owner-add" buttonText="#{AdminMessages['categorysystems.details.owners.add']}"
data-toggle="modal" buttonTextClass="text-right"
type="button"> dialogId="categorysystem-owner-add">
<bootstrap:svgIcon icon="plus-circle" /> <f:facet name="title">
<span>#{AdminMessages['categorysystems.details.owners.add']}</span> <h3>#{AdminMessages['categorysstems.details.owner.add.dialog.title']}</h3>
</button> </f:facet>
</div> <f:facet name="body">
<div class="modal fade" <div class="form-group">
data-backdrop="static" <label for="categorysystem-owner-add-application">
id="categorysystem-owner-add" #{AdminMessages['categorysystems.details.owner.add.dialog.application.label']}
tabindex="-1"> </label>
<div class="modal-dialog"> <select aria-describedby="categorysystem-owner-add-application-help"
<form action="#{mvc.uri('CategorySystemsController#addOwner', {'categorySystemIdentifier': CategorySystemDetailsModel.identifier })}" id="categorysystem-owner-add-appliaction"
class="modal-content" name="applicationUuid"
method="post"> required="true"
<div class="modal-header"> size="1">
<h3 class="modal-title"> <c:forEach items="#{CategorySystemDetailsModel.ownerOptions}" var="application">
#{AdminMessages['categorysstems.details.owner.add.dialog.title']} <option value="#{application.applicationUuid}">
</h3> #{application.applicationName}
<button aria-label="#{AdminMessages['categorysystems.details.owner.add.dialog.close']}" </option>
class="close" </c:forEach>
data-dismiss="modal" </select>
type="button"> <small class="form-text text-muted"
<span aria-hidden="true">&times;</span> id="categorysystem-owner-add-application-help">
</button> #{AdminMessages['categorysystems.details.owner.add.dialog.application.help']}
</div> </small>
<div class="modal-body"> </div>
<div class="form-group"> <div class="form-group">
<label for="categorysystem-owner-add-application"> <label for="categorysystem-owner-add-context">
#{AdminMessages['categorysystems.details.owner.add.dialog.application.label']} #{AdminMessages['categorysystems.details.owner.add.dialog.context.label']}
</label> </label>
<select aria-describedby="categorysystem-owner-add-application-help" <input aria-describedby="categorysystem-owner-add-context-help"
id="categorysystem-owner-add-appliaction" id="categorysystem-owner-add-context"
name="applicationUuid" name="context"
required="true" type="text" />
size="1"> <small class="form-text text-muted"
<c:forEach items="#{CategorySystemDetailsModel.ownerOptions}" var="application"> id="categorysystem-owner-add-context-help">
<option value="#{application.applicationUuid}"> #{AdminMessages['categorysystems.details.owner.add.dialog.context.help']}
#{application.applicationName} </small>
</option> </div>
</c:forEach> </f:facet>
</select> <f:facet name="footer">
<small class="form-text text-muted" <button class="btn btn-secondary"
id="categorysystem-owner-add-application-help"> data-dismiss="modal"
#{AdminMessages['categorysystems.details.owner.add.dialog.application.help']} type="button" >
</small> #{AdminMessages['categorysystems.details.owner.add.dialog.close']}
</div> </button>
<div class="form-group"> <button type="submit" class="btn btn-primary">
<label for="categorysystem-owner-add-context"> #{AdminMessages['categorysystems.details.owner.add.dialog.submit']}
#{AdminMessages['categorysystems.details.owner.add.dialog.context.label']} </button>
</label> </f:facet>
<input aria-describedby="categorysystem-owner-add-context-help" </bootstrap:modalForm>
id="categorysystem-owner-add-context"
name="context"
type="text" />
<small class="form-text text-muted"
id="categorysystem-owner-add-context-help">
#{AdminMessages['categorysystems.details.owner.add.dialog.context.help']}
</small>
</div>
<div class="modal-footer">
<button class="btn btn-secondary"
data-dismiss="modal"
type="button" >
#{AdminMessages['categorysystems.details.owner.add.dialog.close']}
</button>
<button type="submit" class="btn btn-primary">
#{AdminMessages['categorysystems.details.owner.add.dialog.submit']}
</button>
</div>
</div>
</form>
</div>
</div>
</div> </div>
<c:choose> <c:choose>
<c:when test="#{CategorySystemDetailsModel.getOwners().isEmpty()}"> <c:when test="#{CategorySystemDetailsModel.getOwners().isEmpty()}">