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

Announcement banner depending on page visited

Leirbag Assuab October 9, 2018

Hi! I have developed a custom announcement banner depending on page visited using an easy frontend coding (html+js+jquery). In my case, I wanted to advise users about login issues on login page. And once logged, advise them about programmed Jira reboot but only on dashboard pages.

This is how I coded announcement banner:

<script type="text/javascript">
(function($) {
.....
    AJS.toInit(function(){
        // init on load
        .....
        if (($('#login-form').length === 1) || ($('#loginform').length === 1)) {
            $('#alert-ACME-ldap').fadeIn(2500);
        } else if ($(location).attr('pathname').indexOf("Dashboard.jspa") !== -1) {
            $('#alert-ACME-reboot').show();
        }
    });
    .....
})(AJS.$);
</script>
<div id="alert-ACME-ldap" style="display: none;">
  <div id="aui-flag-container"><div class="aui-flag" aria-hidden="false" id="upgrade-notification" application="JIRA" severity="warning"><div class="aui-message aui-message-warning warning closeable shadowed"><div class="body">We are working to solve intermittent issues with the Active Directory. That is why JIRA may not let you authenticate. If so, try again in a few minutes and apologize for any inconvenience!</div></div></div></div>
</div>
<div id="alert-ACME-reboot" style="display: none;">
  <div id="aui-flag-container"><div class="aui-flag" aria-hidden="false" id="upgrade-notification" application="JIRA" severity="warning"><div class="aui-message aui-message-warning warning closeable shadowed"><div class="body">Today <b>OCT-9th</b> at <b>16:15h</b> JIRA will be restarted due to maintenance tasks. The downtime will last about 15 minutes. Sorry for any inconvenience caused.</div></div></div></div>
</div>

I would like to share it with this community because maybe could be useful to someone. I also would like to know the opinion of you experts and any advices to correct or improve this code will be welcome.

imagen.pngimagen.png

1 comment

Vladimir Verlin June 2, 2022

Hi, is it possible to make a similar message only for the Tempo plugin screen

Leirbag Assuab June 2, 2022

Hi! I guess so. Look at the code, the trick is simply find any "div" or other html element by id, that let you know that you are certainly on the right screen where you want to show your banner. So, navigate to Tempo plugin, show browser develop options and search for any div ID that let you assure you are at Tempo plugin screen.

I think a simple "&&" condition with "#tempo-container" and maybe "#myWorkCalendarContainer" (just for main page), will work for you. Give it a try and tell me...
(but I'm no longer Jira admin, nor jira developer, I can't test it for you, sorry)

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events