更改页面中心的咆哮位置

时间:2017-06-30 10:58:54

标签: primefaces jsf-2.2 growl

我使用的是jsf2.2 primefaces 6.0,我已经实现了一个带有growl的登录界面,以显示身份验证的失败。现在的问题是我想在网页的中心而不是右上方显示咆哮,以获得更好的人体工程学结果。

xhtml代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:jsf="http://xmlns.jcp.org/jsf"
    xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
    xmlns:p="http://primefaces.org/ui"
    template="/facelets/templateLogin.xhtml">
    <ui:define name="pageTitle">Please login ...</ui:define>
    <ui:define name="content">


        <div id="login-box" class="login-box visible widget-box no-border">
            <div class="widget-body">

                <div class="widget-main">

                    <h4 class="header blue lighter bigger">




                        <i class="fa fa-sign-in"></i> Entrer vos informations
                    </h4>

                    <div class="space-6"></div>

                    <div class="space-6"></div>
                    <div class="space-6"></div>

                    <h:form id="loginFormId">
                        <h:panelGrid id="grid"  cellpadding="5">
                        <p:growl id="growl" showDetail="true" sticky="true" />

                            <fieldset>
                                <label class="block clearfix"> <span
                                    class="block input-icon input-icon-right" > <p:inputText title="Entrer votre matricule"
                                            id="Matricule" value="#{identity.user.matricule}" required="true"
                                            class="form-control" pt:placeholder="Matricule" /><i
                                        class="ace-icon fa fa-user" /> <p:message for="Matricule" display="tooltip" />
                                </span>
                                </label> <label class="block clearfix" id="labelPassword"> <span
                                    class="block input-icon input-icon-right"> <p:password title="Entrer votre mot de passe"
                                            id="password" pt:placeholder="Mot de passe" required="true"
                                            value="#{identity.user.password}" styleClass="form-control" />
                                        <p:message for="password" display="tooltip" /> <i
                                        class="ace-icon fa fa-lock"></i>
                                </span>
                                </label>

                                <div class="space"></div>

                                <div class="clearfix">
                                    <!--  
                            <h:commandButton id="loginResetId"
                                styleClass=" width-35 pull-right btn btn-sm
                                btn-primary bigger-110"
                                value="Logout" action="#{auth.doLogOut()}">
                            </h:commandButton>
                            -->
                                    <button type="submit" jsf:action="#{identity.doLogin()}"
                                        class="width-35 pull-right btn btn-sm btn-primary">
                                        <i class="ace-icon fa fa-key"></i> <span class="bigger-110">S'identifier</span>
                                    </button>
                                    <br></br> <br></br>
                                    <h:panelGrid
                                        rendered="#{not empty authentificationBean.message}">
                                        <div class="alert alert-danger">

                                            #{authentificationBean.message} <br />
                                        </div>

                                    </h:panelGrid>
                                </div>
                            <h:outputLink id="pdfLink" value="http://localhost:18080/openCars/pdf/tableauAssurance.pdf" style="color: #000000;text-decoration: underline"><h5><b>Annexe à l'avenant</b></h5></h:outputLink>
                            <p:tooltip id="toolTipTrack" for="pdfLink" value="Télécharger l'annexe de l'avenant" trackMouse="true" />   
                                <div class="space-4"></div>
                            </fieldset>
                        </h:panelGrid>
                    </h:form>
                    <!--  
                <div class="social-or-login center">
                    <span class="bigger-110">Or Login Using</span>
                </div>

                <div class="space-6"></div>

                <div class="social-login center">
                    <a class="btn btn-primary"> <i class="ace-icon fa fa-facebook"></i>
                    </a> <a class="btn btn-info"> <i class="ace-icon fa fa-twitter"></i>
                    </a> <a class="btn btn-danger"> <i
                        class="ace-icon fa fa-google-plus"></i>
                    </a>
                </div>
                -->
                </div>
                <!-- /.widget-main -->
                <h:form id="loginNavId">
                    <div class="toolbar clearfix">
                        <div></div>


                    </div>
                </h:form>
            </div>
            <!-- /.widget-body -->
        </div>
        <!-- /.login-box -->
    </ui:define>
</ui:composition>

1 个答案:

答案 0 :(得分:1)

您可以在页面中包含这条CSS以使咆哮:

div.ui-growl {
   left: 50%;
   right: 0;
   margin-left:-150px;
}