This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
/
edit_form.xhtml
120 lines (113 loc) · 4.85 KB
/
edit_form.xhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<s:fragment
xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.org/schema/seam/taglib"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:ui="http://java.sun.com/jsf/facelets">
<script>
function onProjectTypeChanged(radioForm) {
var id = jQuery(radioForm).children(".form__radio__input").attr("id");
var selectedProjectType = id.substring('project-type-'.length, id.length);
bindProjectTypeValue(selectedProjectType);
}
</script>
<a4j:jsFunction name="bindProjectTypeValue" limitRender="true">
<a4j:param name="val" assignTo="#{projectHome.selectedProjectType}"/>
</a4j:jsFunction>
<div class="g--tight l--push-top-1">
<div class="g__item w--1-2">
<div class="form__item">
<h:outputLabel for="name">#{messages['jsf.ProjectName']}</h:outputLabel>
<s:decorate id="nameField" template="../field.xhtml" enclose="true">
<h:inputText id="name" required="true" maxlength="80"
value="#{projectHome.instance.name}">
<a4j:ajax event="blur" render="nameField" execute="@this"/>
</h:inputText>
</s:decorate>
</div>
</div>
<div class="g__item w--1-2">
<div class="form__item">
<h:outputLabel for="slug">
#{messages['jsf.ProjectId']}
<span class="txt--meta"><i class="i i--info"
title="#{messages['jsf.SlugExample']}"></i></span>
</h:outputLabel>
<s:decorate id="slugField" template="../field.xhtml" enclose="true">
<h:inputText rendered="#{projectHome.managed}" disabled="true"
value="#{projectHome.instance.slug}">
</h:inputText>
<h:inputText rendered="#{not projectHome.managed}" maxlength="40"
id="slug" required="true"
value="#{projectHome.instance.slug}"
valueChangeListener="#{projectHome.verifySlugAvailable}">
<a4j:ajax event="blur" render="slugField" execute="@this"/>
<f:validateLength minimum="1"/>
</h:inputText>
</s:decorate>
</div>
</div>
</div>
<div class="form__item l--push-bottom-1">
<h:outputLabel for="descriptionField">#{messages['jsf.ProjectDescription']}
<span class="txt--meta">#{messages['jsf.field.optional']}</span>
</h:outputLabel>
<s:decorate id="descriptionField" template="../field.xhtml">
<h:inputTextarea id="description" required="false"
value="#{projectHome.instance.description}">
<f:validateLength maximum="100"/>
<a4j:ajax event="blur" render="descriptionField" execute="@this"/>
</h:inputTextarea>
</s:decorate>
</div>
<h3
class="heading--secondary l--push-all-0">#{messages['jsf.ProjectType']}</h3>
<p>#{messages['jsf.ProjectType.title']} <a
href="http://zanata.org/help/projects/create-project/"
title="#{messages['jsf.project.projectType.Description']}">
<i class="i i--help"></i>
</a>
</p>
<ul class="list--slat l--push-bottom-1">
<ui:repeat value="#{projectHome.projectTypeList}" var="projectType">
<li>
<div class="form__radio js-form__radio"
onclick="onProjectTypeChanged(this)">
<s:fragment
rendered="#{projectHome.instance.defaultProjectType.name() eq projectType.name()}">
<input type="radio" name="project-type"
class="form__radio__input js-form__radio__input"
id="project-type-#{projectType.name()}" checked="true"/>
</s:fragment>
<s:fragment
rendered="#{projectHome.instance.defaultProjectType.name() ne projectType.name()}">
<input type="radio" name="project-type"
class="form__radio__input js-form__radio__input"
id="project-type-#{projectType.name()}"/>
</s:fragment>
<label for="project-type-#{projectType.name()}"
class="form__radio__label">#{projectType.name()} <span
class="txt--meta">#{messages['jsf.projectType.detail.'.concat(projectType)]}</span>
</label>
</div>
</li>
</ui:repeat>
<s:fragment
rendered="#{projectHome.managed and projectHome.instance.defaultProjectType eq null}">
<li>
<div class="form__radio js-form__radio"
onclick="onProjectTypeChanged(this)">
<input type="radio" name="project-type" id="project-type-null"
checked="true" class="form__radio__input js-form__radio__input"/>
<label for="project-type-null"
class="form__radio__label">#{messages['jsf.projectType.NoSelection']} <span
class="txt--meta">#{messages['jsf.projectType.detail.noSelection']}
<i class="i i--info"
title="#{messages['jsf.projectType.detail.noSelection.message']}"></i></span>
</label>
</div>
</li>
</s:fragment>
</ul>
</s:fragment>