Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
2dd0398a
J
jenkins
项目概览
FIY695
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
2dd0398a
编写于
4月 04, 2012
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added <l:copyButton> to copy text into clipboard.
上级
1b1aabf1
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
166 addition
and
1 deletion
+166
-1
changelog.html
changelog.html
+2
-0
core/pom.xml
core/pom.xml
+6
-1
core/src/main/resources/lib/layout/copyButton.jelly
core/src/main/resources/lib/layout/copyButton.jelly
+54
-0
core/src/main/resources/lib/layout/copyButton/clipboard.png
core/src/main/resources/lib/layout/copyButton/clipboard.png
+0
-0
core/src/main/resources/lib/layout/copyButton/copyButton.css
core/src/main/resources/lib/layout/copyButton/copyButton.css
+5
-0
core/src/main/resources/lib/layout/copyButton/copyButton.js
core/src/main/resources/lib/layout/copyButton/copyButton.js
+39
-0
ui-samples-plugin/src/main/java/jenkins/plugins/ui_samples/CopyButton.java
.../src/main/java/jenkins/plugins/ui_samples/CopyButton.java
+29
-0
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/CopyButton/index.groovy
...ources/jenkins/plugins/ui_samples/CopyButton/index.groovy
+20
-0
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/CopyButton/index.properties
...es/jenkins/plugins/ui_samples/CopyButton/index.properties
+11
-0
未找到文件。
changelog.html
浏览文件 @
2dd0398a
...
...
@@ -55,6 +55,8 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div
id=
"trunk"
style=
"display:none"
>
<!--=TRUNK-BEGIN=-->
<ul
class=
image
>
<li
class=
rfe
>
Added a tag to copy text into clipboard for plugins
<li
class=
rfe
>
Removed ASM dependency to avoid class incompatibility trobules.
</ul>
...
...
core/pom.xml
浏览文件 @
2dd0398a
...
...
@@ -42,7 +42,7 @@ THE SOFTWARE.
<properties>
<staplerFork>
true
</staplerFork>
<stapler.version>
1.18
5
</stapler.version>
<stapler.version>
1.18
6
</stapler.version>
</properties>
<dependencies>
...
...
@@ -149,6 +149,11 @@ THE SOFTWARE.
<artifactId>
windows-package-checker
</artifactId>
<version>
1.0
</version>
</dependency>
<dependency>
<groupId>
org.kohsuke.stapler
</groupId>
<artifactId>
stapler-adjunct-zeroclipboard
</artifactId>
<version>
1.0.7-1
</version>
</dependency>
<dependency>
<groupId>
org.kohsuke.stapler
</groupId>
<artifactId>
stapler-adjunct-timeline
</artifactId>
...
...
core/src/main/resources/lib/layout/copyButton.jelly
0 → 100644
浏览文件 @
2dd0398a
<!--
The MIT License
Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
Daniel Dyer, Seiji Sogabe, Tom Huybrechts, Manufacture Francaise des Pneumatiques
Michelin, Romain Seguy, CloudBees, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:i="jelly:fmt" xmlns:x="jelly:xml">
<st:documentation>
Creates a small button that lets the user copies a text into clipboard
<st:attribute name="tooltip">
Tooltip of the button. Currently this doesn't work as reliably as we'd like.
More ZeroClipboard hacking is likely necessary.
</st:attribute>
<st:attribute name="text" use="required">
Text to be copied into the clipboard.
</st:attribute>
<st:attribute name="message" use="required">
Confirmation message to be shown once the text is copied.
This is required as in some browsers, button doesn't properly provide feedback to user actions
due to the nature of the hack needed to make copy work.
</st:attribute>
<st:attribute name="container">
Specify the CSS selector (like ".foo") that points to the ancestor block element that has "positive:relative".
According to ZeroClipboard documentation, having such container would improve the accuracy of invisible flash
overlay.
</st:attribute>
</st:documentation>
<span class="copy-button" tooltip="${attrs.tooltip}" text="${attrs.text}" message="${attrs.message}" container="${attrs.container}">
<input type="button"/>
</span>
<st:adjunct includes="org.kohsuke.stapler.zeroclipboard, lib.layout.copyButton.copyButton"/>
</j:jelly>
\ No newline at end of file
core/src/main/resources/lib/layout/copyButton/clipboard.png
0 → 100644
浏览文件 @
2dd0398a
此差异由.gitattributes 抑制。
core/src/main/resources/lib/layout/copyButton/copyButton.css
0 → 100644
浏览文件 @
2dd0398a
.copy-button
BUTTON
{
background
:
url('clipboard.png')
center
center
no-repeat
;
width
:
20px
;
height
:
20px
;
}
core/src/main/resources/lib/layout/copyButton/copyButton.js
0 → 100644
浏览文件 @
2dd0398a
// @include "org.kohsuke.stapler.zeroclipboard"
Behaviour
.
register
({
"
span.copy-button
"
:
function
(
e
)
{
var
btn
=
e
.
firstChild
;
var
id
=
"
copy-button
"
+
(
iota
++
);
btn
.
id
=
id
;
var
clip
=
new
ZeroClipboard
.
Client
();
clip
.
setText
(
e
.
getAttribute
(
"
text
"
));
makeButton
(
btn
);
clip
.
setHandCursor
(
true
);
var
container
=
e
.
getAttribute
(
"
container
"
);
if
(
container
)
{
container
=
$
(
e
).
up
(
container
);
container
.
style
.
position
=
"
relative
"
;
clip
.
glue
(
id
,
container
);
}
else
{
clip
.
glue
(
id
);
}
clip
.
addEventListener
(
'
onComplete
'
,
function
()
{
notificationBar
.
show
(
e
.
getAttribute
(
"
message
"
));
});
clip
.
addEventListener
(
'
onMouseOver
'
,
function
()
{
$
(
id
).
addClassName
(
'
yui-button-hover
'
)
});
clip
.
addEventListener
(
'
onMouseOut
'
,
function
()
{
$
(
id
).
removeClassName
(
'
yui-button-hover
'
)
});
clip
.
addEventListener
(
'
onMouseDown
'
,
function
()
{
$
(
id
).
addClassName
(
'
yui-button-active
'
)
});
clip
.
addEventListener
(
'
onMouseUp
'
,
function
()
{
$
(
id
).
removeClassName
(
'
yui-button-active
'
)
});
}
});
ui-samples-plugin/src/main/java/jenkins/plugins/ui_samples/CopyButton.java
0 → 100644
浏览文件 @
2dd0398a
package
jenkins.plugins.ui_samples
;
import
hudson.Extension
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* @author Kohsuke Kawaguchi
*/
@Extension
public
class
CopyButton
extends
UISample
{
@Override
public
String
getDescription
()
{
return
"A small button to copy text into a clipboard"
;
}
public
List
<
SourceFile
>
getSourceFiles
()
{
// TODO: generate this from index
return
Arrays
.
asList
(
new
SourceFile
(
"index.groovy"
));
}
@Extension
public
static
final
class
DescriptorImpl
extends
UISampleDescriptor
{
}
}
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/CopyButton/index.groovy
0 → 100644
浏览文件 @
2dd0398a
package
jenkins.plugins.ui_samples.CopyButton
;
import
lib.JenkinsTagLib
import
lib.LayoutTagLib
def
st
=
namespace
(
"jelly:stapler"
)
t
=
namespace
(
JenkinsTagLib
.
class
)
l
=
namespace
(
LayoutTagLib
.
class
)
namespace
(
"/lib/samples"
).
sample
(
title:
_
(
"Copy Button"
))
{
raw
(
_
(
"blurb"
))
div
(
style:
"margin:2em"
)
{
text
(
"Copy this text! "
)
l
.
copyButton
(
message:
"text copied"
,
text:
"here comes ABC"
,
container:
"DIV"
)
}
raw
(
_
(
"aboutContainerElement"
))
}
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/CopyButton/index.properties
0 → 100644
浏览文件 @
2dd0398a
blurb
=
\
<tt>l.copyButton</tt> tag creates a small button that allows users to paste text into the clipboard.
\
Browsers make it unbelievably hard to do this simple task, so that's why we use a tag to encapsulate it.
\
The tag requires two mandatory attributes. One is <tt>text</tt>, which represents the text to be copied into the clipboard.
\
The other is <tt>message</tt>, which represents a message to be displayed upon the successful copying into the clipboard.
aboutContainerElement
=
\
According to <a href="http://code.google.com/p/zeroclipboard/wiki/Instructions#Gluing">ZeroClipboard documentation</a>,
\
which is what we use for the copying, it is desirable to have an outer block element that houses a button, to improve
\
the accuracy of positioning a hidden flash movie. This can be specified as a CSS selector in the <tt>container</tt> attribute.
\
Note that you do not need to set the <tt>position:relative</tt> manually, as this tag will automatically set it.
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录