This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
/
settings-tab.xhtml
294 lines (271 loc) · 11.2 KB
/
settings-tab.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:s="http://jboss.org/schema/seam/taglib"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:zanata="http://java.sun.com/jsf/composite/zanata">
<script type="text/javascript">
var newLanguageItems = "[id='#{rich:clientId('new--language')}Items']";
var newVersionItems = "[id='#{rich:clientId('new--version')}Items']";
var newMaintainerItems = "[id='#{rich:clientId('new--maintainer')}Items']";
jQuery(document).ready(function () {
jQuery('.js-tabs-nav').children('li').children('a').click(function () {
var inputField = jQuery(jQuery(this).attr('href')).find('.js-tabs-nav-focus-input');
if (inputField.length) {
setTimeout(function () {
focusInput(inputField);
autocompleteResize(inputField);
}, 50);
}
});
setTimeout(function () {
focusCurrentActiveInput();
jQuery(jQuery('.js-tabs-nav').children('li.is-active').children('a').attr('href')).find('.js-tabs-nav-focus-input').each(function () {
autocompleteResize(this);
});
}, 50);
});
function autocompleteResize(inputField) {
if (jQuery(inputField).length != 0) {
var fieldId = jQuery(inputField).attr('id');
fieldId = fieldId.substring(0,
fieldId.length - "Input".length).concat("List").replace(/:/g, "\\:");
jQuery('#' + fieldId).find(".rf-au-lst-scrl").css("width",
jQuery(inputField).outerWidth() + "px");
}
}
function focusCurrentActiveInput() {
jQuery(jQuery('.js-tabs-nav').children('li.is-active').children('a').attr('href')).find('.js-tabs-nav-focus-input').each(function () {
focusInput(this);
});
}
function focusInput(field) {
jQuery(field).value = "";
jQuery(field).focus();
}
function updateResultClickEvent(fieldSelector, clickFn) {
jQuery(fieldSelector).find('.rf-au-itm').click(function () {
clickFn(this.children[0].value);
});
}
</script>
<h1>#{messages['Settings']}</h1>
<div class="tabs--vertical js-tabs">
<ul class="tabs__nav js-tabs-nav">
<li class="is-active">
<a href="#settings-general" id="settings-general_tab"
title="#{messages['General']}">
<i class="i--left i--settings"></i>
<span class="is-hidden--m-down">#{messages['jsf.General']}</span>
</a>
</li>
<li>
<a href="#settings-languages" id="settings-languages_tab"
title="#{messages['Languages']}">
<i class="i--left i--language"></i>
<span class="is-hidden--m-down">#{messages['jsf.Languages']}</span>
</a>
</li>
<li>
<a href="#settings-projects" id="settings-projects_tab"
title="#{messages['Projects']}">
<i class="i--left i--project"></i>
<span class="is-hidden--m-down">#{messages['jsf.Projects']}</span>
</a>
</li>
<li>
<a href="#settings-maintainers" id="settings-maintainers_tab"
title="#{messages['Maintainers']}">
<i class="i--left i--users"></i>
<span class="is-hidden--m-down">#{messages['jsf.Maintainers']}</span>
</a>
</li>
</ul>
<ul class="tabs__content js-tabs-content">
<li class="is-active" id="settings-general">
<h2 class="l--push-all-0 gamma d--bottom">
#{messages['jsf.General']}
</h2>
<h:form styleClass="l--push-bottom-0">
<div class="l--constrain-medium">
<ui:include src="edit_form.xhtml"/>
<div class="l--push-top-1">
<a4j:commandLink value="#{messages['jsf.UpdateGeneralSettings']}"
action="#{versionGroupHome.update}"
rendered="#{versionGroupHome.managed}"
render="group-info,pageMessages"
styleClass="l--push-right-half button--primary"/>
</div>
<hr/>
<a4j:outputPanel id="status">
<s:fragment
rendered="#{versionGroupHome.instance.status == 'ACTIVE'}">
<p>
<a4j:commandLink styleClass="button--danger"
action="#{versionGroupHome.setStatus('O')}" render="status">
#{messages['jsf.ArchiveThisGroup']}
</a4j:commandLink>
</p>
<p class="txt--meta">
#{messages['jsf.ArchiveGroupMessage']}
</p>
</s:fragment>
<s:fragment
rendered="#{versionGroupHome.instance.status != 'ACTIVE'}">
<p>
<a4j:commandLink styleClass="button--success"
action="#{versionGroupHome.setStatus('A')}" render="status">
#{messages['jsf.ActivateThisGroup']}
</a4j:commandLink>
</p>
<p class="txt--meta">
#{messages['jsf.ActivateGroupMessage']}
</p>
</s:fragment>
</a4j:outputPanel>
</div>
</h:form>
</li>
<li id="settings-languages">
<h2 class="l--push-all-0 gamma d--bottom l--push-bottom-half">
#{messages['jsf.Languages']}
</h2>
<h:form id="settings-languages-form" styleClass="l--push-bottom-0">
<ul class="list--slat list--highlight l--push-top-half">
<ui:repeat value="#{versionGroupHome.getInstanceActiveLocales()}"
var="locale">
<li class="reveal--list-item">#{locale.retrieveDisplayName()}<span
class="txt--understated l--push-left-quarter">[#{locale.localeId}]</span>
<a4j:commandLink oncomplete="refreshStatistics()" execute="@this"
action="#{versionGroupHome.removeLanguage(locale)}"
styleClass="l--float-right txt--danger reveal__target"
render="settings-languages-form">
<i class="i--large i--remove"></i>
</a4j:commandLink>
</li>
</ui:repeat>
<li class="list--highlight__item--none">
<label
for="#{rich:clientId('languageAutocomplete')}-autocomplete__input">
#{messages['jsf.AddALanguage']}
</label>
<zanata:autocomplete
selectedField="#{versionGroupHome.selectedLocale}"
getResultAction="#{versionGroupHome.suggestLocales()}"
onselectItem="#{versionGroupHome.addLanguage()}"
maxlength="80" minlength="1" id="languageAutocomplete"
queryField="#{versionGroupHome.languageQuery}"
displayValue="#{result.retrieveDisplayName()} [#{result.localeId}]"
fetchValue="#{result.localeId}" render="settings-languages-form"
oncomplete="refreshStatistics();focusCurrentActiveInput()"
placeholder="#{messages['jsf.SearchLanguages']}">
#{result.retrieveDisplayName()}<span
class="txt--understated l--push-left-quarter">[#{result.localeId}]</span>
</zanata:autocomplete>
</li>
</ul>
</h:form>
</li>
<li id="settings-projects">
<h2 class="l--push-all-0 gamma d--bottom l--push-bottom-half">
#{messages['jsf.Projects']}
</h2>
<h:form id="settings-projects-form" styleClass="l--push-bottom-0">
<ul class="list--slat list--highlight l--push-top-half">
<ui:repeat
value="#{versionGroupHome.getSortedInstanceProjectIterations()}"
var="version">
<li class="reveal--list-item">
<s:link view="/iteration/view.xhtml">
<f:param name="projectSlug" value="#{version.project.slug}"/>
<f:param name="iterationSlug" value="#{version.slug}"/>
#{version.project.name} <i
class="i i--version"></i> #{version.slug}
</s:link>
<a4j:commandLink
action="#{versionGroupHome.removeVersion(version)}"
oncomplete="refreshStatistics()"
styleClass="l--float-right txt--danger reveal__target"
render="settings-projects-form">
<i class="i--large i--remove"></i>
</a4j:commandLink>
</li>
</ui:repeat>
<li class="list--highlight__item--none">
<label
for="#{rich:clientId('versionAutocomplete')}-autocomplete__input">
#{messages['jsf.AddAProject']}
</label>
<zanata:autocomplete
selectedField="#{versionGroupHome.selectedVersion}"
getResultAction="#{versionGroupHome.suggestVersions()}"
onselectItem="#{versionGroupHome.addVersion()}"
maxlength="40" minlength="3" id="versionAutocomplete"
queryField="#{versionGroupHome.versionQuery}"
displayValue="#{result.project.slug} #{result.slug}"
fetchValue="#{result.id}"
render="settings-projects-form"
oncomplete="refreshStatistics();focusCurrentActiveInput();"
placeholder="#{messages['jsf.SearchProjects']}">
#{result.project.slug} <i class="i i--version"></i> #{result.slug}
</zanata:autocomplete>
</li>
</ul>
</h:form>
</li>
<li id="settings-maintainers">
<h2 class="l--push-all-0 gamma d--bottom l--push-bottom-half">
#{messages['jsf.Maintainers']}
</h2>
<h:form id="settings-maintainers-form" styleClass="l--push-bottom-0">
<ul class="list--slat list--highlight l--push-top-half">
<ui:repeat value="#{versionGroupHome.getInstanceMaintainers()}"
var="maintainer">
<li class="reveal--list-item">
<span class="w--r-1 bx--round l--push-right-quarter">
<img
src="#{gravatarServiceImpl.getUserImageUrl(48, maintainer.email)}"
alt="#{maintainer.account.username}"/>
</span> #{maintainer.name}
<span class="txt--meta">@#{maintainer.account.username}</span>
<a4j:commandLink
action="#{versionGroupHome.removeMaintainer(maintainer)}"
styleClass="l--float-right txt--danger reveal__target"
render="settings-maintainers-form,maintainers-size,maintainers-list,maintainers_content">
<i class="i--large i--remove"></i>
</a4j:commandLink>
</li>
</ui:repeat>
<li class="list--highlight__item--none">
<label
for="#{rich:clientId('maintainerAutocomplete')}-autocomplete__input">
#{messages['jsf.AddAMaintainer']}
</label>
<zanata:autocomplete
selectedField="#{versionGroupHome.selectedMaintainer}"
getResultAction="#{versionGroupHome.suggestMaintainers()}"
onselectItem="#{versionGroupHome.addMaintainer()}"
maxlength="80" minlength="3" id="maintainerAutocomplete"
queryField="#{versionGroupHome.maintainerQuery}"
displayValue="#{result.name} @#{result.account.username}"
fetchValue="#{result.account.username}"
render="settings-maintainers-form,pageMessages"
oncomplete="focusCurrentActiveInput()"
placeholder="#{messages['jsf.SearchUsers']}">
<span class="w--r-1 bx--round l--push-right-quarter">
<img
src="#{gravatarServiceImpl.getUserImageUrl(48, result.email)}"
alt="#{result.name}"/>
</span>#{result.name}
<span
class="txt--meta">@#{result.account.username}</span>
</zanata:autocomplete>
</li>
</ul>
</h:form>
</li>
</ul>
</div>
</ui:composition>