gan*_*oes 5 javascript jquery velocity custom-fields jira-plugin
我正在尝试在我的 JIRA 中使用一些 AUI - 在用 JAVA 编写的我自己的自定义字段的编辑模式下。我找到了这个页面: https: //docs.atlassian.com/aui/latest/sandbox/#,将来我想使用设置一个示例 Auiselect2。
https://docs.atlassian.com/aui/5.5.1/docs/auiselect2.html - 这里写的是,这只是实验性的,那么我应该执行哪些步骤来使用它?在下面的示例中,您可以看到,我试图添加此功能,但它简单地不起作用。我正在使用文档中提到的示例 -
编辑.vm:
$webResourceManager.requireResource("cz.firma.rozy:zakaznik")
<form class="aui">
<select id="select2-example" multiple>
<option value="CONF">Confluence</option>
<option value="JIRA">JIRA</option>
<option value="BAM">Bamboo</option>
<option value="JAG">JIRA Agile</option>
<option value="CAP">JIRA Capture</option>
<option value="AUI">AUI</option>
</select>
</form>
Run Code Online (Sandbox Code Playgroud)
和 zakaznik.js
AJS.$(function() {
AJS.$("#select2-example").auiSelect2();
});
Run Code Online (Sandbox Code Playgroud)
我的 atlassian-plugin.xml 是:
<web-resource key="zakaznik-resources" name="zakaznik Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<dependency>com.atlassian.auiplugin:jquery</dependency>
<dependency>com.atlassian.auiplugin:jquery-ui-other</dependency>
<dependency>com.atlassian.auiplugin:aui-select2</dependency>
<context>atl.general</context>
<context>atl.admin</context>
<resource type="download" name="zakaznik.css" location="/css/zakaznik.css"/>
<resource type="download" name="zakaznik.js" location="/js/zakaznik.js"/>
<resource type="download" name="images/" location="/images"/>
<context>zakaznik</context>
</web-resource>
...
<customfield-type name="Pridani zakaznika" i18n-name-key="customer-add.name" key="customer-add" class="cz.firma.rozy.jira.customfields.CustomerCustomField">
<description key="customer-add.description">Plugin, ktery prida zakaznika z abry</description>
<resource name="view" type="velocity" location="templates/viewCustomer.vm"/>
<resource name="edit" type="velocity" location="templates/edit.vm"/>
</customfield-type>
Run Code Online (Sandbox Code Playgroud)
但是当我访问编辑模式时,没有 jQuery 完成 - 并且浏览器控制台不会写入任何错误或警告。
只需将此行添加到 edit.vm 即可包含 select2 js。
$webResourceManager.requireResource("com.atlassian.auiplugin:aui-select2")
Run Code Online (Sandbox Code Playgroud)
您不需要将其添加为网络资源中的依赖项。
在您的 js 文件中,只需通过 - 调用 select2
AJS.$("#select2-example").select2();
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5042 次 |
最近记录: |