Skip to content

Commit

Permalink
better creation of a revision in web UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Venca24 committed Jan 6, 2017
1 parent 0e17851 commit 235da38
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions web/src/main/java/controllers/RentalController.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import facade.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
Expand Down Expand Up @@ -145,4 +146,9 @@ public String delete(@PathVariable Long id, UriComponentsBuilder uriBuilder)
public List<MachineDTO> machines() {
return machineFacade.findAllMachines();
}

@ModelAttribute("users")
public Collection<UserDTO> users() {
return userFacade.getAllUsers();
}
}
9 changes: 6 additions & 3 deletions web/src/main/webapp/WEB-INF/jsp/rental/new.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@
</form:select>
</div>
<div class="form-group">
<label for="usr">User (email)</label>
<form:input path="user" cssClass="form-control" id="usr" placeholder="User"/>

<label for="usr">User</label>
<form:select path="user" cssClass="form-control">
<c:forEach items="${users}" var="u">
<form:option value="${u.email}">${u.email}</form:option>
</c:forEach>
</form:select>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form:form>
Expand Down

0 comments on commit 235da38

Please sign in to comment.