Created
December 10, 2013 09:28
-
-
Save ifourmanov/7887972 to your computer and use it in GitHub Desktop.
To render multiselect fields with fancy component like rendered in jira, add following js to description field.
Replace <id> with custom field ID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| (function($) { | |
| AJS.$("#customfield_<id> option[value='-1']").remove(); //Removes the default value "None" | |
| function convertMulti(id){ | |
| if (AJS.$('#'+id+"-textarea").length == 0){ | |
| new AJS.MultiSelect({ | |
| element: $("#"+id), | |
| itemAttrDisplayed: "label", | |
| errorMessage: AJS.params.multiselectComponentsError | |
| }); | |
| } | |
| } | |
| AJS.toInit(function(){ | |
| convertMulti("customfield_<id>"); | |
| }) | |
| JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) { | |
| AJS.$("#customfield_<id> option[value='-1']").remove(); | |
| convertMulti("customfield_<id>"); | |
| }); | |
| })(AJS.$); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment