How to make a closeable notification message on Jira, one that does not resurrect on page refresh?

Sorin Sbarnea (Citrix)
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.
May 14, 2013

While Jira Announcement banner is very usefull it is also very annoying once you read it and people will stop reading it even if you update it.

The solution is to display the message only until someone is reading and closing the message.

Atlassia AUI already have support for closeable messages but it seems that it doesn't memorize that you closed the message, so when you refresh the page the message will be displayed again.

Still, I found at least one place where Jira seems to remember this, if you go to /secure/project/ViewProjects.jspa for the first time you will see a message like this, but once you clicked close it will not appear again.

I looked at the code it my impression is that it doesn't send anything to the server. I guess that the state could be stored in a cookie.

Does anyone have an implementation that works?

<div class="aui-message closeable" id="browse-projects-info" data-type="blankproject">
            <h3>Here are your projects</h3>
        <p>You can create more projects for each of the things your team is working on. Whenever you create a new one it will appear in the list below.</p>
        <p><a class="browse-projects-info-dismiss">Thanks, I got it</a></p>
<span class="aui-icon icon-close" role="button" tabindex="0"></span></div>

2 answers

7 votes
Henning Tietgens
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.
June 23, 2015

I use the following within the announcement banner.

<div id="mycrazyuniqueid" style="display:none;" class="aui-message aui-message-info closeable">
Announcement Banner Text
</div>
<script>
    if (AJS.Cookie.read("mycrazyuniqueiddismissed") != "true"){
        document.getElementById('mycrazyuniqueid').style.display = 'block';
    }
    document.addEventListener('click', function (e) {
        var msgid = e.target.parentElement.id;
        var msgtargetclass = e.target.className;
        if (msgid == "mycrazyuniqueid" && msgtargetclass == "aui-icon icon-close") {
            console.log("Hide mycrazyuniqueid Info");
            AJS.Cookie.save("mycrazyuniqueiddismissed", "true");
        }
    });
</script>

After reading the documentation I tried addEventListener('aui-message-close',...) but that doesn't seem to work within the announcement banner. 

Henning

0 votes
Seb Kouba February 5, 2015

I'm really interested in this. Otherwise, how do you guys notify users of changes / updates? At the moment we have the permanent bar at the top and I find it really annoying...

Cheers

Suggest an answer

Log in or Sign up to answer