新增add project按钮

This commit is contained in:
高子兴 2024-07-14 16:16:46 +08:00
parent 7e25024e3e
commit 1eedecba02
2 changed files with 11 additions and 0 deletions

View File

@ -106,6 +106,11 @@ public class ProjectBean implements Serializable {
this.selectedKeywords = new ArrayList<>(project.getKeywords()); this.selectedKeywords = new ArrayList<>(project.getKeywords());
} }
public void addProject() {
project = new Project("", "", "", new ArrayList<>(), "", new ArrayList<>(), "", "");
projects.add(project);
}
public String loadProject(String title) { public String loadProject(String title) {
project = projects.stream().filter(p -> p.getTitle().equals(title)).findFirst().orElse(null); project = projects.stream().filter(p -> p.getTitle().equals(title)).findFirst().orElse(null);
return "project.xhtml?faces-redirect=true"; return "project.xhtml?faces-redirect=true";

View File

@ -22,6 +22,12 @@
<f:ajax render="project-form form"/> <f:ajax render="project-form form"/>
</h:commandButton> </h:commandButton>
</ui:repeat> </ui:repeat>
<div class="form-group">
<h:commandButton value="Add Project" action="#{projectBean.addProject}"
styleClass="project-button">
<f:ajax render="project-form form"/>
</h:commandButton>
</div>
</section> </section>
</h:form> </h:form>
<h:form id="project-form" styleClass="project-form"> <h:form id="project-form" styleClass="project-form">