User Tools

Site Tools


neat_things

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
neat_things [2018/01/16 14:49]
pawel created
neat_things [2019/01/24 13:03] (current)
root
Line 19: Line 19:
 </script> </script>
 </code> </code>
 +
 +==== Add light-yellow background to a field's input box ====
 +
 +If you'd like to highlight the background of the field's input box, you can do so with the following code snippet by adding it to the description of the custom field:
 +<code java>
 +<script type="text/javascript">
 +target = document.getElementById('customfield_13800');
 +if (target) {
 +            target.style="background-color: lightyellow";
 +}
 +
 +</script>
 +</code>
 +
 +==== Hiding current field unless priority is set to P1 and change colors to text box and font ====
 +
 +<code java>
 +<script type="text/javascript">
 +  priority = document.getElementById('priority');
 +  if (priority) {
 +      target = document.getElementById('customfield_12800');
 +      // Hide the target field if priority isn't critical
 +      if (priority.value != 2) target.style.display='none';
 + 
 +      priority.onchange=function() {
 +          if (this.value == 2) {              
 +                     target.style.display = '';
 +                     // set background color of the text box to yellow
 +                     target.style.backgroundColor = "yellow";
 +                     // set font color to red
 +                     target.style.color = "red";  
 +                     target.value="enter message here";
 +                  } else {
 +                 target.style.display='none';
 +          }
 +      }
 +  }
 + </script>
 +</code>
 +
 +=== Display radio button option that was selected with alert message ===
 +<code java>
 +<script type="text/javascript">
 +jQuery(document).ready(function($) {
 +JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
 + callVerifyAndUpdateFunction();
 +});
 +callVerifyAndUpdateFunction();
 +function  callVerifyAndUpdateFunction(){
 + var radioValue1=document.getElementById('customfield_14444-1').checked;
 + var radioValue2=document.getElementById('customfield_14444-2').checked;
 + var radioValue3=document.getElementById('customfield_14444-3').checked;
 +        if (radioValue1){
 +           alert('selected option 1');
 +        }        
 +        if (radioValue2){
 +           alert('selected option 2');
 +        }
 +        if (radioValue3){
 +           alert('selected option 3');
 +        }
 +        
 +
 +}
 +
 +});
 +</script>
 +</code>
 +
 +
 +==== Adding messages to your JIRA tickets ====
 +
 +You can display informational messages in your Jira tickets for users to see. 
 +See the following URL: [[https://docs.atlassian.com/aui/7.4.0/docs/messages.html|AUI Messages]]
 +
 +==== Adding colors to your Drop Down custom field options ====
 +
 +Source URL: [[https://docs.atlassian.com/aui/7.7.0/docs/lozenges.html?_ga=2.206915859.1202970929.1522078980-2098522943.1519672741|Atlassian Documentation - Lozenges]]
 +
 +Although the documentation is a bit outdated, and the colors don't match exactly what is in the documentation, in principal you can add an aui-lozenge to your option in order to create colorful options in your drop down menus:
 +
 +{{:options.png?400|Options how they will display on a jira view / search screen}}
 +
 +In order to accomplish this, you need to add span code as you see it in the screenshot:
 +
 +{{:code.png?800|Option configuration screen}}
 +
 +==== Disabling a field from being seen using banner ====
 +**<color red>have not confirmed this yet</color>**
 +Link: [[https://community.atlassian.com/t5/Jira-questions/User-s-quot-Configure-Fields-quot-settings/qaq-p/43816|Atlassian Forum Discussion]]
 +I found this in the above linked forum discussion, not tested yet.
 +<code java>
 +<script type="text/javascript">
 +(function($) {
 +AJS.toInit(function(){
 +// init on load
 +AJS.$("#qf-field-picker-trigger").hide();
 +})
 +JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
 +// init on refresh
 +AJS.$("#qf-field-picker-trigger").hide();
 +});
 +})(AJS.$);
 +</script>
 +</code>
 +
neat_things.1516132180.txt.gz · Last modified: 2018/01/16 14:49 by pawel