Total Complexity | 3 |
Complexity/F | 1.5 |
Lines of Code | 17 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | jQuery( document ).ready( function () { |
||
2 | jQuery( '.select2-post' ).select2( { |
||
3 | width: '300px', |
||
4 | templateSelection: formatLabel |
||
5 | } ); |
||
6 | }); |
||
7 | |||
8 | function formatLabel (state) { |
||
9 | if (!state.id) { |
||
10 | return state.text; |
||
11 | } |
||
12 | var parentLabel = state.element.parentElement.label; |
||
13 | var $state = jQuery( |
||
14 | '<span>' + parentLabel + '-' + state.text + '</span>' |
||
15 | ); |
||
16 | return $state; |
||
17 | } |