Skip to content
ucd_editor.xhtml 5.64 KiB
Newer Older
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:composite="http://java.sun.com/jsf/composite"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

    <composite:interface>
    </composite:interface>

    <composite:implementation>
        <div class="modal fade" tabindex="-1" role="dialog" id="ucd-editor">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&#215;</span></button>
                        <h4 class="modal-title">Custom UCDs</h4>
                    </div>
                    <h:panelGroup class="modal-body" layout="block" id="ucd-editor-body" rendered="#{ucdEditor.customUCDs ne null and ucdEditor.newUCDConfiguration ne null}">
                        <h:selectOneRadio value="#{ucdEditor.viewExisting}">
                            <f:selectItem itemValue="#{true}" itemLabel="View existing" />
                            <f:selectItem itemValue="#{false}" itemLabel="Add new" />
                            <f:ajax execute="ucd-editor-body" render="ucd-editor-body" />
                        </h:selectOneRadio>
                        <br/>
                        <h:panelGroup rendered="#{ucdEditor.viewExisting}">
                            <h:panelGroup rendered="#{ucdEditor.customUCDs.size() eq 0}">
                                <p>No custom UCD inserted yet.</p>
                            </h:panelGroup>
                            <h:panelGroup rendered="#{ucdEditor.customUCDs.size() gt 0}">
                                <ul>
                                    <ui:repeat value="#{ucdEditor.customUCDs}" var="ucd" varStatus="loop">
                                        <li>
                                            <h:commandLink class="text-danger" action="#{ucdEditor.removeUCD(ucd)}">
                                                &#215;
                                                <ui:remove>
                                                    <!-- Note: due to a strange JSF bug following render attribute needs complete component id reference -->
                                                </ui:remove>
                                                <f:ajax execute="ucd-editor-body" render="main:ucd-editor:ucd-editor-body" />
                                            </h:commandLink>
                                            [#{ucd.code}] <span title="#{ucd.description}">#{ucd.word}</span>
                                        </li>
                                    </ui:repeat>
                                </ul>
                            </h:panelGroup>
                        </h:panelGroup>
                        <h:panelGroup rendered="#{!ucdEditor.viewExisting}" layout="block" class="form-horizontal">
                            <div class="form-group">
                                <h:outputLabel for="new-ucd-syntax" class="control-label col-xs-3">Syntax</h:outputLabel>
                                <div class="col-xs-8">
                                    <h:selectOneMenu value="#{ucdEditor.newUCDConfiguration.syntax}" class="form-control" id="new-ucd-syntax">
                                        <f:selectItem itemValue="BOTH" />
                                        <f:selectItem itemValue="PRIMARY" />
                                        <f:selectItem itemValue="SECONDARY" />
                                        <f:selectItem itemValue="PHOT_QUANTITY" />
                                        <f:selectItem itemValue="COLOUR" />
                                        <f:selectItem itemValue="VECTOR" />
                                    </h:selectOneMenu>
                                </div>
                            </div>
                            <div class="form-group">
                                <h:outputLabel for="new-ucd-word" class="control-label col-xs-3">Word</h:outputLabel>
                                <div class="col-xs-8">
                                    <h:inputText id="new-ucd-word" class="form-control" value="#{ucdEditor.newUCDConfiguration.word}" />
                                    <h:panelGroup class="text-danger" rendered="#{ucdEditor.invalidUCDMessage ne null}">#{ucdEditor.invalidUCDMessage}</h:panelGroup>
                                </div>
                            </div>
                            <div class="form-group">
                                <h:outputLabel for="new-ucd-description" class="control-label col-xs-3">Description</h:outputLabel>
                                <div class="col-xs-8">
                                    <h:inputText id="new-ucd-description" class="form-control" value="#{ucdEditor.newUCDConfiguration.description}" />
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-xs-8 col-xs-offset-3 text-center">
                                    <h:commandLink action="#{ucdEditor.addUCD()}" class="btn btn-success">
                                        Add new UCD
                                        <f:ajax execute="@form" render="ucd-editor-body" />
                                    </h:commandLink>
                                </div>
                            </div>
                        </h:panelGroup>
                    </h:panelGroup>
                </div>
            </div>
        </div>
    </composite:implementation>
</html>