Incluido selector de tema de primefaces en pagina de bienvenida (home).

* El tema seleccionado se conserva durante la sesión.
* Ya se muestran los iconos de primefaces para el tema seleccionado.
This commit is contained in:
mgarcianun
2019-11-28 19:19:57 +01:00
parent 8fcc5d7697
commit c460c6125c
10 changed files with 69 additions and 40 deletions

View File

@@ -25,7 +25,7 @@
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>aristo</param-value>
<param-value>#{sessionPreferences.currentTheme}</param-value>
</context-param>
<!-- JSF mapping -->

View File

@@ -7,7 +7,7 @@
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>MyHealth Online Services</title>
<h:outputStylesheet name="primeicons/primeicons.css" library="primefaces"/>
<h:outputStylesheet name="primeicons/primeicons.css" library="primefaces" />
<h:outputStylesheet library="css" name="estilos.css" />
</h:head>
<h:outputScript>
@@ -24,12 +24,14 @@
<h:body>
<div id="layout">
<div id="top" class="top">
<h1 class="Titulo">myHealth Site</h1>
<!-- <h1 class="Titulo">myHealth Site</h1> -->
<h:graphicImage library="images" name="logo-small.png" />
</div>
<hr />
<div id="menuDiv">
<h:form>
<p:growl id="messages" sticky="true" showDetail="true" life="3000" />
<p:menubar>
<p:menuitem label="Home" icon="pi pi-home" outcome="home" />
<p:submenu label="Administración del sistema" icon="pi pi-briefcase">

View File

@@ -10,12 +10,15 @@
<ui:composition template="./header.xhtml">
<ui:define name="content">
<h:form>
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
<p:panel header="Pagina principal">
<p:panelGrid>
<p:outputLabel for="basic" value="Cambio de tema" />
<p:themeSwitcher id="basic" style="width:165px">
<p:outputLabel for="selectorTema" value="Cambio de tema" />
<p:themeSwitcher id="selectorTema" style="width:165px" value="#{sessionPreferences.currentTheme}">
<f:selectItem itemLabel="Seleccione un tema" itemValue="" noSelectionOption="true" />
<f:selectItems value="#{home.themes}" var="theme" itemLabel="#{theme.displayName}" itemValue="#{theme.name}" />
<p:ajax listener="#{sessionPreferences.updateCurrentTheme}" />
</p:themeSwitcher>
</p:panelGrid>
<h:panelGrid columns="2">
@@ -31,6 +34,13 @@
</h:panelGrid>
</h:panelGroup>
</p:panel>
<p:panel>
<h:panelGroup>
<h:panelGrid columns="1">
<p:commandButton value="Usar tema en este sesión" update="mesgs" action="#{sessionPreferences.updateCurrentTheme}" icon="pi pi-save" />
</h:panelGrid>
</h:panelGroup>
</p:panel>
</h:form>
</ui:define>
</ui:composition>

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB