Skip to content

Commit

Permalink
Corrected context bugs at atlassian-plugin.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Casals committed Aug 7, 2012
1 parent 0dbb0e2 commit 1f6d0dd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
11 changes: 9 additions & 2 deletions src/main/java/org/freedomsponsors/plugins/jira/SponsorThis.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.atlassian.crowd.embedded.api.User;
import com.atlassian.jira.config.properties.APKeys.JiraIndexConfiguration;
import com.atlassian.jira.config.properties.ApplicationProperties;
import com.atlassian.jira.functest.config.JiraConfig;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.plugin.webfragment.contextproviders.AbstractJiraContextProvider;
Expand All @@ -15,15 +16,21 @@

public class SponsorThis extends AbstractJiraContextProvider
{
private final ApplicationProperties applicationProperties;

public SponsorThis(ApplicationProperties applicationProperties) // magic constructor
{
this.applicationProperties = applicationProperties;
}

@Override
public Map getContextMap(User user, JiraHelper jiraHelper) {
Map contextMap = new HashMap();
//String baseUrl = (String)jiraHelper.getContextParams().get("baseurl");
String baseUrl = applicationProperties.getString("jira.baseurl");
Issue currentIssue = (Issue) jiraHelper.getContextParams().get("issue");
String issueKey = currentIssue.getKey();
contextMap.put("issueKey", issueKey);
//contextMap.put("baseUrl", baseUrl);
contextMap.put("baseUrl", baseUrl);


return contextMap;
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/atlassian-plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
<web-item key="sponsor-issue" name="Sponsor this issue" section="operations-operations" weight="100">
<label>Sponsor this issue!</label>
<tooltip>Sponsors the issue at FreedomSponsors.org</tooltip>
<link linkId="manage-project-link" absolute="true">http://www.freedomsponsors.org/core/issue/sponsor?trackerURL=${baseurl}/browse/${issue.key}</link>
<context-provider class="org.freedomsponsors.plugins.jira.SponsorThis"/>
<link linkId="manage-project-link" absolute="true">http://www.freedomsponsors.org/core/issue/sponsor?trackerURL=${baseUrl}/browse/${issue.key}</link>
</web-item>
<resource type="i18n" name="i18n" location="org.freedomsponsors.plugins.jira"/>
<web-panel name="SponsorThis" i18n-name-key="sponsor-this.name" key="sponsor-this" location="atl.jira.view.issue.right.context" weight="1000">
<label key="sponsor-this.title"/>
<description key="sponsor-this.description">The SponsorThis Plugin</description>
<!--<context-provider class="org.freedomsponsors.plugins.jira.SponsorThis"/>-->
<context-provider class="org.freedomsponsors.plugins.jira.SponsorThis"/>
<resource name="view" type="velocity" location="sponsorthis.vm"/>
</web-panel>
</atlassian-plugin>
2 changes: 1 addition & 1 deletion src/main/resources/sponsorthis.vm
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<p>
<a style="font-weight: bold; color: green;" href="http://www.freedomsponsors.org/core/issue/sponsor?trackerURL=${baseurl}/browse/${issue.key}">Sponsor $issue.key on FreedomSponsors.org $issue.project.url</a>
<a style="font-weight: bold; color: green;" href="http://www.freedomsponsors.org/core/issue/sponsor?trackerURL=${baseUrl}/browse/${issueKey}">Sponsor $issueKey on FreedomSponsors.org</a>
</p>
Binary file modified target/jira-1.0-SNAPSHOT.jar
Binary file not shown.

0 comments on commit 1f6d0dd

Please sign in to comment.