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

Run an AJS jquery function on Jira Dashboard?

moxin
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.
March 20, 2013

I have been trying to run a jquery function on Dashboard page when it loads,
i have tried to add context to web resource but can't get it to work.
Here is the Web Resource code:

<web-resource key="1-resources" name="1 Web Resources">
        <dependency>com.atlassian.auiplugin:ajs</dependency>
		<dependency>jira.webresources:global-static</dependency>
		<dependency>jira.webresources:jira-global</dependency>
		<dependency>jira.web.resources:ajs</dependency>
		<dependency>jira.web.resources:jquery</dependency>
        <description>JavaScript</description>
        
        <resource type="download" name="1.css" location="/css/1.css"/>
        <resource type="download" name="1.js" location="/js/1.js"/>
        <resource type="download" name="images/" location="/images"/>

        <context>jira.dashboard</context>
		<context>atl.dashboard</context>
		<context>atl.general</context>
		<context>atl.admin</context>
		<context>atl.userprofile</context>
		<context>atl.popup</context>
    </web-resource>

And here is the JS file

AJS.$(document).ready(function(){
	AJS.$(".dashboard-item-title").each(function() {
		var $this = $(this);
		$this.replaceWith($("<h5 style='padding-left:8px;color:white'>" + $this.html() + "</h5>"));
	});
});

What could be the problem here. Please help.

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Sean Curtis
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 20, 2013

Fairly sure your JS and webresource declaration is correct. The markup on the dashboard is generated after DOM ready - so your JS is probably not finding anything. What are you trying to achieve? Smaller text with more left padding and white text?

Why not just ignore JS and override it purely with CSS?

.dashboard-item-title {
    font-size: 14px !important;
    color: white !important;
    padding-left: 8px !important;
}

I'm not one to advocate using !important but if you are just playing around then this will work.

moxin
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.
March 20, 2013

worked like a charm! thanks.

0 votes
moxin
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.
March 20, 2013

anybody, all i want is to run a simple JS on dashboard.
Or have JIRA 6 changed the way JS is loaded on page.

TAGS
AUG Leaders

Atlassian Community Events