Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

In this example, we will hide two checkbox attributes if the users try to log work on any other project than the project ITSD. These two checkboxes only need to be shown when work is logged on ITSD-issues.

Hide fields depending on project
// Enter your fieldnames here:
var firstItemName = 'OnCall';
var secondItemName = 'Remote';
var projectKey = 'ITSD';

// Don't change the code below this line
var tempoList = '.tempoStaticList';
var hideItemOne = '#popup_' + firstItemName + '_';
var hideItemTwo = '#popup_' + secondItemName + '_';

AJS.$(document).ready(function() {
    AJS.$('#time-popup').live('focus', function() {
        if (AJS.$('#tempo-issue-picker-popup').val()[0].indexOf(projectKey) == -1 || AJS.$('input[name="preSelectedIssue"]').val().indexOf(projectKey) == -1) {
            AJS.$(hideItemOne).parent().hide();
            AJS.$(hideItemTwo).parent().hide();
        }
    });
    AJS.$('#tempo-issue-picker-popup').live('change', function() {
        if (AJS.$('#tempo-issue-picker-popup').val()[0].indexOf(projectKey) == -1) {
            AJS.$(hideItemOne).parent().hide();
            AJS.$(hideItemTwo).parent().hide();
        } else {
            AJS.$(hideItemOne).parent().show();
            AJS.$(hideItemTwo).parent().show();
        }
    });
});


  • No labels