Commit 21974dc8 by Antti Tonkyra

Tournament admin views

1 parent 05a25dbb
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['tournament.admin.control']}" /> <h:outputText value="#{i18n['tournament.admin.control']}" />
</f:facet> </f:facet>
<p:commandButton value="#{i18n['tournament.admin.view']}" action="#{tournamentParticipantsView.showView(tournament.id)}"/>
<p:commandButton value="#{i18n['tournament.admin.edit']}" action="#{tournamentEditView.showEdit(tournament.id)}"/> <p:commandButton value="#{i18n['tournament.admin.edit']}" action="#{tournamentEditView.showEdit(tournament.id)}"/>
<p:commandButton value="#{i18n['tournament.admin.delete']}" action="#{tournamentDeleteView.showConfirm(tournament.id)}"/> <p:commandButton value="#{i18n['tournament.admin.delete']}" action="#{tournamentDeleteView.showConfirm(tournament.id)}"/>
</p:column> </p:column>
......
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/cditools/user" xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core">
<h:body>
<ui:composition template="#{sessionHandler.template}">
<f:metadata>
</f:metadata>
<ui:define name="content">
<h1>#{i18n['tournaments.admin.view_tournament_title']} #{tournamentParticipantsView.tournament.tournamentName}</h1>
<p>#{i18n['tournaments.admin.view_tournament_description']}</p>
<h:form>
<p:dataTable value="#{tournamentParticipantsView.tournament.participants}" var="participant">
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['tournament.participant_nick']}" />
</f:facet>
<h:outputText value="#{participant.participator.nick}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['tournament.participant_gameid']}" />
</f:facet>
<h:outputText value="derp" />
</p:column>
</p:dataTable>
</h:form>
<h:form>
<p:commandButton value="#{i18n['tournament.admin.back_to_index']}" action="#{tournamentParticipantsView.cancel}" />
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/cditools/user" xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core">
<h:body>
<ui:composition template="#{sessionHandler.template}">
<f:metadata>
</f:metadata>
<ui:define name="content">
<h1>#{i18n['tournaments.admin.view_tournament_title']} #{tournamentParticipantsView.tournament.tournamentName}</h1>
<p>#{i18n['tournaments.admin.view_tournament_description']}</p>
<p>#{i18n['tournaments.admin.view_tournament_description_teamview_addition']}</p>
<h:form>
<p:dataTable value="#{tournamentParticipantsView.tournament.participants}" var="participant">
<p:column style="width:2%">
<p:rowToggler />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['tournament.team_name']}" />
</f:facet>
<h:outputText value="#{participant.teamName}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['tournament.participant_captain']}" />
</f:facet>
<h:outputText value="#{participant.participator.nick}" />
</p:column>
<p:rowExpansion>
<h:panelGrid id="display" columns="2" cellpadding="4" styleClass=" ui-widget-content grid">
<h:outputText value="#{i18n['tournament.team_members']}" />
<h:panelGroup>
<ul>
<ui:repeat var="member" value="#{participant.teamMembers}">
<li>
<h:outputText value="#{member.eventUser.nick}" />
(<h:outputText value="GAMEID" />)
</li>
</ui:repeat>
</ul>
</h:panelGroup>
</h:panelGrid>
</p:rowExpansion>
</p:dataTable>
</h:form>
<h:form>
<p:commandButton value="#{i18n['tournament.admin.back_to_index']}" action="#{tournamentParticipantsView.cancel}" />
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
package fi.codecrew.moya.web.cdiview.tournaments;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.inject.Named;
import fi.codecrew.moya.beans.TournamentBeanLocal;
import fi.codecrew.moya.model.Tournament;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
@Named
@ConversationScoped
public class TournamentParticipantsView extends GenericCDIView {
private static final long serialVersionUID = -6066216858686165211L;
@EJB private TournamentBeanLocal tournamentBean;
private Tournament tournament = null;
public String showView(Integer tournamentId) {
this.beginConversation();
this.setTournament(tournamentBean.getTournamentById(tournamentId));
if(this.tournament.getPlayersPerTeam() == 1)
return "/tournaments/admin/view_tournament_single.xhtml";
else
return "/tournaments/admin/view_tournament_team.xhtml";
}
public String cancel() {
this.endConversation();
return "/tournaments/admin/index.xhtml";
}
public Tournament getTournament() {
return tournament;
}
public void setTournament(Tournament tournament) {
this.tournament = tournament;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!