Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
4bfc5e18
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4bfc5e18
编写于
3月 29, 2016
作者:
R
recena
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Client-side form validation
上级
143ccab9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
18 deletion
+19
-18
core/src/main/resources/hudson/model/View/newJob.jelly
core/src/main/resources/hudson/model/View/newJob.jelly
+4
-6
core/src/main/resources/hudson/model/View/newJob.properties
core/src/main/resources/hudson/model/View/newJob.properties
+3
-2
war/src/main/js/add-item.js
war/src/main/js/add-item.js
+12
-10
未找到文件。
core/src/main/resources/hudson/model/View/newJob.jelly
浏览文件 @
4bfc5e18
...
...
@@ -39,8 +39,8 @@ THE SOFTWARE.
<label for="name">Enter an item name</label>
<input name="name" id="name" placeholder="New item name..." type="text" />
<div class="input-help">» ${%ItemName.help}</div>
<div id="itemname-
validation-
required" class="input-validation-message input-message-disabled">» ${%ItemName.validation.required}</div>
<div id="itemtype-
validation-
required" class="input-validation-message input-message-disabled">» ${%ItemType.validation.required}</div>
<div id="itemname-required" class="input-validation-message input-message-disabled">» ${%ItemName.validation.required}</div>
<div id="itemtype-required" class="input-validation-message input-message-disabled">» ${%ItemType.validation.required}</div>
</div>
</div>
...
...
@@ -48,16 +48,15 @@ THE SOFTWARE.
<j:if test="${!empty(app.itemMap)}">
<div class="item-copy">
<p class="description">
if you want to create a new item from other existing, you can use this option
:</p>
<p class="description">
${%CopyOption.description}
:</p>
<div class="add-item-copy">
<input type="radio"
id="copy"
name="mode" value="copy" />
<input type="radio" name="mode" value="copy" />
<div class="icon">
<img src="${resURL}/images/48x48/copy.png" />
</div>
<label>${%Copy from}</label>
<j:set var="descriptor" value="${it.descriptor}" />
<s:textbox id="from" name="from" field="copyNewItemFrom"/>
<div id="copyfrom-validation-required" class="input-validation-message input-message-disabled">» ${%CopyFrom.validation.required}</div>
</div>
</div>
</j:if>
...
...
@@ -65,7 +64,6 @@ THE SOFTWARE.
<div class="footer">
<div class="btn-decorator">
<button type="submit" id="ok-button">OK</button>
<!-- <input type="submit" name="Submit" value="OK" id="ok-button" /> -->
</div>
</div>
</form>
...
...
core/src/main/resources/hudson/model/View/newJob.properties
浏览文件 @
4bfc5e18
NewJob
=
New {0}
JobName
=
{0} name
ItemName.help
=
Required field
ItemName.validation.required
=
Please, introduce a valid item name
ItemName.validation.required
=
This field can not be empty. Please, enter a valid name and press OK button.
ItemName.validation.invalidFormat
=
Invalid item name
ItemType.validation.required
=
Please, select an item type
Copy
From.validation.required
=
Please, introduce a valid item name
Copy
Option.description
=
if you want to create a new item from other existing, you can use this option
CopyExisting
=
Copy existing {0}
war/src/main/js/add-item.js
浏览文件 @
4bfc5e18
...
...
@@ -35,7 +35,11 @@ $.when(getItems()).done(function(data){
}
function
getItemTypeSelected
()
{
return
$
(
'
input[type="radio"][name="mode"]:checked
'
,
'
#createItem
'
).
val
();
var
item
=
$
(
'
input[type="radio"][name="mode"]:checked
'
,
'
#createItem
'
).
val
();
if
(
item
===
"
copy
"
)
{
return
undefined
;
}
return
item
;
}
function
getItemCopyFromSelected
()
{
...
...
@@ -77,7 +81,7 @@ $.when(getItems()).done(function(data){
function
drawCategory
(
category
)
{
var
$category
=
$
(
'
<div/>
'
).
addClass
(
'
category
'
).
attr
(
'
id
'
,
'
j-add-item-type-
'
+
cleanClassName
(
category
.
id
));
var
$items
=
$
(
'
<ul/>
'
).
addClass
(
'
j-item-options
'
);
var
$items
=
$
(
'
<ul
"
/>
'
).
addClass
(
'
j-item-options
'
);
var
$catHeader
=
$
(
'
<div class="header" />
'
);
var
title
=
'
<h2>
'
+
category
.
name
+
'
</h2>
'
;
var
description
=
'
<p>
'
+
category
.
description
+
'
</p>
'
;
...
...
@@ -110,7 +114,7 @@ $.when(getItems()).done(function(data){
$
(
'
input[type="text"][name="from"]
'
,
'
#createItem
'
).
val
(
''
);
cleanValidationMessages
(
'
.add-item-copy
'
);
if
(
!
isItemNameValid
())
{
activateValidationMessage
(
'
#itemname-
validation-
required
'
,
'
.add-item-name
'
);
activateValidationMessage
(
'
#itemname-required
'
,
'
.add-item-name
'
);
$
(
'
input[name="name"][type="text"]
'
,
'
#createItem
'
).
focus
();
}
}
...
...
@@ -165,24 +169,22 @@ $.when(getItems()).done(function(data){
});
$
(
'
input[name="from"]
'
,
'
#createItem
'
).
blur
(
function
()
{
$
(
'
#createItem
'
).
find
(
'
input[type="radio"][value="copy"]
'
).
prop
(
'
checked
'
,
false
);
if
(
getCopyFromValue
()
===
''
)
{
$
(
'
#createItem
'
).
find
(
'
input[type="radio"][value="copy"]
'
).
prop
(
'
checked
'
,
false
);
}
});
// Client-side validation
$
(
"
#createItem
"
).
submit
(
function
(
event
)
{
if
(
!
isItemNameValid
())
{
activateValidationMessage
(
'
#itemname-
validation-
required
'
,
'
.add-item-name
'
);
activateValidationMessage
(
'
#itemname-required
'
,
'
.add-item-name
'
);
$
(
'
input[name="name"][type="text"]
'
,
'
#createItem
'
).
focus
();
event
.
preventDefault
();
}
else
{
if
(
getItemTypeSelected
()
===
undefined
&&
getItemCopyFromSelected
()
===
undefined
)
{
activateValidationMessage
(
'
#itemtype-
validation-
required
'
,
'
.add-item-name
'
);
activateValidationMessage
(
'
#itemtype-required
'
,
'
.add-item-name
'
);
$
(
'
input[name="name"][type="text"]
'
,
'
#createItem
'
).
focus
();
event
.
preventDefault
();
}
else
if
(
getItemCopyFromSelected
()
&&
getCopyFromValue
()
===
''
)
{
activateValidationMessage
(
'
#copyfrom-validation-required
'
,
'
.add-item-copy
'
);
$
(
'
input[name="from"][type="text"]
'
,
'
#createItem
'
).
focus
();
event
.
preventDefault
();
}
}
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录