activeadmin_addons 1.9.0 → 2.0.0.beta.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -17
- data/app/inputs/active_admin/inputs/select_input.rb +5 -1
- data/app/inputs/nested_level_input.rb +2 -1
- data/app/inputs/search_select_input.rb +1 -1
- data/app/inputs/tags_input.rb +1 -1
- data/app/javascript/activeadmin_addons/addons/slim-select-interactive-tag.js +78 -0
- data/app/javascript/activeadmin_addons/addons/toggle_bool.js +1 -1
- data/app/javascript/activeadmin_addons/all.js +2 -7
- data/app/javascript/activeadmin_addons/config.js +8 -5
- data/app/javascript/activeadmin_addons/inputs/color-picker.js +1 -1
- data/app/javascript/activeadmin_addons/inputs/date-time-picker.js +1 -1
- data/app/javascript/activeadmin_addons/inputs/slim-select-nested.js +93 -0
- data/app/javascript/activeadmin_addons/inputs/slim-select-search.js +37 -0
- data/app/javascript/activeadmin_addons/inputs/slim-select-selected-list.js +103 -0
- data/app/javascript/activeadmin_addons/inputs/slim-select-simple-tags.js +22 -0
- data/app/javascript/activeadmin_addons/inputs/slim-select-tags.js +67 -0
- data/app/javascript/activeadmin_addons/inputs/slim-select-utils.js +70 -0
- data/app/javascript/activeadmin_addons/inputs/slim-select.js +75 -0
- data/app/{assets/stylesheets/activeadmin_addons → javascript/activeadmin_addons/stylesheets}/all.scss +5 -11
- data/app/javascript/activeadmin_addons/stylesheets/imports/slimselect.css +1 -0
- data/app/{assets/stylesheets/activeadmin_addons → javascript/activeadmin_addons/stylesheets}/inputs/selected-list.scss +0 -1
- data/app/javascript/activeadmin_addons/stylesheets/inputs/slim-select.scss +9 -0
- data/lib/activeadmin_addons/addons/image_builder.rb +21 -3
- data/lib/activeadmin_addons/addons/markdown_builder.rb +38 -0
- data/lib/activeadmin_addons/addons/tag_builder.rb +6 -21
- data/lib/activeadmin_addons/engine.rb +0 -5
- data/lib/activeadmin_addons/support/enum_utils.rb +19 -0
- data/lib/activeadmin_addons/support/input_helpers/select_helpers.rb +1 -1
- data/lib/activeadmin_addons/support/select_filter_input_extension.rb +19 -0
- data/lib/activeadmin_addons/version.rb +1 -1
- data/lib/activeadmin_addons.rb +1 -1
- data/lib/generators/activeadmin_addons/install/install_generator.rb +2 -1
- data/lib/generators/activeadmin_addons/install/templates/initializer.rb +1 -1
- data/lib/generators/activeadmin_addons/webpacker/webpacker_generator.rb +1 -1
- metadata +83 -181
- data/app/assets/images/fileicons/file_extension_3gp.png +0 -0
- data/app/assets/images/fileicons/file_extension_7z.png +0 -0
- data/app/assets/images/fileicons/file_extension_ace.png +0 -0
- data/app/assets/images/fileicons/file_extension_ai.png +0 -0
- data/app/assets/images/fileicons/file_extension_aif.png +0 -0
- data/app/assets/images/fileicons/file_extension_aiff.png +0 -0
- data/app/assets/images/fileicons/file_extension_amr.png +0 -0
- data/app/assets/images/fileicons/file_extension_asf.png +0 -0
- data/app/assets/images/fileicons/file_extension_asx.png +0 -0
- data/app/assets/images/fileicons/file_extension_bat.png +0 -0
- data/app/assets/images/fileicons/file_extension_bin.png +0 -0
- data/app/assets/images/fileicons/file_extension_bmp.png +0 -0
- data/app/assets/images/fileicons/file_extension_bup.png +0 -0
- data/app/assets/images/fileicons/file_extension_cab.png +0 -0
- data/app/assets/images/fileicons/file_extension_cbr.png +0 -0
- data/app/assets/images/fileicons/file_extension_cda.png +0 -0
- data/app/assets/images/fileicons/file_extension_cdl.png +0 -0
- data/app/assets/images/fileicons/file_extension_cdr.png +0 -0
- data/app/assets/images/fileicons/file_extension_chm.png +0 -0
- data/app/assets/images/fileicons/file_extension_dat.png +0 -0
- data/app/assets/images/fileicons/file_extension_divx.png +0 -0
- data/app/assets/images/fileicons/file_extension_dll.png +0 -0
- data/app/assets/images/fileicons/file_extension_dmg.png +0 -0
- data/app/assets/images/fileicons/file_extension_doc.png +0 -0
- data/app/assets/images/fileicons/file_extension_docx.png +0 -0
- data/app/assets/images/fileicons/file_extension_dss.png +0 -0
- data/app/assets/images/fileicons/file_extension_dvf.png +0 -0
- data/app/assets/images/fileicons/file_extension_dwg.png +0 -0
- data/app/assets/images/fileicons/file_extension_eml.png +0 -0
- data/app/assets/images/fileicons/file_extension_eps.png +0 -0
- data/app/assets/images/fileicons/file_extension_exe.png +0 -0
- data/app/assets/images/fileicons/file_extension_fla.png +0 -0
- data/app/assets/images/fileicons/file_extension_flv.png +0 -0
- data/app/assets/images/fileicons/file_extension_gif.png +0 -0
- data/app/assets/images/fileicons/file_extension_gz.png +0 -0
- data/app/assets/images/fileicons/file_extension_hqx.png +0 -0
- data/app/assets/images/fileicons/file_extension_htm.png +0 -0
- data/app/assets/images/fileicons/file_extension_html.png +0 -0
- data/app/assets/images/fileicons/file_extension_ifo.png +0 -0
- data/app/assets/images/fileicons/file_extension_indd.png +0 -0
- data/app/assets/images/fileicons/file_extension_iso.png +0 -0
- data/app/assets/images/fileicons/file_extension_jar.png +0 -0
- data/app/assets/images/fileicons/file_extension_jpeg.png +0 -0
- data/app/assets/images/fileicons/file_extension_jpg.png +0 -0
- data/app/assets/images/fileicons/file_extension_lnk.png +0 -0
- data/app/assets/images/fileicons/file_extension_log.png +0 -0
- data/app/assets/images/fileicons/file_extension_m4a.png +0 -0
- data/app/assets/images/fileicons/file_extension_m4b.png +0 -0
- data/app/assets/images/fileicons/file_extension_m4p.png +0 -0
- data/app/assets/images/fileicons/file_extension_m4v.png +0 -0
- data/app/assets/images/fileicons/file_extension_mcd.png +0 -0
- data/app/assets/images/fileicons/file_extension_mdb.png +0 -0
- data/app/assets/images/fileicons/file_extension_mid.png +0 -0
- data/app/assets/images/fileicons/file_extension_mov.png +0 -0
- data/app/assets/images/fileicons/file_extension_mp2.png +0 -0
- data/app/assets/images/fileicons/file_extension_mp3.png +0 -0
- data/app/assets/images/fileicons/file_extension_mp4.png +0 -0
- data/app/assets/images/fileicons/file_extension_mpeg.png +0 -0
- data/app/assets/images/fileicons/file_extension_mpg.png +0 -0
- data/app/assets/images/fileicons/file_extension_msi.png +0 -0
- data/app/assets/images/fileicons/file_extension_mswmm.png +0 -0
- data/app/assets/images/fileicons/file_extension_ogg.png +0 -0
- data/app/assets/images/fileicons/file_extension_pdf.png +0 -0
- data/app/assets/images/fileicons/file_extension_png.png +0 -0
- data/app/assets/images/fileicons/file_extension_pps.png +0 -0
- data/app/assets/images/fileicons/file_extension_ppt.png +0 -0
- data/app/assets/images/fileicons/file_extension_pptx.png +0 -0
- data/app/assets/images/fileicons/file_extension_ps.png +0 -0
- data/app/assets/images/fileicons/file_extension_psd.png +0 -0
- data/app/assets/images/fileicons/file_extension_pst.png +0 -0
- data/app/assets/images/fileicons/file_extension_ptb.png +0 -0
- data/app/assets/images/fileicons/file_extension_pub.png +0 -0
- data/app/assets/images/fileicons/file_extension_qbb.png +0 -0
- data/app/assets/images/fileicons/file_extension_qbw.png +0 -0
- data/app/assets/images/fileicons/file_extension_qxd.png +0 -0
- data/app/assets/images/fileicons/file_extension_ram.png +0 -0
- data/app/assets/images/fileicons/file_extension_rar.png +0 -0
- data/app/assets/images/fileicons/file_extension_rm.png +0 -0
- data/app/assets/images/fileicons/file_extension_rmvb.png +0 -0
- data/app/assets/images/fileicons/file_extension_rtf.png +0 -0
- data/app/assets/images/fileicons/file_extension_sea.png +0 -0
- data/app/assets/images/fileicons/file_extension_ses.png +0 -0
- data/app/assets/images/fileicons/file_extension_sit.png +0 -0
- data/app/assets/images/fileicons/file_extension_sitx.png +0 -0
- data/app/assets/images/fileicons/file_extension_ss.png +0 -0
- data/app/assets/images/fileicons/file_extension_swf.png +0 -0
- data/app/assets/images/fileicons/file_extension_tgz.png +0 -0
- data/app/assets/images/fileicons/file_extension_thm.png +0 -0
- data/app/assets/images/fileicons/file_extension_tif.png +0 -0
- data/app/assets/images/fileicons/file_extension_tmp.png +0 -0
- data/app/assets/images/fileicons/file_extension_torrent.png +0 -0
- data/app/assets/images/fileicons/file_extension_ttf.png +0 -0
- data/app/assets/images/fileicons/file_extension_txt.png +0 -0
- data/app/assets/images/fileicons/file_extension_unknown.png +0 -0
- data/app/assets/images/fileicons/file_extension_vcd.png +0 -0
- data/app/assets/images/fileicons/file_extension_vob.png +0 -0
- data/app/assets/images/fileicons/file_extension_wav.png +0 -0
- data/app/assets/images/fileicons/file_extension_wma.png +0 -0
- data/app/assets/images/fileicons/file_extension_wmv.png +0 -0
- data/app/assets/images/fileicons/file_extension_wps.png +0 -0
- data/app/assets/images/fileicons/file_extension_xls.png +0 -0
- data/app/assets/images/fileicons/file_extension_xlsx.png +0 -0
- data/app/assets/images/fileicons/file_extension_xpi.png +0 -0
- data/app/assets/images/fileicons/file_extension_zip.png +0 -0
- data/app/assets/images/material/icons/keyboard_arrow_down.svg +0 -4
- data/app/assets/images/material/icons/keyboard_arrow_left.svg +0 -4
- data/app/assets/images/material/icons/keyboard_arrow_right.svg +0 -4
- data/app/assets/images/material/icons/keyboard_arrow_up.svg +0 -4
- data/app/assets/images/material/icons/today.svg +0 -4
- data/app/assets/javascripts/activeadmin_addons/all.js +0 -753
- data/app/assets/stylesheets/activeadmin_addons/addons/material-datepicker.scss +0 -173
- data/app/assets/stylesheets/activeadmin_addons/addons/material-toggle_bool.scss +0 -52
- data/app/assets/stylesheets/activeadmin_addons/inputs/select2.scss +0 -3
- data/app/assets/stylesheets/activeadmin_addons/material.scss +0 -53
- data/app/javascript/activeadmin_addons/addons/interactive_select_tag.js +0 -95
- data/app/javascript/activeadmin_addons/inputs/nested-select.js +0 -170
- data/app/javascript/activeadmin_addons/inputs/search-select.js +0 -76
- data/app/javascript/activeadmin_addons/inputs/select2.js +0 -52
- data/app/javascript/activeadmin_addons/inputs/selected-list.js +0 -107
- data/app/javascript/activeadmin_addons/inputs/tags.js +0 -76
- data/lib/activeadmin_addons/addons/attachment_builder.rb +0 -60
- data/lib/activeadmin_addons/support/enumerize_formtastic_support.rb +0 -18
- data/lib/generators/activeadmin_addons/assets/assets_generator.rb +0 -53
- data/vendor/assets/select2/select2.css +0 -481
- data/vendor/assets/select2/select2.full.js +0 -6820
- /data/app/{assets/stylesheets/activeadmin_addons → javascript/activeadmin_addons/stylesheets}/addons/interactive_select_tag.scss +0 -0
- /data/app/{assets/stylesheets/activeadmin_addons → javascript/activeadmin_addons/stylesheets}/addons/toggle_bool.scss +0 -0
- /data/app/{assets/stylesheets/activeadmin_addons → javascript/activeadmin_addons/stylesheets}/imports/jquery-datepicker.scss +0 -0
- /data/app/{assets/stylesheets/activeadmin_addons → javascript/activeadmin_addons/stylesheets}/inputs/color-picker.scss +0 -0
- /data/app/{assets/stylesheets/activeadmin_addons → javascript/activeadmin_addons/stylesheets}/inputs/date-time-picker-filter.scss +0 -0
- /data/app/{assets/stylesheets/activeadmin_addons → javascript/activeadmin_addons/stylesheets}/inputs/date-time-picker.scss +0 -0
- /data/app/{assets/stylesheets/activeadmin_addons → javascript/activeadmin_addons/stylesheets}/inputs/numeric-range-filter.scss +0 -0
- /data/app/{assets/stylesheets/activeadmin_addons → javascript/activeadmin_addons/stylesheets}/vendor/palette-color-picker.scss +0 -0
@@ -1,173 +0,0 @@
|
|
1
|
-
$dt-bg-border-color: #fff;
|
2
|
-
$dt-bg-button-color: #fff;
|
3
|
-
$dt-header-bg-color: #fff;
|
4
|
-
$dt-border-color: #fff;
|
5
|
-
$dt-bg: #fff;
|
6
|
-
|
7
|
-
$dt-primary-color: $am-theme-primary;
|
8
|
-
$dt-label-color: rgba(0, 0, 0, .7);
|
9
|
-
$dt-header-color: rgba(0, 0, 0, .54);
|
10
|
-
|
11
|
-
$dt-selected-bg-color: $am-theme-primary;
|
12
|
-
$dt-selected-color: #fff;
|
13
|
-
$dt-hour-border-color: #ddd;
|
14
|
-
|
15
|
-
li.input.date_time_picker .date-time-picker-input {
|
16
|
-
z-index: 2 !important;
|
17
|
-
background: $dt-selected-color asset-url('active_material/icons/event.svg') 10px no-repeat;
|
18
|
-
padding-left: 40px;
|
19
|
-
}
|
20
|
-
|
21
|
-
div.xdsoft_datetimepicker {
|
22
|
-
font-family: 'RobotoDraft', sans-serif;
|
23
|
-
background: $dt-bg-border-color;
|
24
|
-
border-radius: 2px;
|
25
|
-
box-shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 -1px 1px rgba(0, 0, 0, .12);
|
26
|
-
padding: 0 12px 8px;
|
27
|
-
z-index: 1;
|
28
|
-
color: $dt-label-color;
|
29
|
-
|
30
|
-
.xdsoft_datepicker {
|
31
|
-
margin-top: 5px;
|
32
|
-
width: 250px;
|
33
|
-
}
|
34
|
-
|
35
|
-
.xdsoft_datepicker.active + .xdsoft_timepicker {
|
36
|
-
width: 68px;
|
37
|
-
padding-left: 10px;
|
38
|
-
margin-top: 30px;
|
39
|
-
border-left: 1px solid $dt-hour-border-color;
|
40
|
-
}
|
41
|
-
|
42
|
-
.xdsoft_timepicker .xdsoft_time_box {
|
43
|
-
border-bottom: 1px solid $dt-hour-border-color;
|
44
|
-
}
|
45
|
-
|
46
|
-
.xdsoft_timepicker .xdsoft_time_box>div>div {
|
47
|
-
background: $dt-bg-button-color;
|
48
|
-
border-top: 1px solid $dt-hour-border-color;
|
49
|
-
color: $dt-label-color;
|
50
|
-
}
|
51
|
-
|
52
|
-
.xdsoft_label {
|
53
|
-
background-color: $dt-bg-border-color;
|
54
|
-
font-weight: 600;
|
55
|
-
|
56
|
-
&.xdsoft_month {
|
57
|
-
width: 90px;
|
58
|
-
padding-right: 0;
|
59
|
-
|
60
|
-
i {
|
61
|
-
display: none;
|
62
|
-
}
|
63
|
-
}
|
64
|
-
|
65
|
-
&.xdsoft_year {
|
66
|
-
padding-left: 0;
|
67
|
-
margin-left: 0;
|
68
|
-
|
69
|
-
i {
|
70
|
-
display: none;
|
71
|
-
}
|
72
|
-
}
|
73
|
-
|
74
|
-
& > .xdsoft_select {
|
75
|
-
border: 1px solid $dt-border-color;
|
76
|
-
background: $dt-bg-border-color;
|
77
|
-
}
|
78
|
-
|
79
|
-
& > .xdsoft_select > div > .xdsoft_option {
|
80
|
-
font-weight: 400;
|
81
|
-
|
82
|
-
&:hover {
|
83
|
-
color: $dt-primary-color;
|
84
|
-
background: $dt-bg-border-color;
|
85
|
-
}
|
86
|
-
|
87
|
-
&.xdsoft_current {
|
88
|
-
background: $dt-selected-bg-color;
|
89
|
-
color: $dt-selected-color;
|
90
|
-
box-shadow: unset;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
}
|
94
|
-
|
95
|
-
.xdsoft_calendar td,
|
96
|
-
.xdsoft_calendar th {
|
97
|
-
background: $dt-bg-button-color;
|
98
|
-
color: $dt-label-color;
|
99
|
-
border: 0;
|
100
|
-
width: 32px;
|
101
|
-
height: 32px;
|
102
|
-
border-radius: 50%;
|
103
|
-
text-align: center;
|
104
|
-
|
105
|
-
div {
|
106
|
-
padding: 0;
|
107
|
-
}
|
108
|
-
}
|
109
|
-
|
110
|
-
.xdsoft_calendar th {
|
111
|
-
background: $dt-header-bg-color;
|
112
|
-
font-weight: 500;
|
113
|
-
color: $dt-header-color;
|
114
|
-
|
115
|
-
}
|
116
|
-
|
117
|
-
.xdsoft_calendar td.xdsoft_default,
|
118
|
-
.xdsoft_calendar td.xdsoft_current,
|
119
|
-
.xdsoft_timepicker .xdsoft_time_box>div>div.xdsoft_current {
|
120
|
-
color: $dt-selected-bg-color;
|
121
|
-
background: $dt-bg;
|
122
|
-
box-shadow: unset;
|
123
|
-
}
|
124
|
-
|
125
|
-
.xdsoft_calendar td:hover,
|
126
|
-
.xdsoft_timepicker .xdsoft_time_box>div>div:hover {
|
127
|
-
color: $dt-primary-color !important;
|
128
|
-
background: $dt-bg-border-color !important;
|
129
|
-
}
|
130
|
-
|
131
|
-
.xdsoft_calendar td.xdsoft_today {
|
132
|
-
&,
|
133
|
-
&.xdsoft_current {
|
134
|
-
background: $dt-selected-bg-color !important;
|
135
|
-
color: $dt-selected-color !important;
|
136
|
-
}
|
137
|
-
}
|
138
|
-
|
139
|
-
.xdsoft_time_box {
|
140
|
-
border: 1px solid $dt-border-color;
|
141
|
-
}
|
142
|
-
|
143
|
-
.xdsoft_mounthpicker button {
|
144
|
-
width: 24px;
|
145
|
-
height: 24px;
|
146
|
-
|
147
|
-
&.xdsoft_prev {
|
148
|
-
background: asset-url('material/icons/keyboard_arrow_left.svg') no-repeat;
|
149
|
-
}
|
150
|
-
|
151
|
-
&.xdsoft_today_button {
|
152
|
-
background: asset-url('material/icons/today.svg') no-repeat;
|
153
|
-
}
|
154
|
-
|
155
|
-
&.xdsoft_next {
|
156
|
-
background: asset-url('material/icons/keyboard_arrow_right.svg') no-repeat;
|
157
|
-
}
|
158
|
-
}
|
159
|
-
|
160
|
-
.xdsoft_timepicker > button {
|
161
|
-
&.xdsoft_prev {
|
162
|
-
width: 24px;
|
163
|
-
height: 24px;
|
164
|
-
background: asset-url('material/icons/keyboard_arrow_up.svg') no-repeat;
|
165
|
-
}
|
166
|
-
|
167
|
-
&.xdsoft_next {
|
168
|
-
width: 24px;
|
169
|
-
height: 24px;
|
170
|
-
background: asset-url('material/icons/keyboard_arrow_down.svg') no-repeat;
|
171
|
-
}
|
172
|
-
}
|
173
|
-
}
|
@@ -1,52 +0,0 @@
|
|
1
|
-
$inactive-button: #aaa;
|
2
|
-
$inactive-bg: #ddd;
|
3
|
-
$active-button: $am-theme-primary;
|
4
|
-
$active-bg: rgba($active-button, .6);
|
5
|
-
|
6
|
-
$box-shadow: 0 2px 1px -1px rgba(0, 0, 0, .2), 0 1px 1px 0 rgba(0, 0, 0, .14), 0 1px 3px 0 rgba(0, 0, 0, .12);
|
7
|
-
|
8
|
-
.toggle-bool-switches-container {
|
9
|
-
text-align: center;
|
10
|
-
|
11
|
-
.toggle-bool-switch {
|
12
|
-
cursor: pointer;
|
13
|
-
|
14
|
-
background: $inactive-bg;
|
15
|
-
background-image: none;
|
16
|
-
box-shadow: $box-shadow;
|
17
|
-
|
18
|
-
width: 36px;
|
19
|
-
height: 14px;
|
20
|
-
display: inline-block;
|
21
|
-
position: relative;
|
22
|
-
border-radius: 9px;
|
23
|
-
|
24
|
-
&::before {
|
25
|
-
content: '';
|
26
|
-
background: $inactive-button;
|
27
|
-
background-image: none;
|
28
|
-
box-shadow: none;
|
29
|
-
|
30
|
-
display: inline-block;
|
31
|
-
width: 22px;
|
32
|
-
height: 22px;
|
33
|
-
border-radius: 50%;
|
34
|
-
position: absolute;
|
35
|
-
left: -3px;
|
36
|
-
top: -3px;
|
37
|
-
|
38
|
-
transition: all .25s linear;
|
39
|
-
transform: translateX(0);
|
40
|
-
}
|
41
|
-
|
42
|
-
&.on {
|
43
|
-
background: $active-bg;
|
44
|
-
background-image: none;
|
45
|
-
|
46
|
-
&::before {
|
47
|
-
left: calc(100% - 15px);
|
48
|
-
background: $active-button;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
}
|
52
|
-
}
|
@@ -1,53 +0,0 @@
|
|
1
|
-
@import 'active_material';
|
2
|
-
@import './addons/material-datepicker';
|
3
|
-
@import './addons/material-toggle_bool';
|
4
|
-
|
5
|
-
// Select
|
6
|
-
.filter_select,
|
7
|
-
.search_select_filter {
|
8
|
-
.select2.select2-container.select2-container--default {
|
9
|
-
width: 100% !important;
|
10
|
-
}
|
11
|
-
}
|
12
|
-
|
13
|
-
.select2-container .select2-selection--single {
|
14
|
-
height: 42px;
|
15
|
-
|
16
|
-
.select2-selection__rendered {
|
17
|
-
line-height: 42px;
|
18
|
-
}
|
19
|
-
|
20
|
-
.select2-selection__arrow {
|
21
|
-
height: 40px;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
// Date Range
|
26
|
-
.input.date_range {
|
27
|
-
input.datepicker {
|
28
|
-
background: #fff asset-url('active_material/icons/event.svg') 10px no-repeat;
|
29
|
-
padding-left: 40px;
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
// Numeric Range Filter
|
34
|
-
.filter_numeric_range_filter {
|
35
|
-
&.input.string input,
|
36
|
-
&.input.stringish input,
|
37
|
-
&.input.numberic input {
|
38
|
-
width: calc(50% - 6px);
|
39
|
-
}
|
40
|
-
}
|
41
|
-
|
42
|
-
// Errors
|
43
|
-
li.error {
|
44
|
-
.select2-selection {
|
45
|
-
border-color: $am-theme-error;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
.input.string.error input,
|
50
|
-
.input.stringish.error input,
|
51
|
-
.input.numberic.error input {
|
52
|
-
border-color: $am-theme-error;
|
53
|
-
}
|
@@ -1,95 +0,0 @@
|
|
1
|
-
var initializer = function() {
|
2
|
-
configureInteractiveSelect(document);
|
3
|
-
|
4
|
-
$(document).on('has_many_add:after', function(event, container) {
|
5
|
-
configureInteractiveSelect(container);
|
6
|
-
});
|
7
|
-
|
8
|
-
function configureInteractiveSelect(container) {
|
9
|
-
$('.interactive-tag-select select', container).each(function(i, el) {
|
10
|
-
setupSelect2(el);
|
11
|
-
});
|
12
|
-
|
13
|
-
function setupSelect2(select) {
|
14
|
-
var selectConfig = {
|
15
|
-
placeholder: '',
|
16
|
-
allowClear: false,
|
17
|
-
width: '125px',
|
18
|
-
};
|
19
|
-
|
20
|
-
$(select).select2(selectConfig);
|
21
|
-
|
22
|
-
// Related with https://github.com/select2/select2/issues/3320
|
23
|
-
$(select).on('select2:unselecting', function() {
|
24
|
-
$(this).data('unselecting', true);
|
25
|
-
}).on('select2:open', function() {
|
26
|
-
if ($(this).data('unselecting')) {
|
27
|
-
$(this).select2('close').removeData('unselecting');
|
28
|
-
}
|
29
|
-
});
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
$('.interactive-tag').click(function(e) {
|
34
|
-
var tag = $(e.target).parent();
|
35
|
-
var model = tag.data('model');
|
36
|
-
var objectId = tag.data('object_id');
|
37
|
-
var field = tag.data('field');
|
38
|
-
var selectTag = $('.' + model + '-' + field + '-' + objectId + '-select');
|
39
|
-
selectTag.removeClass('select-container-hidden');
|
40
|
-
tag.addClass('interactive-tag-hidden');
|
41
|
-
selectTag.find('select').select2('open');
|
42
|
-
});
|
43
|
-
|
44
|
-
$('.interactive-tag-select').on('select2:close', function(e) {
|
45
|
-
var selectTag = $(e.target).parent();
|
46
|
-
|
47
|
-
var model = selectTag.data('model');
|
48
|
-
var objectId = selectTag.data('object_id');
|
49
|
-
var field = selectTag.data('field');
|
50
|
-
|
51
|
-
var tagContainer = $('.' + model + '-' + field + '-' + objectId + '-tag');
|
52
|
-
var statusTag = tagContainer.find('.status_tag');
|
53
|
-
|
54
|
-
var newValue = e.target.value;
|
55
|
-
var newText = e.target.selectedOptions[0].text;
|
56
|
-
var oldValue = selectTag.data('value');
|
57
|
-
|
58
|
-
if (newValue === oldValue) {
|
59
|
-
selectTag.addClass('select-container-hidden');
|
60
|
-
tagContainer.removeClass('interactive-tag-hidden');
|
61
|
-
} else {
|
62
|
-
var url = tagContainer.data('url');
|
63
|
-
var data = { id: objectId };
|
64
|
-
data[model] = {};
|
65
|
-
data[model][field] = newValue;
|
66
|
-
|
67
|
-
$.ajax({
|
68
|
-
url: url,
|
69
|
-
data: data,
|
70
|
-
dataType: 'json',
|
71
|
-
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
|
72
|
-
error: function() {
|
73
|
-
var errorMsg = 'Error: Update Unsuccessful';
|
74
|
-
console.log(errorMsg);
|
75
|
-
},
|
76
|
-
success: function() {
|
77
|
-
statusTag.text(newText);
|
78
|
-
statusTag.removeClass(oldValue);
|
79
|
-
statusTag.addClass(newValue);
|
80
|
-
|
81
|
-
tagContainer.data('value', newValue);
|
82
|
-
selectTag.data('value', newValue);
|
83
|
-
},
|
84
|
-
complete: function() {
|
85
|
-
selectTag.addClass('select-container-hidden');
|
86
|
-
tagContainer.removeClass('interactive-tag-hidden');
|
87
|
-
},
|
88
|
-
type: 'PATCH',
|
89
|
-
});
|
90
|
-
}
|
91
|
-
});
|
92
|
-
};
|
93
|
-
|
94
|
-
$(initializer);
|
95
|
-
$(document).on('turbolinks:load', initializer);
|
@@ -1,170 +0,0 @@
|
|
1
|
-
$.fn.select2.amd.define('select2/data/nestedCustomAdapter', ['select2/data/array', 'select2/utils'], function(ArrayData, Utils) {
|
2
|
-
function CustomData($element, options) {
|
3
|
-
CustomData.__super__.constructor.call(this, $element, options);
|
4
|
-
}
|
5
|
-
|
6
|
-
Utils.Extend(CustomData, ArrayData);
|
7
|
-
|
8
|
-
CustomData.prototype.query = function(params, callback) {
|
9
|
-
var data = { results: [] };
|
10
|
-
var element = this.$element;
|
11
|
-
var collection = element.data('collection');
|
12
|
-
var parent = element.data('parent');
|
13
|
-
var parentId = element.data('parent-id');
|
14
|
-
|
15
|
-
collection.forEach(function(record) {
|
16
|
-
var regex = new RegExp(params.term, 'i');
|
17
|
-
var matched = !!record.text.match(regex);
|
18
|
-
|
19
|
-
if ((!parent || record[parent] == parentId) && matched) {
|
20
|
-
data.results.push(record);
|
21
|
-
}
|
22
|
-
});
|
23
|
-
|
24
|
-
callback(data);
|
25
|
-
};
|
26
|
-
|
27
|
-
CustomData.prototype.current = function(callback) {
|
28
|
-
var currentOption = null;
|
29
|
-
var element = this.$element;
|
30
|
-
var selectedOption = element.data('selected');
|
31
|
-
var collection = element.data('collection');
|
32
|
-
var data = [];
|
33
|
-
|
34
|
-
$.each(collection, function(index, option) {
|
35
|
-
if (!!selectedOption && option.id == selectedOption.id) {
|
36
|
-
currentOption = option;
|
37
|
-
element.data('selected', null);
|
38
|
-
return;
|
39
|
-
}
|
40
|
-
|
41
|
-
if (element.val() == option.id) {
|
42
|
-
currentOption = option;
|
43
|
-
return;
|
44
|
-
}
|
45
|
-
});
|
46
|
-
|
47
|
-
if (currentOption) {
|
48
|
-
data.push(currentOption);
|
49
|
-
}
|
50
|
-
|
51
|
-
callback(data);
|
52
|
-
};
|
53
|
-
|
54
|
-
return CustomData;
|
55
|
-
});
|
56
|
-
|
57
|
-
var initializer = function() {
|
58
|
-
configureSelect2(document);
|
59
|
-
|
60
|
-
$(document).on('has_many_add:after', function(event, container) {
|
61
|
-
configureSelect2(container);
|
62
|
-
});
|
63
|
-
|
64
|
-
function configureSelect2(container) {
|
65
|
-
var INVALID_PARENT_ID = -1;
|
66
|
-
|
67
|
-
$('.nested-level-input', container).each(function(i, el) {
|
68
|
-
var element = $(el);
|
69
|
-
var url = element.data('url');
|
70
|
-
var fields = element.data('fields');
|
71
|
-
var predicate = element.data('predicate');
|
72
|
-
var filters = element.data('filters');
|
73
|
-
var displayName = element.data('display-name');
|
74
|
-
var parent = element.data('parent');
|
75
|
-
var width = element.data('width');
|
76
|
-
var model = element.data('model');
|
77
|
-
var responseRoot = element.data('response-root');
|
78
|
-
var collection = element.data('collection');
|
79
|
-
var minimumInputLength = element.data('minimum-input-length');
|
80
|
-
var order = element.data('order');
|
81
|
-
var parentId = element.data('parent-id');
|
82
|
-
var selectInstance;
|
83
|
-
|
84
|
-
var select2Config = {
|
85
|
-
width: width,
|
86
|
-
minimumInputLength: minimumInputLength,
|
87
|
-
placeholder: '',
|
88
|
-
allowClear: true,
|
89
|
-
};
|
90
|
-
|
91
|
-
if (collection) {
|
92
|
-
select2Config.dataAdapter = $.fn.select2.amd.require('select2/data/nestedCustomAdapter');
|
93
|
-
} else {
|
94
|
-
var ajaxConfig = {
|
95
|
-
url: url,
|
96
|
-
dataType: 'json',
|
97
|
-
delay: 250,
|
98
|
-
cache: true,
|
99
|
-
data: function(params) {
|
100
|
-
var textQuery = { m: 'or' };
|
101
|
-
fields.forEach(function(field) {
|
102
|
-
if (field == 'id') {
|
103
|
-
textQuery[field + '_eq'] = params.term;
|
104
|
-
} else {
|
105
|
-
textQuery[field + '_' + predicate] = params.term;
|
106
|
-
}
|
107
|
-
});
|
108
|
-
|
109
|
-
var query = {
|
110
|
-
order: order,
|
111
|
-
q: {
|
112
|
-
groupings: [textQuery],
|
113
|
-
combinator: 'and',
|
114
|
-
},
|
115
|
-
};
|
116
|
-
|
117
|
-
if (!!parent) {
|
118
|
-
query.q[parent + '_eq'] = parentId;
|
119
|
-
}
|
120
|
-
|
121
|
-
Object.assign(query.q, filters);
|
122
|
-
|
123
|
-
return query;
|
124
|
-
},
|
125
|
-
processResults: function(data) {
|
126
|
-
if (data.constructor == Object) {
|
127
|
-
data = data[responseRoot];
|
128
|
-
}
|
129
|
-
|
130
|
-
return {
|
131
|
-
results: jQuery.map(data, function(resource) {
|
132
|
-
if (!resource[displayName]) {
|
133
|
-
resource[displayName] = 'No display name for id #' + resource.id.toString();
|
134
|
-
}
|
135
|
-
return {
|
136
|
-
id: resource.id,
|
137
|
-
text: resource[displayName].toString(),
|
138
|
-
};
|
139
|
-
}),
|
140
|
-
};
|
141
|
-
},
|
142
|
-
};
|
143
|
-
|
144
|
-
select2Config.ajax = ajaxConfig;
|
145
|
-
}
|
146
|
-
|
147
|
-
selectInstance = element.select2(select2Config);
|
148
|
-
|
149
|
-
function setParentValue(e) {
|
150
|
-
selectInstance.val(null).trigger('select2:select').trigger('change');
|
151
|
-
parentId = (e.params && e.params.data.id) ? e.params.data.id : INVALID_PARENT_ID;
|
152
|
-
element.data('parent-id', parentId);
|
153
|
-
}
|
154
|
-
|
155
|
-
if (!!parent) {
|
156
|
-
var parentSelectorId = '#' + model + '_' + parent;
|
157
|
-
if (!$(parentSelectorId).length) {
|
158
|
-
parentSelectorId = $(container).find('*[id*=' + parent + ']')[0];
|
159
|
-
}
|
160
|
-
var parentSelector = $(parentSelectorId)[0];
|
161
|
-
|
162
|
-
$(parentSelector).on('select2:select', setParentValue);
|
163
|
-
$(parentSelector).on('select2:unselect', setParentValue);
|
164
|
-
}
|
165
|
-
});
|
166
|
-
}
|
167
|
-
};
|
168
|
-
|
169
|
-
$(initializer);
|
170
|
-
$(document).on('turbolinks:load', initializer);
|
@@ -1,76 +0,0 @@
|
|
1
|
-
var initializer = function() {
|
2
|
-
setupSearchSelect(document);
|
3
|
-
|
4
|
-
$(document).on('has_many_add:after', function(event, container) {
|
5
|
-
setupSearchSelect(container);
|
6
|
-
});
|
7
|
-
|
8
|
-
function setupSearchSelect(container) {
|
9
|
-
$('.search-select-input, .search-select-filter-input, ajax-filter-input', container).each(function(i, el) {
|
10
|
-
var element = $(el);
|
11
|
-
var url = element.data('url');
|
12
|
-
var fields = element.data('fields');
|
13
|
-
var predicate = element.data('predicate');
|
14
|
-
var displayName = element.data('display-name');
|
15
|
-
var width = element.data('width');
|
16
|
-
var responseRoot = element.data('response-root');
|
17
|
-
var minimumInputLength = element.data('minimum-input-length');
|
18
|
-
var order = element.data('order');
|
19
|
-
|
20
|
-
var selectOptions = {
|
21
|
-
width: width,
|
22
|
-
minimumInputLength: minimumInputLength,
|
23
|
-
placeholder: '',
|
24
|
-
allowClear: true,
|
25
|
-
ajax: {
|
26
|
-
url: url,
|
27
|
-
dataType: 'json',
|
28
|
-
delay: 250,
|
29
|
-
cache: true,
|
30
|
-
data: function(params) {
|
31
|
-
var textQuery = { m: 'or' };
|
32
|
-
fields.forEach(function(field) {
|
33
|
-
if (field == 'id') {
|
34
|
-
textQuery[field + '_eq'] = params.term;
|
35
|
-
} else {
|
36
|
-
textQuery[field + '_' + predicate] = params.term;
|
37
|
-
}
|
38
|
-
});
|
39
|
-
|
40
|
-
var query = {
|
41
|
-
order: order,
|
42
|
-
q: {
|
43
|
-
groupings: [textQuery],
|
44
|
-
combinator: 'and',
|
45
|
-
},
|
46
|
-
};
|
47
|
-
|
48
|
-
return query;
|
49
|
-
},
|
50
|
-
processResults: function(data) {
|
51
|
-
if (data.constructor == Object) {
|
52
|
-
data = data[responseRoot];
|
53
|
-
}
|
54
|
-
|
55
|
-
return {
|
56
|
-
results: jQuery.map(data, function(resource) {
|
57
|
-
if (!resource[displayName]) {
|
58
|
-
resource[displayName] = 'No display name for id #' + resource.id.toString();
|
59
|
-
}
|
60
|
-
return {
|
61
|
-
id: resource.id,
|
62
|
-
text: resource[displayName].toString(),
|
63
|
-
};
|
64
|
-
}),
|
65
|
-
};
|
66
|
-
},
|
67
|
-
},
|
68
|
-
};
|
69
|
-
|
70
|
-
$(el).select2(selectOptions);
|
71
|
-
});
|
72
|
-
}
|
73
|
-
};
|
74
|
-
|
75
|
-
$(initializer);
|
76
|
-
$(document).on('turbolinks:load', initializer);
|
@@ -1,52 +0,0 @@
|
|
1
|
-
var initializer = function() {
|
2
|
-
configureSelect2(document);
|
3
|
-
|
4
|
-
$(document).on('has_many_add:after', function(event, container) {
|
5
|
-
configureSelect2(container);
|
6
|
-
});
|
7
|
-
|
8
|
-
function configureSelect2(container) {
|
9
|
-
if (window.ActiveadminAddons.config.defaultSelect == 'select2') {
|
10
|
-
$('select:not(.default-select)', container).each(function(i, el) {
|
11
|
-
setupSelect2(el);
|
12
|
-
});
|
13
|
-
}
|
14
|
-
|
15
|
-
$('select.select2', container).each(function(i, el) {
|
16
|
-
setupSelect2(el);
|
17
|
-
});
|
18
|
-
|
19
|
-
function setupSelect2(select) {
|
20
|
-
var selectConfig = {
|
21
|
-
placeholder: '',
|
22
|
-
width: '80%',
|
23
|
-
allowClear: true,
|
24
|
-
};
|
25
|
-
|
26
|
-
function isFilter(path) {
|
27
|
-
return $(select).closest(path).length > 0;
|
28
|
-
}
|
29
|
-
|
30
|
-
if (isFilter('.select_and_search')) {
|
31
|
-
selectConfig.width = 'resolve';
|
32
|
-
selectConfig.allowClear = false;
|
33
|
-
} else if (isFilter('.filter_select')) {
|
34
|
-
selectConfig.width = 'resolve';
|
35
|
-
}
|
36
|
-
|
37
|
-
$(select).select2(selectConfig);
|
38
|
-
|
39
|
-
// Related with https://github.com/select2/select2/issues/3320
|
40
|
-
$(select).on('select2:unselecting', function() {
|
41
|
-
$(this).data('unselecting', true);
|
42
|
-
}).on('select2:open', function() {
|
43
|
-
if ($(this).data('unselecting')) {
|
44
|
-
$(this).select2('close').removeData('unselecting');
|
45
|
-
}
|
46
|
-
});
|
47
|
-
}
|
48
|
-
}
|
49
|
-
};
|
50
|
-
|
51
|
-
$(initializer);
|
52
|
-
$(document).on('turbolinks:load', initializer);
|