Total Complexity | 4 |
Complexity/F | 1 |
Lines of Code | 52 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import select2 from 'select2'; |
||
2 | |||
3 | var Taxonomy = function(className) { |
||
4 | |||
5 | /** |
||
6 | * taxonomy variable is created to represent Taxonomy instance. |
||
7 | */ |
||
8 | var taxonomy = this; |
||
9 | |||
10 | /** |
||
11 | * element variable is created to represent master element of the Taxonomy. |
||
12 | */ |
||
13 | var element = $(className); |
||
14 | |||
15 | /** |
||
16 | * selectElement variable is created to represent select input of the Taxonomy. |
||
17 | */ |
||
18 | var selectElement = element.find('.taxonomy-multiple-select'); |
||
19 | |||
20 | /** |
||
21 | * Initialize actions. |
||
22 | */ |
||
23 | this._init = function() { |
||
24 | /* Initialize multiple select with select2 library. */ |
||
25 | taxonomy._multipleSelect(); |
||
26 | |||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Initialize multiple select with select2 library. |
||
31 | */ |
||
32 | this._multipleSelect = function() { |
||
33 | |||
34 | selectElement.select2({ |
||
35 | placeholder: 'Please choose your terms' |
||
36 | }); |
||
37 | |||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Delete the Taxonomy. |
||
42 | */ |
||
43 | this.delete = function() { |
||
44 | /* Remove the taxonomy element. */ |
||
45 | element.remove(); |
||
46 | } |
||
47 | |||
48 | taxonomy._init(); |
||
49 | |||
50 | } |
||
51 | |||
52 | export default Taxonomy; |