Skip to content
Snippets Groups Projects
Commit 6eecb042 authored by Chris Lemaire's avatar Chris Lemaire
Browse files

Fix thymeleaf template for filters, add assistants

- Adds assistants to the thymeleaf template other than the current user.
- Replaces use of th:unless in combination with th:if with intended th:selected.
parent 2b4a0711
Branches
Tags
No related merge requests found
...@@ -36,12 +36,8 @@ ...@@ -36,12 +36,8 @@
<select multiple="multiple" class="form-control" id="courseSelect" name="lab.course"> <select multiple="multiple" class="form-control" id="courseSelect" name="lab.course">
<th:block th:each="course : ${courses}"> <th:block th:each="course : ${courses}">
<option th:value="${course.id}" <option th:value="${course.id}"
th:unless="${#filter.valueInMultiMap('lab.course', course, state)}" th:selected="${#filter.valueInMultiMap('lab.course', course, state)}"
th:text="${course}">One th:text="${course}">
</option>
<option th:value="${course.id}"
th:if="${#filter.valueInMultiMap('lab.course', course, state)}"
selected="selected" th:text="${course}">One
</option> </option>
</th:block> </th:block>
</select> </select>
...@@ -51,14 +47,9 @@ ...@@ -51,14 +47,9 @@
<label class="form-control-label" for="labSelect">Lab</label> <label class="form-control-label" for="labSelect">Lab</label>
<select multiple="multiple" class="form-control" id="labSelect" name="lab"> <select multiple="multiple" class="form-control" id="labSelect" name="lab">
<th:block th:each="lab : ${activeLabs}"> <th:block th:each="lab : ${activeLabs}">
<option
th:value="${lab.id}"
th:unless="${#filter.valueInMultiMap('lab', lab, state)}"
th:text="${lab.toReadableString()}">One
</option>
<option th:value="${lab.id}" <option th:value="${lab.id}"
th:if="${#filter.valueInMultiMap('lab', lab, state)}" selected="selected" th:selected="${#filter.valueInMultiMap('lab', lab, state)}"
th:text="${lab.toReadableString()}">One th:text="${lab.toReadableString()}">
</option> </option>
</th:block> </th:block>
</select> </select>
...@@ -69,12 +60,8 @@ ...@@ -69,12 +60,8 @@
<select multiple="multiple" class="form-control" id="assignmentSelect" name="assignment"> <select multiple="multiple" class="form-control" id="assignmentSelect" name="assignment">
<th:block th:each="assignment : ${assignments}"> <th:block th:each="assignment : ${assignments}">
<option th:value="${assignment.id}" <option th:value="${assignment.id}"
th:unless="${#filter.valueInMultiMap('assignment', assignment, state)}" th:selected="${#filter.valueInMultiMap('assignment', assignment, state)}"
th:text="${assignment}">One th:text="${assignment}">
</option>
<option th:value="${assignment.id}"
th:if="${#filter.valueInMultiMap('assignment', assignment, state)}"
selected="selected" th:text="${assignment}">One
</option> </option>
</th:block> </th:block>
</select> </select>
...@@ -85,11 +72,8 @@ ...@@ -85,11 +72,8 @@
<select multiple="multiple" class="form-control" id="roomSelect" name="room"> <select multiple="multiple" class="form-control" id="roomSelect" name="room">
<th:block th:each="room : ${rooms}"> <th:block th:each="room : ${rooms}">
<option th:value="${room.id}" <option th:value="${room.id}"
th:unless="${#filter.valueInMultiMap('room', room.id, state)}" th:text="${room}">One th:selected="${#filter.valueInMultiMap('room', room.id, state)}"
</option> th:text="${room}">
<option th:value="${room.id}"
th:if="${#filter.valueInMultiMap('room', room.id, state)}" selected="selected"
th:text="${room}">One
</option> </option>
</th:block> </th:block>
</select> </select>
...@@ -98,7 +82,17 @@ ...@@ -98,7 +82,17 @@
<div class="form-group filter"> <div class="form-group filter">
<label class="form-control-label" for="assignedSelect">Assigned</label> <label class="form-control-label" for="assignedSelect">Assigned</label>
<select multiple="multiple" class="form-control" id="assignedSelect" name="assistant"> <select multiple="multiple" class="form-control" id="assignedSelect" name="assistant">
<option th:value="${#authenticated.getId().toString()}">You</option> <option th:value="${#authenticated.id}"
th:selected="${#filter.valueInMultiMap('assistant', #authenticated.id, state)}">
You
</option>
<th:block th:each="assistant : ${assistants}">
<option th:value="${assistant.id}"
th:selected="${#filter.valueInMultiMap('assistant', assistant.id, state)}"
th:unless="${assistant.id == #authenticated.id}"
th:text="${assistant.displayName}">
</option>
</th:block>
</select> </select>
</div> </div>
...@@ -107,11 +101,7 @@ ...@@ -107,11 +101,7 @@
<select multiple="multiple" class="form-control" id="statusSelect" name="status"> <select multiple="multiple" class="form-control" id="statusSelect" name="status">
<th:block th:each="status : ${T(nl.tudelft.ewi.queue.model.Request.Status).values()}"> <th:block th:each="status : ${T(nl.tudelft.ewi.queue.model.Request.Status).values()}">
<option th:value="${status}" th:text="${status}" <option th:value="${status}" th:text="${status}"
th:unless="${#filter.valueInMultiMap('status', status, state)}">One th:selected="${#filter.valueInMultiMap('status', status, state)}"></option>
</option>
<option th:value="${status}" th:text="${status}"
th:if="${#filter.valueInMultiMap('status', status, state)}" selected="selected">One
</option>
</th:block> </th:block>
</select> </select>
</div> </div>
...@@ -121,12 +111,7 @@ ...@@ -121,12 +111,7 @@
<select multiple="multiple" class="form-control" id="requestTypeSelect" name="requestType"> <select multiple="multiple" class="form-control" id="requestTypeSelect" name="requestType">
<th:block th:each="requestType : ${requestTypes}"> <th:block th:each="requestType : ${requestTypes}">
<option th:value="${requestType.id}" th:text="${requestType.name}" <option th:value="${requestType.id}" th:text="${requestType.name}"
th:unless="${#filter.valueInMultiMap('requestType', requestType.id, state)}">One th:selected="${#filter.valueInMultiMap('requestType', requestType.id, state)}"></option>
</option>
<option th:value="${requestType.id}" th:text="${requestType.name}"
th:if="${#filter.valueInMultiMap('requestType', requestType.id, state)}"
selected="selected">One
</option>
</th:block> </th:block>
</select> </select>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment