1 <!DOCTYPE html> |
|
2 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" th:lang="${#ctx.getLocale().toLanguageTag()}" > |
|
3 <head> |
|
4 <meta charset="utf-8"/> |
|
5 <title>User form</title> |
|
6 </head> |
|
7 <body> |
|
8 <div id="groupForm" th:fragment="groupFormFragment" > |
|
9 <script type="text/javascript" th:inline="javascript"> |
|
10 //<![CDATA[ |
|
11 |
|
12 function groupFormSubmit() { |
|
13 |
|
14 var errors = {}; |
|
15 var valid = true; |
|
16 |
|
17 if(!$('#title').val()) { |
|
18 errors['title'] = /*[[#{renkan.error.title.empty}]]*/"renkan.error.title.empty"; |
|
19 valid = false; |
|
20 } |
|
21 |
|
22 showformErrors(errors); |
|
23 |
|
24 return valid; |
|
25 } |
|
26 |
|
27 |
|
28 $(function(){ |
|
29 |
|
30 $('#color').spectrum({ |
|
31 showInput: true, |
|
32 showAlpha: true, |
|
33 showPalette: true, |
|
34 showInitial: true, |
|
35 preferredFormat: 'hex' |
|
36 }); |
|
37 $("#model-form").submit(function(e) { |
|
38 return groupFormSubmit(); |
|
39 }); |
|
40 |
|
41 }); |
|
42 //]]> |
|
43 </script> |
|
44 <form action="#" th:object="${group}" th:action="@{/admin/groups/save}" method="post" id="model-form"> |
|
45 <fieldset class="form-fields"> |
|
46 <input type="hidden" th:field="*{id}" th:if="*{id}" /> |
|
47 <div> |
|
48 <label for="title" th:text="#{renkanAdmin.form.name}">Name: </label> |
|
49 <input type="text" th:field="*{title}" /> |
|
50 <div th:if="${#fields.hasErrors('title')}" th:errors="*{title}" class="form-error"></div> |
|
51 </div> |
|
52 <div> |
|
53 <label for="uri" th:text="#{renkanAdmin.form.uri}">Uri: </label> |
|
54 <input type="text" th:field="*{uri}" /> |
|
55 </div> |
|
56 <div> |
|
57 <label for="description" th:text="#{renkanAdmin.form.description}">Description: </label> |
|
58 <textarea th:field="*{description}"></textarea> |
|
59 </div> |
|
60 <div> |
|
61 <label for="color" th:text="#{renkanAdmin.form.color}">Color: </label> |
|
62 <input type="text" th:field="*{color}" /> |
|
63 </div> |
|
64 <div> |
|
65 <label for="avatar" th:text="#{renkanAdmin.form.avatar}">Avatar: </label> |
|
66 <input type="text" th:field="*{avatar}" /> |
|
67 </div> |
|
68 <!-- todo: only user managing the group can see that --> |
|
69 <div> |
|
70 <label for="users" th:text="#{renkanAdmin.form.users}">Groups: </label> |
|
71 <select th:field="*{users}" multiple="multiple"> |
|
72 <option th:each="user: ${allUsers}" th:value="${user.id}" th:text="${user.title}">USER</option> |
|
73 </select> |
|
74 </div> |
|
75 <div class="submit"> |
|
76 <button type="submit" name="save" th:text="#{renkanAdmin.form.user.submit}">Save</button> |
|
77 <!--button type="button" name="cancel" th:text="#{renkanAdmin.form.user.cancel}" th:onclick="location">Cancel</button--> |
|
78 </div> |
|
79 |
|
80 </fieldset> |
|
81 </form> |
|
82 </div> |
|
83 </body> |
|
84 </html> |
|