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.mvc.Controller;
import javax.mvc.Models;
import javax.mvc.MvcContext;
import javax.transaction.Transactional;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;

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