Using AJS to format the description

Christian Schulze June 18, 2013

Hello, I want to display the Description of an Issue in my Plugin, but I get it in this form:

h2. Welcome to your first issue {color:#707070}An issue is an item you want to track in a specific JIRA project. You can use JIRA to track all kinds of things.{color} h4. Types of issues {color:#707070}An issue could represent a software bug, a user story, a project task, a helpdesk ticket, or a leave request form, the list is endless!{color} !IssueTypes.png! h4. Issue attributes {color:#707070}You may have noticed that an issue has some system fields such as: type, priority and status. These fields are there to help you categorise and track the progress of each issue.{color} Next: [Changing an issue's status|DEMO-2] \\ ---- [Learn more about issues|https://confluence.atlassian.com/display/JIRA/What+is+an+Issue] \\

How can I use AJS to format this,or the JiraAPI to do this?

regards

chris

2 answers

0 votes
Christian Schulze June 20, 2013

Hello, thanks for that, but this is not what I search.
I want to format it too pretty looking HTML, not the Meta or whatever this is.

0 votes
OsmanA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 20, 2013

Javascript/Jquery

AJS.$(#description-val).text() will grab the description of an issue. you can trim() to remove white space. Obviously this is javascript so should be once page loads.

API

https://host:port/rest/api/2/issue/{issueid}

which will return your issue in json. Then you can assign it to a variable in javascript i.e. :

function getDescription()

{

var description;

AJS.$.ajax({

url: "/jira/rest/api/2/issue/TEST-1",

type: 'get',

dataType: 'json',

async: false,

success: function(data) {

description = data.fields['description'];

}

});

return description;

}

Christian Schulze June 20, 2013

Hello, thanks for that, but this is not what I search.
I want to format it too pretty looking HTML, not the Meta or whatever this is.

Suggest an answer

Log in or Sign up to answer