Passed
Pull Request — dev/6.0.0 (#296)
by Rajan
12:21 queued 09:12
created

$(document).ready   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 17
rs 9.4285
c 1
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A 0 12 2
1
/* global BulkWP */
2
jQuery( document ).ready( function () {
3
	jQuery( '.select2-post' ).select2( {
4
		width: '300px',
5
		templateSelection: function (state) {
6
			if (!state.id) {
7
				return state.text;
8
			}
9
10
			var parentLabel = state.element.parentElement.label;
11
			var $state = jQuery(
12
				'<span>' + parentLabel + '-' + state.text + '</span>'
13
			);
14
15
			return $state;
16
		}
17
	});
18
});
19
20
BulkWP.validatePostTypeSelect2 = function(that) {
21
	if (null !== jQuery(that).parent().prev().children().find(".select2-post[multiple]").val()) {
22
		return true;
23
	} else {
24
		return false;
25
	}
26
};
27