2014-07-09 3 views
3

JIRA에서 Java로 작성된 사용자 정의 필드의 편집 모드에서 일부 AUI를 사용하려고합니다. 이 페이지를 찾았습니다 : https://docs.atlassian.com/aui/latest/sandbox/# 그리고 미래에는 예제 Auiselect2를 사용하고 싶습니다.내 사용자 정의 필드에서 JIRA AUI 함수를 사용하는 방법 - 속도 edit.vm

https://docs.atlassian.com/aui/5.5.1/docs/auiselect2.html - 여기는 실험적으로 작성되었으므로 어떤 단계를 거쳐야합니까? 아래 예제에서 볼 수 있듯이,이 기능을 추가하려고 시도했지만 간단하게 작동하지 않았습니다. 나는 문서에서 언급 한 예를 들어 사용되었다 -

edit.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> 

AJS.$(function() { 
    AJS.$("#select2-example").auiSelect2(); 
}); 

을 zakaznik.js 그리고 내 골드 피처-의 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> 

하지만 편집 모드를 방문하면 jQuery가 수행되지 않고 브라우저 콘솔에 오류나 경고가 기록되지 않습니다.

답변

1

edit.vm에이 줄을 추가하면 select2 js가 포함됩니다.

$webResourceManager.requireResource("com.atlassian.auiplugin:aui-select2") 

웹 리소스에 종속성으로 추가 할 필요가 없습니다.

AJS.$("#select2-example").select2(); 
0

당신은 당신의 edit.vm

$webResourceManager.requireResourcesForContext("zakaznik") 

내가 제공 한 다른 대답에 동의하지 않는에 다음을 추가 할 필요가 - 간단하여 JS 파일 호출 선택 2에서

. 리소스 파일에 js를 이미 추가 한 경우 edit.vm 파일에서이 작업을 다시 수행해야합니다. 이미 컨텍스트를 사용하여 만든 웹 리소스를 참조하십시오.