【问题标题】:CSS styling doesn't take into effect inside project tab panel for Jira pluginCSS 样式在 Jira 插件的项目选项卡面板中不起作用
【发布时间】:2014-12-11 15:22:55
【问题描述】:

我是 Jira 插件开发的新手,我正在尝试为 JIRA (6.3.9) 开发一个项目选项卡面板插件。

对于标签面板的样式,我在“resources/css/tabpanel.css”中有 CSS 文件

以下是 CSS 文件的内容:

div.status{
    float:left; 
    min-width:18%; 
    height:auto;
    text-align:center; 
    border:1px solid black; 
    border-radius: 5px; 
    margin:2px;
    background-color: #e6e6fa
}

div.issues{
	background-color:#add8e6; 
	margin:5px; 
	border: 1px;
	text-align:left
}

velocity 文件的内容如下:

<div class="module">
    <div class="mod-content">
     <div id="statuses" class="aui">
      #foreach($status in $statuses)				
        <div id="status" class="aui" ><Strong>$status.getNameTranslation()</Strong>
    	  #foreach($issue in $issues)
    		#if($status.getId() == $issue.getStatusObject().getId())					
    		  <div  id="issues">			
    			...
    		  </div>
    	    #end						
    	  #end				
        </div>								
      #end
    </div>	
  </div>
</div>

atlassian-plugin.xml 添加了这样的网络资源:

<web-resource key="tabpanel-resources" name="tabpanel Web Resources">
    <dependency>com.atlassian.auiplugin:ajs</dependency>
    <dependency>jira.webresources:jira-global</dependency>
    <resource type="download" name="tabpanel.css" location="/css/tabpanel.css"/>
    <resource type="download" name="tabpanel.js" location="/js/tabpanel.js"/>
    <resource type="download" name="images/" location="/images"/>
    <context>atl.general</context>
    <context>tabpanel</context>
    <context>jira.general</context>    
</web-resource>

但是,CSS 样式在 tabpanel 中没有生效,我尝试添加 $webResourceManager.requireResourcesForContext("plugin-key:resourceskey")

"requireResource("pluginkey:web-resource-key")"

但它似乎不起作用。请帮助我了解出了什么问题。我试图查看 atlassian 答案页面,但没有帮助。

【问题讨论】:

    标签: css jira velocity jira-plugin


    【解决方案1】:

    确保您的插件密钥是正确的。 在您的 atlassian-plugin.xml 顶部附近,您应该会找到如下所示的一行:&lt;atlassian-plugin key="${project.groupId}.${project.artifactId}" ...&gt;

    project.groupId 是 pom.xml 中的 groupId,project.artifactId 是 pom.xml 中的 artifactId。

    假设您的 groupId 是 com.atlassian.plugins 并且您的 artifactId 是 tabpanel,然后使用您的 Web 资源密钥 tabpanel-resources(如 &lt;web-resource key="tabpanel-resources" name="tabpanel Web Resources"&gt; 这一行所示),生成的 requireResource 语句应该是:

    #requireResource("com.atlassian.plugins.tabpanel:tabpanel-resources")
    

    这应该放在 Velocity 模板的顶部,宏会将资源放入生成的 HTML 的 head 元素中。

    可能的其他原因

    #requireResource 部分是一个 velocimacro,可通过 Velocity 模板中的 webResourceManager 对象访问。因此,如果它不起作用,请确保将 JiraWebResourceManager 的实例放入具有“webResourceManager”键的速度模板的上下文映射中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多