Passed
Pull Request — dev/6.0.0 (#296)
by Sudar
13:50 queued 09:51
created

$(document).ready   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
nc 2
dl 0
loc 10
rs 9.4285
nop 1
1
jQuery( document ).ready( function () {
2
	jQuery( '.select2-post' ).select2( {
3
		width: '300px',
4
		templateSelection: function (state) {
5
			if (!state.id) {
6
				return state.text;
7
			}
8
			var parentLabel = state.element.parentElement.label;
9
			var $state = jQuery(
10
				'<span>' + parentLabel + '-' + state.text + '</span>'
11
			);
12
			return $state;
13
		}
14
	});
15
});