Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to create custom Footer with Script Runner

Alvaro Rodriguez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 14, 2023

I had to create a custom Footer with only "Impresum" and display it everywhere in Jira. Since I didn't find that much help, I wanted to share my work with the community.

Here the ScriptrRunner Documentation Web Resource.

1. First you need to edit JVM_REQUIRED_ARGS in the file setenv.sh (or .batand add following value


'-Dplugin.resource.directories=D:/Jira_home/scripts -Dother.properties'

 

// ExampleJVM_REQUIRED_ARGS='-Dlog4j2.contextSelector=org.apache.logging.log4j.core.selector.BasicContextSelector -Dlog4j2.disableJmx=true -Dlog4j2.garbagefree.threadContextMap=true -Dlog4j2.isWebapp=false -Djava.awt.headless=true -Datlassian.standalone=JIRA -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dmail.mime.decodeparameters=true -Dorg.dom4j.factory=com.atlassian.core.xml.InterningDocumentFactory -Dplugin.resource.directories=/var/atlassian/application-data/jira/scripts -Dother.properties...'

 

2. Create a new directory "custom-footer" in your scripts directory (for me /var/atlassian/application-data/jira/scripts)

3. Create two new files in the directory:

 custom-footer.js

AJS.toInit(function() { 
// Add new div-Element
const customFooter = AJS.$("<div>")
.attr("id", "custom-footer")
.addClass("custom-footer");

//Create a-Element and set properties
const impressumLink = AJS.$("<a>")
.attr("href", "https://my.company/info/impressum/")
.attr("target", "_blank")
.attr("rel", "nofollow")
.text("Impressum");

// Add the a-Element to the div-Element
customFooter.append(impressumLink);

// Find the footer-Element
const footerElement = AJS.$("footer");

// Check, if the footer-Element was founded
if (footerElement.length) {
// Add div-Element after footer-Element
footerElement.after(customFooter);
} else {
console.error("Footer-Element couldn't be founded");
}

}
});

 

 custom-footer.css

.custom-footer { 
font-size: 12px;
font-weight: bold;
line-height: 1.66666667;
text-transform: uppercase;
margin-top: 40px;
cursor: pointer;
text-align: center;
margin-bottom: 70px
}

.custom-footer a {
color: #707070 !important;
text-decoration: underline;
}

.custom-footer a:hover {
color: #0052cc !important;
}

.footer-body{
display: none !important;
}

 

4. Restart Jira

5. Create new web resource in ScriptRunner fragments

Note: custom-footer

Context(s): atl.admin atl.global

Key: custom-footer

Resources:

test-resources/custom-footer.js
test-resources/custom-footer.css

web resource.PNG

You will need to hard refresh your browser to see the changes, or you can set -Datlassian.dev.mode=true (only in a development instance is recommended).

Please feel free to give me feedback if you have any suggestions :)

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events