Jira agile could not render html

Hey, All

After update jira-greenhopper-plugin from version 6.7.4  to 6.7.14 agile could not render html at card layout anymore this field is scripted field and work fine when you go to issue but at card layout get error the same visible at screen. I already try to clear plugin  cache and update universal plugin 

 

Thanks in advice for all hits

 

JIRA version 6.3.15

Agile version  6.7.14

SR version 4.1.3.15

universal plugin version 2.21.3

screen.PNG

6 answers

Could you show some of the code for your scripted field? Particularly the HTML it is supposed to output.

Sure script bellow 


import org.ofbiz.core.entity.GenericValue;
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.project.Project;
import com.atlassian.jira.project.ProjectManager
import groovy.xml.MarkupBuilder

****

field+="<style>";
field+=".styled progress {";
/* Reset the default appearance */
field+="-webkit-appearance: none;";
field+="-moz-appearance: none;";
field+="appearance: none;";
field+="width: 150px;";
field+="height: 30px;";
/* Firefox */
field+="border: none;";
field+="background: #EEE;";
field+="border-radius: 3px;";
field+="}";
field+=".styled progress::-webkit-progress-bar {";
field+="background: #EEE;";
field+="border-radius: 3px;";
field+="}";
field+=".styled progress::-webkit-progress-value {";
field+="background-color: #CC0000;";
field+="border-radius: 3px;";
field+="}";
field+=".styled progress::-moz-progress-bar {";
field+="background-color: #CC0000;";
field+="border-radius: 3px;";
field+="}";
field+=".styled meter {";
/* Reset the default appearance */
/*field+="-webkit-appearance: none;";*/
field+="-moz-appearance: none;";
field+="appearance: none;";
field+="width: 140px;";
field+="height: 18px;";
/* For Firefox */
field+="background: #EEE;";
field+="border-radius: 3px;";
field+="}";
/* WebKit */
field+=".styled meter::-webkit-meter-bar {";
field+="background: #EEE;";
field+="border-radius: 3px;";
field+="}";
field+=".styled meter::-webkit-meter-optimum-value,";
field+=".styled meter::-webkit-meter-suboptimum-value,";
field+=".styled meter::-webkit-meter-even-less-good-value {";
field+="border-radius: 3px;";
field+="}";
field+=".styled meter::-webkit-meter-optimum-value {";
field+="background: #86CC00;";
field+="}";
field+=".styled meter::-webkit-meter-suboptimum-value {";
field+="background: #ffd351;";
field+="}";
field+=".styled meter::-webkit-meter-even-less-good-value {";
field+="background: #d04437;";
field+="}";
/* Firefox */
field+=".styled meter::-moz-meter-bar {";
field+="border-radius: 3px;";
field+="}";
field+=".styled meter:-moz-meter-optimum::-moz-meter-bar {";
field+="background: #86CC00;";
field+="}";
field+=".styled meter:-moz-meter-sub-optimum::-moz-meter-bar {";
field+="background: #ffd351;";
field+="}";
field+=".styled meter:-moz-meter-sub-sub-optimum::-moz-meter-bar {";
field+="background: #d04437;";
field+="}";
field+="button {";
field+="display: inline-block;";
field+="border-radius: 3px;";
field+="border: none;";
field+="font-size: 0.9rem;";
field+="padding: 0.4rem 0.8em;";
field+="background: #69c773;";
field+="border-bottom: 1px solid #498b50;";
field+="color: white;";
field+="-webkit-font-smoothing: antialiased;";
field+="font-weight: bold;";
field+="margin: 0 0.25rem;";
field+="text-align: center;";
field+="}";
field+="button:hover, button:focus {";
field+="opacity: 0.75;";
field+="cursor: pointer;";
field+="}";
field+="button:active {";
field+="opacity: 1;";
field+="}";
field+="</style>";

******

field += "<div class=\"styled\">";
field += "<meter value=\"" + ActualCost + "\" min=\"0\" max=\"" + PlannedBudget + "\" high=\""+ h + "\" low=\"" + lo +"\" optimum=\"" + opt + "\"></meter></br>";
field += "<span>" + ActualCost.abs() + "/" + PlannedBudget.round();
if (remaining<0)
field += "<span style=\"color:#CC4600;\"> over " + remaining.abs() + " m/d</span>";
else
field += "<span> left " + remaining.abs() + " m/d</span>";
field += "</div>";

return field

 

There are some things I don't get about your script. PlannedBudget is an int, but you're calling .round() on it. Also, you've got PlanedBudget at the declaration point, then PlannedBudget everywhere else.

I was able to get your script working in JIRA 7 with SR 4.3.5. Let me try switching back to your version of JIRA. 

0 vote

it probably escapes your html tags...?

Yeah, it's definitely stripping out all the HTML tags, even when the field is configured to output HTML. Not sure if that's something JIRA changed with the advent of JIRA Software to replace/update JIRA Agile?

Thanks guys for helps it start work's after change HTML 
BTW it's a litle strange the same code  work perfectly fine a JIRA Software but don't work at JIRA 6.3.15

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Fadoua M. Boualem
Published yesterday in Trello

Using Trello to manage events

As a Jira power user, I was at first doubtful that Trello could benefit my workflow. Jira already uses boards (ones you can customize!), so why would I even need to use Trello?! In this post you will...

425 views 5 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you