It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Issue Collector button is not appearing

@Steven Behnke I am looking to add an Issue Collector to my Confluence Page (single page), I am running Confluence 3.5.11 and JIRA 6.3.12.

 

The issue collector is set up for custom and I went to my confluence page and inserted the HTML macro you pasted above (replacing my url for src) 

 

{html}
    <script>
    AJS.toInit(function(){
    AJS.$('.aui-header-primary .aui-nav').append('<li><a href="#" id="myIssueTrigger" class="aui-button aui-style aui-button-primary aui-nav-imagelink">Bug Report</a></li>');
    });
    </script>
 
    <script type="text/javascript" src="http://jira/s/0c13895773c11edccb53ae66c985466f-T/en_US83oybm/6343/12/1.4.16/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js&collectorId=8f47a897"></script>
    <script type="text/javascript">window.ATL_JQ_PAGE_PROPS = {
        "triggerFunction": function(showCollectorDialog) {
        //Requires that jQuery is available!
        //Use whatever ID you used on your Button/Trigger
        //In this case, I used id="myIssueTrigger" in the Button/<a> element
        //So I must use #myIssueTrigger here
            jQuery("#myIssueTrigger").click(function(e) {
            e.preventDefault();
            showCollectorDialog();
        });
    }};</script>
{html}

After I save I see nothing on the page that is different. I have attached a photo (I had to color out the tree for this page on the left and our logo) but I am not sure where I should see this button.

Capture.JPG

I have tried using the method described in the wiki from Atlassian and I did not see the button either. 

1 answer

1 accepted

1 vote
Answer accepted
Steven Behnke Community Leader Feb 26, 2016

Hi Jeremy, thanks for opening a new question. The reason my other answer (https://answers.atlassian.com/questions/31654942) doesn't work for you is because of the difference in Confluence versions. My how-to was written for Confluence 5+, specifically Confluence 5.7.4. Things certainly have changed since Confluence 3.X.

I chose a simple route of appending the "Bug Report" button to the big Create button at the top of the screen like so – AJS.$('.aui-header-primary .aui-nav').append('<li><a href="#" id="myIssueTrigger" class="aui-button aui-style aui-button-primary aui-nav-imagelink">Bug Report</a></li>');
image2016-2-26 13:22:9.png 

 

This Create button doesn't exist in your version of Confluence! Your code isn't finding anything to append to. Further, the AUI pack doesn't exist here either. We should use classes that Confluence is using in our version.
image2016-2-26 13:23:53.png 

 

Instead, let's prepend it to the Browse menu with a menu-item.

AJS.$('#header-menu-bar').prepend('&lt;li class="normal ajs-menu-item"&gt;&lt;a href="#" id="myIssueTrigger"&gt;Bug Report&lt;/a&gt;&lt;/li&gt;');

image2016-2-26 13:35:40.png

 

If you wanted a button on the page, you could use <button id="myIssueTrigger">Bug Report</button> instead of all this prepending/appending nonsense. 

image2016-2-26 13:38:55.png

Honestly a button would be much easier. I am not good with javascript/html so I apologize if I ask a bunch of questions.

To add the button would I just replace the append/prepend script with the button code?

{html}
    &lt;script&gt;
     &lt;button id="myIssueTrigger"&gt;Bug Report&lt;/button&gt;
    &lt;/script&gt;
 
    &lt;script type="text/javascript" src="http://jira/s/0c13895773c11edccb53ae66c985466f-T/en_US83oybm/6343/12/1.4.16/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js&amp;collectorId=8f47a897"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;window.ATL_JQ_PAGE_PROPS = {
        "triggerFunction": function(showCollectorDialog) {
        //Requires that jQuery is available!
        //Use whatever ID you used on your Button/Trigger
        //In this case, I used id="myIssueTrigger" in the Button/&lt;a&gt; element
        //So I must use #myIssueTrigger here
            jQuery("#myIssueTrigger").click(function(e) {
            e.preventDefault();
            showCollectorDialog();
        });
    }};&lt;/script&gt;
{html}

If that is the case I am still not seeing anything on confluence page. 

 

Steven Behnke Community Leader Feb 26, 2016

Close: Don't put a HTML element in script tags – It's not javascript anymore, we're just adding an HTML button.

{html}
     &lt;button id="myIssueTrigger"&gt;Bug Report&lt;/button&gt;
  
    &lt;script type="text/javascript" src="http://jira/s/0c13895773c11edccb53ae66c985466f-T/en_US83oybm/6343/12/1.4.16/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js&amp;collectorId=8f47a897"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;window.ATL_JQ_PAGE_PROPS = {
        "triggerFunction": function(showCollectorDialog) {
        //Requires that jQuery is available!
        //Use whatever ID you used on your Button/Trigger
        //In this case, I used id="myIssueTrigger" in the Button/&lt;a&gt; element
        //So I must use #myIssueTrigger here
            jQuery("#myIssueTrigger").click(function(e) {
            e.preventDefault();
            showCollectorDialog();
        });
    }};&lt;/script&gt;
{html}

Good news is I have a button now but it is not firing the javascript to launch the issue collector

I found my issue. Thanks so much!!!!!!

Steven Behnke Community Leader Feb 26, 2016

No problem! Good luck, ask questions if you never need anything! I'm around from time to time. wink

hi Jeremy & Steve,

I am having the same problem button not firign the JS. I have opened a ticket. Can you please check that and see if you can help me with that? 

Thank you! :)

First of all, thank you Steven for all the time you've invested on this topic.

I have the same issue - the button is showing up fine but the JS is not firing.
Appreciate your help!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

6 Awesome Ways to Apply Trello, JIRA and Confluence to your Project

I attended  Atlassian Summit 2019  and learned a lot from the presenters, attendees and knowledgeable Atlassian product managers. The presentations I attended focused on applying Agile, pla...

4,041 views 15 38
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you