Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
c77baaae
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,发现更多精彩内容 >>
提交
c77baaae
编写于
4月 16, 2013
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
improving the sample to cover ModelObjectWithChildren
上级
e6da4f77
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
3 deletion
+29
-3
ui-samples-plugin/src/main/java/jenkins/plugins/ui_samples/NavigationContextMenu.java
...ava/jenkins/plugins/ui_samples/NavigationContextMenu.java
+12
-2
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/NavigationContextMenu/index.groovy
...ins/plugins/ui_samples/NavigationContextMenu/index.groovy
+6
-0
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/NavigationContextMenu/index.properties
...plugins/ui_samples/NavigationContextMenu/index.properties
+11
-1
未找到文件。
ui-samples-plugin/src/main/java/jenkins/plugins/ui_samples/NavigationContextMenu.java
浏览文件 @
c77baaae
package
jenkins.plugins.ui_samples
;
import
hudson.Extension
;
import
jenkins.model.Jenkins
;
import
jenkins.model.ModelObjectWithChildren
;
import
jenkins.model.ModelObjectWithContextMenu
;
import
org.kohsuke.stapler.StaplerRequest
;
import
org.kohsuke.stapler.StaplerResponse
;
...
...
@@ -9,7 +11,7 @@ import org.kohsuke.stapler.StaplerResponse;
* @author Kohsuke Kawaguchi
*/
@Extension
public
class
NavigationContextMenu
extends
UISample
implements
ModelObjectWithContextMenu
{
public
class
NavigationContextMenu
extends
UISample
implements
ModelObjectWithContextMenu
,
ModelObjectWithChildren
{
@Override
public
String
getDescription
()
{
return
"Integrate with navigational context menu to provider quick access around object graph"
;
...
...
@@ -29,10 +31,18 @@ public class NavigationContextMenu extends UISample implements ModelObjectWithCo
return
new
ContextMenu
()
.
add
(
"http://jenkins-ci.org/"
,
"Jenkins project"
)
.
add
(
"http://www.cloudbees.com/"
,
"CloudBees"
)
.
add
(
request
.
getContextPath
(),
"/images/24x24/gear.png"
,
"top-page"
);
.
add
(
request
.
getContextPath
(),
Jenkins
.
RESOURCE_PATH
+
"/images/24x24/gear.png"
,
"top-page"
);
}
}
public
ContextMenu
doChildrenContextMenu
(
StaplerRequest
request
,
StaplerResponse
response
)
throws
Exception
{
// You implement this method in much the same way you do doContextMenu
return
new
ContextMenu
()
.
add
(
"http://yahoo.com/"
,
"Yahoo"
)
.
add
(
"http://google.com/"
,
"Google"
)
.
add
(
"http://microsoft.com/"
,
"Microsoft"
);
}
@Extension
public
static
final
class
DescriptorImpl
extends
UISampleDescriptor
{
}
...
...
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/NavigationContextMenu/index.groovy
浏览文件 @
c77baaae
...
...
@@ -34,6 +34,12 @@ namespace("/lib/samples").sample(title:_("Navigational context menu integration"
example
"<a href='..' class='model-link'>up</a>"
}
raw
(
_
(
"blurb.modelLink.inside"
))
table
(
border:
1
)
{
example
"<a href='.' class='model-link inside'>self</a>"
example
"<a href='..' class='model-link inside'>up</a>"
}
raw
(
_
(
"blurb.tltr"
))
table
(
border:
1
)
{
example
"<a href='.' class='model-link tl-tr'>self</a>"
...
...
ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/NavigationContextMenu/index.properties
浏览文件 @
c77baaae
...
...
@@ -7,11 +7,21 @@ blurb.define=<p>To define a context menu on <tt>ModelObject</tt>, implement <a h
blurb.breadcrumb
=
<p>Implementing <tt>ModelObjectWithContextMenu</tt> is sufficient for the core to show the context menu
\
for your model object in the breadcrumb. Hover your mouse over the breadcrumb of this page to see context menu
\
associated with this sample.
associated with this sample.
\
<p>
\
In addition, implementing
\
<a href="http://javadoc.jenkins-ci.org/byShortName/ModelObjectWithChildren"><tt>ModelObjectWithChildren</tt></a>
\
enables you to show children of your model object in the breadcrumb when you click the ''>'' icon that separates
\
breadcrumb items.
blurb.modelLink
=
<p>By adding CSS class "model-link" to the <a> tags pointing to model objects with context menu,
\
you can enable the context menu support to that hyperlink. For example:
blurb.modelLink.inside
=
\
<p>Unless the hyperlink appears inline, it is often better to pre-allocate a space for the context menu anchor
\
that appears when the mouse hovers over. To do this, also add the 'inside' CSS element. For example:
blurb.tltr
=
<p>By default, context menu appears below the link ,but this is inconvenient when model links line up in a vertical list.
\
Add additional "tl-tr" CSS class (read it as 'top-left of the context menu to top-right of the target anchor) to
\
make context menu appear on the right.
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录