Commit 64ced6ee by Juho Salli

jotain

1 parent 267cc600
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<h:body> <h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml"> <ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata> <f:metadata>
<!-- <f:event type="preRenderView" listener="#{votingCompoListView.initView}" /> --> <f:event type="preRenderView" listener="#{votingCompoListView.initView()}" />
</f:metadata> </f:metadata>
<ui:define name="content"> <ui:define name="content">
<h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" /> <h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" />
...@@ -33,14 +33,14 @@ ...@@ -33,14 +33,14 @@
</f:facet> </f:facet>
<h:outputText value="#{compo.description}" /> <h:outputText value="#{compo.description}" />
</h:column> </h:column>
<h:column> <h:column rendered="#{votingCompoListView.curEntries}">
<f:facet name="header"> <f:facet name="header">
<h:outputText value="current entries" /> <h:outputText value="current entries" />
</f:facet> </f:facet>
<h:outputText value="#{compo.compoEntries.size()}" /> <h:outputText value="#{compo.compoEntries.size()}" />
</h:column> </h:column>
<h:column> <h:column rendered="#{votingCompoListView.maxParts}">
<f:facet name="header" > <f:facet name="header">
<h:outputText value="Max parts" /> <h:outputText value="Max parts" />
</f:facet> </f:facet>
<h:outputText value="#{compo.maxParticipantCount}" /> <h:outputText value="#{compo.maxParticipantCount}" />
......
...@@ -4,12 +4,17 @@ import java.util.List; ...@@ -4,12 +4,17 @@ import java.util.List;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.faces.bean.ManagedBean;
import javax.inject.Named; import javax.inject.Named;
import fi.insomnia.bortal.beans.VotingBeanLocal; import fi.insomnia.bortal.beans.VotingBeanLocal;
import fi.insomnia.bortal.model.Compo; import fi.insomnia.bortal.model.Compo;
import fi.insomnia.bortal.model.Role;
import fi.insomnia.bortal.web.cdiview.GenericCDIView; import fi.insomnia.bortal.web.cdiview.GenericCDIView;
import fi.insomnia.bortal.enums.apps.CompoPermission;
@ManagedBean
@Named @Named
@RequestScoped @RequestScoped
public class VotingCompoListView extends GenericCDIView { public class VotingCompoListView extends GenericCDIView {
...@@ -18,12 +23,43 @@ public class VotingCompoListView extends GenericCDIView { ...@@ -18,12 +23,43 @@ public class VotingCompoListView extends GenericCDIView {
@EJB @EJB
private VotingBeanLocal votbean; private VotingBeanLocal votbean;
private Role role;
boolean curEntries;
boolean maxParts;
public boolean isCurEntries() {
return curEntries;
}
public void setCurEntries(boolean curEntries) {
this.curEntries = curEntries;
}
boolean curEntries = false; public boolean isMaxParts() {
boolean maxParts = false; return maxParts;
}
public void setMaxParts(boolean maxParts) {
this.maxParts = maxParts;
}
public List<Compo> getCompos() { public List<Compo> getCompos() {
return votbean.getCompoList(); return votbean.getCompoList();
} }
public void initView() {
if(requirePermissions(CompoPermission.VIEW_COMPOS) && role == null) {
curEntries = true;
maxParts = true;
}
else {
curEntries = false;
maxParts = false;
}
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!