Issue Collector button is not appearing

Jeremy Schrecengost February 26, 2016

@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 F Behnke
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.
February 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

Jeremy Schrecengost February 26, 2016

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 F Behnke
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.
February 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}
Jeremy Schrecengost February 26, 2016

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

Jeremy Schrecengost February 26, 2016

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

Steven F Behnke
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.
February 26, 2016

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

Krishna July 7, 2017

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! :)

Ronny Katzenberger February 27, 2018

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
TAGS
AUG Leaders

Atlassian Community Events