Jira agile could not render html

Marcin Beczynski August 11, 2016

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

0 votes
Marcin Beczynski August 11, 2016

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

0 votes
Jonny Carter
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.
August 11, 2016

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?

0 votes
JamieA
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.
August 11, 2016

it probably escapes your html tags...?

0 votes
Jonny Carter
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.
August 11, 2016

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 votes
Marcin Beczynski August 11, 2016

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

 

0 votes
Jonny Carter
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.
August 11, 2016

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

Suggest an answer

Log in or Sign up to answer