Jira插件开发中引入Bootstrap

jira本身是带有aui的,个人还是比较喜欢jQuery及Bootstrap,jira里面也内置了jQuery,页面中使用jQuery的时候只需要将$换成jQuery就可以了,例如使用Bootstrap的弹出提示

$webResourceManager.requireResource("com.company.jira.test:bootstrap-resources")
<script>
    jQuery(function () {
        jQuery("#test").popover({
            title:'迭代总结',
            html:true,
            content:function(){
                return '迭代总结内容';
            }
        });
    });
</script>
<a id="test" href="#">填写迭代总结</a>

 

 

如何引入Bootstrap?下载Bootstrap得到bootstrap.css、bootstrap.js以及两个png图片文件,分别将它们放入项目resources下的css、js和img文件夹中

需要在atlassian-plugin.xml注册资源

 

<web-resource key="bootstrap-resources" name="Bootstrap Resources">
        <resource type="download" name="bootstrap.css" location="css/bootstrap.css" />
        <resource type="download" name="glyphicons-halflings.png" location="img/glyphicons-halflings.png">
            <param name="content-type" value="image/png"/>
        </resource>
        <resource type="download" name="glyphicons-halflings-white.png" location="img/glyphicons-halflings-white.png">
            <param name="content-type" value="image/png"/>
        </resource>
        <resource type="download" name="bootstrap.js" location="js/bootstrap.js" />
    </web-resource>

 

 

如果需要用到bootstrap中的icon,那么就需要修改一下css中对应的图片路径,不用可以跳过

打开bootstrap.css搜索png,可以搜到2个地方分别在2285行和2309行

 

background-image: url("../../download/resources/atlassian-plugin-key:bootstrap-resources/glyphicons-halflings.png");

background-image: url("../../download/resources/atlassian-plugin-key:bootstrap-resources/glyphicons-halflings-white.png");

 atlassian-plugin-key是该插件的key即atlassian-plugin.xml中的key值

<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">

 

 

在页面中引入

$webResourceManager.requireResource("atlassian-plugin-key:bootstrap-resources")

 atlassian-plugin-key同上

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值