2017-03-02 3 views
0

Ich bin neu in Jira Plugin-Entwicklung und ich versuche, ein Projekt Tab-Panel-Plugin für JIRA (6.3.4) zu entwickeln.Hinzufügen von JS webresource zur Verwendung in Velocity

Ich habe JS-Datei um "Ressourcen/js/updateIssueTypes.js" und es funktioniert nicht in Geschwindigkeit Vorlage.

JS-Datei wird auf der Seite nicht heruntergeladen

Wo ein Fehler ist?

Hier sind die Inhalte der JS-Datei:

$(function() { 
    alert("haha"); 
    $("#selectedProject").change(function() { 
     var key = $(this).val(); 
     $("#selectedIssueType").empty(); 
     $.getJSON("/rest/api/2/project/" + key, function(data) { 
      var items = data.issueTypes; 
      $.each(data, function(key, val) { 
       var option = $('<option/>'); 
       option.attr({'value': val.id }).text(val.nameTranslation); 
       $('#selectedIssueType').append(option); 
      }); 
     }); 
    }) 
}); 

Geschwindigkeit Dateiinhalt wie folgt hat:

<head> 
#requireResource("ru.company.plugins.postfunctions.Newtask:updateIssueTypes") 
</head> 
<body> 
some code... 
</body> 

atlassian-plugin.xml hat webresources wie folgt hinzugefügt:

<?xml version="1.0" encoding="UTF-8"?> 

<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2"> 
    <plugin-info> 
    <description>${project.description}</description> 
    <version>${project.version}</version> 
    <vendor name="${project.organization.name}" url="${project.organization.url}"/> 
    <param name="plugin-icon">images/pluginIcon.png</param> 
    <param name="plugin-logo">images/pluginLogo.png</param> 
    </plugin-info> 

    <!-- add our i18n resource --> 
    <resource type="i18n" name="i18n" location="i18n"/> 

    <!-- add our web resources --> 
    <web-resource key="new-task-resources" name="new-task Web Resources"> 
    <resource type="download" name="images/" location="resources/images"/> 
    <context>new-task</context> 
    </web-resource> 


    <web-resource key="updateIssueTypes" name="updateIssueTypes" > 
    <resource type="download" name="updateIssueTypes" location="js/updateIssueTypes.js"/> 
    <context>new-task</context> 
    <context>atl.general</context> 
    <context>jira.general</context> 
    </web-resource> 


    <workflow-function key="new-task" name="New Task" i18n-name-key="new-task" class="ru.company.jira.workflow.NewTaskFactory"> 
    <description key="new-task.description">The New Task Plugin</description> 
    <function-class>ru.company.jira.workflow.NewTask</function-class> 
    <resource type="velocity" name="view" location="templates/postfunctions/new-task.vm"/> 
    <resource type="velocity" name="input-parameters" location="templates/postfunctions/new-task-input.vm"/> 
    <resource type="velocity" name="edit-parameters" location="templates/postfunctions/new-task-input.vm"/> 
    </workflow-function> 
</atlassian-plugin> 

pom.xml wie folgt:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>ru.company.plugins.postfunctions</groupId> 
    <artifactId>Newtask</artifactId> 
    <version>1.0.1</version> 
.......some code........ 
+0

"funktioniert nicht" ist nicht gerade eine ausführliche Beschreibung des Problems. – planetmaker

+0

js Datei wird nicht auf die Seite heruntergeladen ... –

Antwort

1

Gelöst!

alte Version:

<head> 
#requireResource("ru.company.plugins.postfunctions.Newtask:updateIssueTypes") 
</head> 

neue Version:

<head> 
</head> 
$webResourceManager.requireResource("ru.eldorado.plugins.postfunctions.Newtask:new-task-resources") 
Verwandte Themen