enhanced search filter
This commit is contained in:
parent
8a20f0e952
commit
f480be79d6
2 changed files with 19 additions and 6 deletions
|
@ -18,6 +18,8 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.texttechnologylab.project.gruppe_05_1.util.PPRUtils.listFractionsFromMembers;
|
||||
|
||||
public class FrontEndController {
|
||||
@OpenApi(
|
||||
summary = "Get the homepage.",
|
||||
|
@ -50,12 +52,12 @@ public class FrontEndController {
|
|||
String filter = ctx.queryParam("filter");
|
||||
Logger.info("Filter: '" + filter + "'");
|
||||
|
||||
List<Parlamentarier> parlamentarier = MongoPprUtils.getAllParlamentarier(filter);
|
||||
List<Parlamentarier> parlamentarier = MongoPprUtils.getFilteredMembers(ctx);
|
||||
PPRUtils.sortParlamentarierByName(parlamentarier);
|
||||
Logger.info(parlamentarier.size() + " MdBs gefunden");
|
||||
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
attributes.put("parlamentarier", parlamentarier);
|
||||
attributes.put("parties", listFractionsFromMembers(MongoPprUtils.getAllParlamentarier("")));
|
||||
attributes.put("filter", filter);
|
||||
ctx.render("parlamentarier.ftl", attributes);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,15 @@
|
|||
<form name="searchForm" action="/members" method="get">
|
||||
Name : <input type="text" name="filter" value="${filter!' '}" />
|
||||
<input id="search-button" type="submit" value="Suche" />
|
||||
</form>
|
||||
<div class="filter-form">
|
||||
<form method="GET" action="/members">
|
||||
<input type="text" name="firstName" placeholder="First Name">
|
||||
<input type="text" name="name" placeholder="Last Name">
|
||||
<select id="party" name="party">
|
||||
<option value="">All</option>
|
||||
<#-- Iterate over the parties list and create an option for each one -->
|
||||
<#list parties as party>
|
||||
<option value="${party}">${party}</option>
|
||||
</#list>
|
||||
</select>
|
||||
<button type="submit">Search</button>
|
||||
<a href="/members/add" class="add-member-button">Add Member</a>
|
||||
</form>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue