Turn profile fields into their own container classes.
[Sone.git] / src / main / resources / templates / editProfile.html
1 <%include include/head.html>
2
3         <script language="javascript">
4                 $(function() {
5                         getTranslation("WebInterface.DefaultText.FirstName", function(firstNameDefaultText) {
6                                 registerInputTextareaSwap("#sone #edit-profile input[name=first-name]", firstNameDefaultText, "first-name", true, true);
7                         });
8                         getTranslation("WebInterface.DefaultText.MiddleName", function(middleNameDefaultText) {
9                                 registerInputTextareaSwap("#sone #edit-profile input[name=middle-name]", middleNameDefaultText, "middle-name", true, true);
10                         });
11                         getTranslation("WebInterface.DefaultText.LastName", function(lastNameDefaultText) {
12                                 registerInputTextareaSwap("#sone #edit-profile input[name=last-name]", lastNameDefaultText, "last-name", true, true);
13                         });
14                         getTranslation("WebInterface.DefaultText.BirthDay", function(birthDayDefaultText) {
15                                 registerInputTextareaSwap("#sone #edit-profile input[name=birth-day]", birthDayDefaultText, "birth-day", true, true);
16                         });
17                         getTranslation("WebInterface.DefaultText.BirthMonth", function(birthMonthDefaultText) {
18                                 registerInputTextareaSwap("#sone #edit-profile input[name=birth-month]", birthMonthDefaultText, "birth-month", true, true);
19                         });
20                         getTranslation("WebInterface.DefaultText.BirthYear", function(birthYearDefaultText) {
21                                 registerInputTextareaSwap("#sone #edit-profile input[name=birth-year]", birthYearDefaultText, "birth-year", true, true);
22                         });
23                         getTranslation("WebInterface.DefaultText.FieldName", function(fieldNameDefaultText) {
24                                 registerInputTextareaSwap("#sone #add-profile-field input[name=field-name]", fieldNameDefaultText, "field-name", true, true);
25                         });
26
27                         <%foreach fields field>
28                                 registerInputTextareaSwap("#sone #edit-profile input[name=field-<% loop.count>]", <% field.key|js>, "field-<% loop.count>", true, true);
29                         <%/foreach>
30
31                         /* hide all the labels. */
32                         $("#sone #edit-profile label, #sone #add-profile-field label").hide();
33                 });
34         </script>
35
36         <h1><%= Page.EditProfile.Page.Title|l10n|html></h1>
37
38         <p><%= Page.EditProfile.Page.Description|l10n|html></p>
39         <p><%= Page.EditProfile.Page.Hint.Optionality|l10n|html></p>
40
41         <form id="edit-profile" method="post">
42                 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
43
44                 <div>
45                         <label for="first-name"><%= Page.EditProfile.Label.FirstName|l10n|html></label>
46                         <input type="text" name="first-name" value="<% firstName|html>" />
47                 </div>
48
49                 <div>
50                         <label for="middle-name"><%= Page.EditProfile.Label.MiddleName|l10n|html></label>
51                         <input type="text" name="middle-name" value="<% middleName|html>" />
52                 </div>
53
54                 <div>
55                         <label for="last-name"><%= Page.EditProfile.Label.LastName|l10n|html></label>
56                         <input type="text" name="last-name" value="<% lastName|html>" />
57                 </div>
58
59                 <h1><%= Page.EditProfile.Birthday.Title|l10n|html></h1>
60
61                 <div id="birth-day">
62                         <label for="birth-day"><%= Page.EditProfile.Birthday.Label.Day|l10n|html></label>
63                         <input type="text" name="birth-day" value="<% birthDay|html>" />
64                 </div>
65
66                 <div id="birth-month">
67                         <label for="birth-month"><%= Page.EditProfile.Birthday.Label.Month|l10n|html></label>
68                         <input type="text" name="birth-month" value="<% birthMonth|html>" />
69                 </div>
70
71                 <div id="birth-year">
72                         <label for="birth-year"><%= Page.EditProfile.Birthday.Label.Year|l10n|html></label>
73                         <input type="text" name="birth-year" value="<% birthYear|html>" />
74                 </div>
75
76                 <div>
77                         <button type="submit" name="save-profile" value="true"><%= Page.EditProfile.Button.Save|l10n|html></button>
78                 </div>
79
80                 <h1><%= Page.EditProfile.Fields.Title|l10n|html></h1>
81
82                 <p><%= Page.EditProfile.Fields.Description|l10n|html></p>
83
84                 <%foreach fields field fieldLoop>
85                         <div class="profile-field" id="<% field.id|html>">
86                                 <div class="name"><% field.name|html></div>
87                                 <div class="edit-field-name"><button type="submit" name="edit-field-<% field.id|html>" value="true"><%= Page.EditProfile.Fields.Button.Edit|l10n|html></button></div>
88                                 <div class="delete-field-name"><button type="submit" name="delete-field-<% field.id|html>" value="true"><%= Page.EditProfile.Fields.Button.Delete|l10n|html></button></div>
89                                 <div class="<%if fieldLoop.last>hidden <%/if>move-down-field"><button type="submit" name="move-down-field-<% field.id|html>" value="true"><%= Page.EditProfile.Fields.Button.MoveDown|l10n|html></button></div>
90                                 <div class="<%if fieldLoop.first>hidden <%/if>move-up-field"><button type="submit" name="move-up-field-<% field.id|html>" value="true"><%= Page.EditProfile.Fields.Button.MoveUp|l10n|html></button></div>
91                                 <div class="value"><input type="text" name="field-<% field.id|html>" value="<% field.value|html>" /></div>
92                         </div>
93
94                         <%if fieldLoop.last>
95                                 <div>
96                                         <button type="submit" name="save-profile" value="true"><%= Page.EditProfile.Button.Save|l10n|html></button>
97                                 </div>
98                         <%/if>
99                 <%/foreach>
100
101         </form>
102
103         <form id="add-profile-field" method="post">
104                 <input type="hidden" name="formPassword" value="<% formPassword|html>" />
105
106                 <a name="profile-fields"></a>
107                 <h2><%= Page.EditProfile.Fields.AddField.Title|l10n|html></h2>
108
109                 <%if duplicateFieldName>
110                         <p><%= Page.EditProfile.Error.DuplicateFieldName|l10n|replace needle="{fieldName}" replacementKey="fieldName"|html></p>
111                 <%/if>
112
113                 <div id="new-field">
114                         <label for="new-field"><%= Page.EditProfile.Fields.AddField.Label.Name|l10n|html></label>
115                         <input type="text" name="field-name" value="" />
116                         <button type="submit" name="add-field" value="true"><%= Page.EditProfile.Fields.AddField.Button.AddField|l10n|html></button>
117                 </div>
118
119         </form>
120
121 <%include include/tail.html>