effective_form_inputs 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +88 -3
- data/app/assets/javascripts/effective_form_inputs.js +1 -0
- data/app/assets/javascripts/effective_select/initialize.js.coffee +12 -0
- data/app/assets/javascripts/effective_select/input.js +2 -0
- data/app/assets/javascripts/effective_select/select2.js +5403 -0
- data/app/assets/stylesheets/effective_form_inputs.scss +1 -0
- data/app/assets/stylesheets/effective_select/bootstrap-theme.css +564 -0
- data/app/assets/stylesheets/effective_select/input.scss +3 -0
- data/app/assets/stylesheets/effective_select/overrides.scss +3 -0
- data/app/assets/stylesheets/effective_select/select2.css +431 -0
- data/app/models/effective/form_builder_inputs.rb +7 -0
- data/app/models/inputs/effective_select/input.rb +30 -0
- data/app/models/inputs/effective_select_input.rb +24 -0
- data/app/views/effective/style_guide/_form_default.html.haml +2 -1
- data/lib/effective_form_inputs/engine.rb +4 -2
- data/lib/effective_form_inputs/version.rb +1 -1
- data/lib/effective_form_inputs.rb +1 -1
- metadata +25 -2
@@ -0,0 +1,431 @@
|
|
1
|
+
.select2-container {
|
2
|
+
box-sizing: border-box;
|
3
|
+
display: inline-block;
|
4
|
+
margin: 0;
|
5
|
+
position: relative;
|
6
|
+
vertical-align: middle; }
|
7
|
+
.select2-container .select2-selection--single {
|
8
|
+
box-sizing: border-box;
|
9
|
+
cursor: pointer;
|
10
|
+
display: block;
|
11
|
+
height: 28px;
|
12
|
+
user-select: none;
|
13
|
+
-webkit-user-select: none; }
|
14
|
+
.select2-container .select2-selection--single .select2-selection__rendered {
|
15
|
+
display: block;
|
16
|
+
padding-left: 8px;
|
17
|
+
padding-right: 20px;
|
18
|
+
overflow: hidden;
|
19
|
+
text-overflow: ellipsis;
|
20
|
+
white-space: nowrap; }
|
21
|
+
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
|
22
|
+
padding-right: 8px;
|
23
|
+
padding-left: 20px; }
|
24
|
+
.select2-container .select2-selection--multiple {
|
25
|
+
box-sizing: border-box;
|
26
|
+
cursor: pointer;
|
27
|
+
display: block;
|
28
|
+
min-height: 32px;
|
29
|
+
user-select: none;
|
30
|
+
-webkit-user-select: none; }
|
31
|
+
.select2-container .select2-selection--multiple .select2-selection__rendered {
|
32
|
+
display: inline-block;
|
33
|
+
overflow: hidden;
|
34
|
+
padding-left: 8px;
|
35
|
+
text-overflow: ellipsis;
|
36
|
+
white-space: nowrap; }
|
37
|
+
.select2-container .select2-search--inline {
|
38
|
+
float: left; }
|
39
|
+
.select2-container .select2-search--inline .select2-search__field {
|
40
|
+
box-sizing: border-box;
|
41
|
+
border: none;
|
42
|
+
font-size: 100%;
|
43
|
+
margin-top: 5px; }
|
44
|
+
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
|
45
|
+
-webkit-appearance: none; }
|
46
|
+
|
47
|
+
.select2-dropdown {
|
48
|
+
background-color: white;
|
49
|
+
border: 1px solid #aaa;
|
50
|
+
border-radius: 4px;
|
51
|
+
box-sizing: border-box;
|
52
|
+
display: block;
|
53
|
+
position: absolute;
|
54
|
+
left: -100000px;
|
55
|
+
width: 100%;
|
56
|
+
z-index: 1051; }
|
57
|
+
|
58
|
+
.select2-results {
|
59
|
+
display: block; }
|
60
|
+
|
61
|
+
.select2-results__options {
|
62
|
+
list-style: none;
|
63
|
+
margin: 0;
|
64
|
+
padding: 0; }
|
65
|
+
|
66
|
+
.select2-results__option {
|
67
|
+
padding: 6px;
|
68
|
+
user-select: none;
|
69
|
+
-webkit-user-select: none; }
|
70
|
+
.select2-results__option[aria-selected] {
|
71
|
+
cursor: pointer; }
|
72
|
+
|
73
|
+
.select2-container--open .select2-dropdown {
|
74
|
+
left: 0; }
|
75
|
+
|
76
|
+
.select2-container--open .select2-dropdown--above {
|
77
|
+
border-bottom: none;
|
78
|
+
border-bottom-left-radius: 0;
|
79
|
+
border-bottom-right-radius: 0; }
|
80
|
+
|
81
|
+
.select2-container--open .select2-dropdown--below {
|
82
|
+
border-top: none;
|
83
|
+
border-top-left-radius: 0;
|
84
|
+
border-top-right-radius: 0; }
|
85
|
+
|
86
|
+
.select2-search--dropdown {
|
87
|
+
display: block;
|
88
|
+
padding: 4px; }
|
89
|
+
.select2-search--dropdown .select2-search__field {
|
90
|
+
padding: 4px;
|
91
|
+
width: 100%;
|
92
|
+
box-sizing: border-box; }
|
93
|
+
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
|
94
|
+
-webkit-appearance: none; }
|
95
|
+
.select2-search--dropdown.select2-search--hide {
|
96
|
+
display: none; }
|
97
|
+
|
98
|
+
.select2-close-mask {
|
99
|
+
border: 0;
|
100
|
+
margin: 0;
|
101
|
+
padding: 0;
|
102
|
+
display: block;
|
103
|
+
position: fixed;
|
104
|
+
left: 0;
|
105
|
+
top: 0;
|
106
|
+
min-height: 100%;
|
107
|
+
min-width: 100%;
|
108
|
+
height: auto;
|
109
|
+
width: auto;
|
110
|
+
opacity: 0;
|
111
|
+
z-index: 99;
|
112
|
+
background-color: #fff;
|
113
|
+
filter: alpha(opacity=0); }
|
114
|
+
|
115
|
+
.select2-hidden-accessible {
|
116
|
+
border: 0;
|
117
|
+
clip: rect(0 0 0 0);
|
118
|
+
height: 1px;
|
119
|
+
margin: -1px;
|
120
|
+
overflow: hidden;
|
121
|
+
padding: 0;
|
122
|
+
position: absolute;
|
123
|
+
width: 1px; }
|
124
|
+
|
125
|
+
.select2-container--default .select2-selection--single {
|
126
|
+
background-color: #fff;
|
127
|
+
border: 1px solid #aaa;
|
128
|
+
border-radius: 4px; }
|
129
|
+
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
130
|
+
color: #444;
|
131
|
+
line-height: 28px; }
|
132
|
+
.select2-container--default .select2-selection--single .select2-selection__clear {
|
133
|
+
cursor: pointer;
|
134
|
+
float: right;
|
135
|
+
font-weight: bold; }
|
136
|
+
.select2-container--default .select2-selection--single .select2-selection__placeholder {
|
137
|
+
color: #999; }
|
138
|
+
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
139
|
+
height: 26px;
|
140
|
+
position: absolute;
|
141
|
+
top: 1px;
|
142
|
+
right: 1px;
|
143
|
+
width: 20px; }
|
144
|
+
.select2-container--default .select2-selection--single .select2-selection__arrow b {
|
145
|
+
border-color: #888 transparent transparent transparent;
|
146
|
+
border-style: solid;
|
147
|
+
border-width: 5px 4px 0 4px;
|
148
|
+
height: 0;
|
149
|
+
left: 50%;
|
150
|
+
margin-left: -4px;
|
151
|
+
margin-top: -2px;
|
152
|
+
position: absolute;
|
153
|
+
top: 50%;
|
154
|
+
width: 0; }
|
155
|
+
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
156
|
+
float: left; }
|
157
|
+
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
158
|
+
left: 1px;
|
159
|
+
right: auto; }
|
160
|
+
.select2-container--default.select2-container--disabled .select2-selection--single {
|
161
|
+
background-color: #eee;
|
162
|
+
cursor: default; }
|
163
|
+
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
|
164
|
+
display: none; }
|
165
|
+
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
166
|
+
border-color: transparent transparent #888 transparent;
|
167
|
+
border-width: 0 4px 5px 4px; }
|
168
|
+
.select2-container--default .select2-selection--multiple {
|
169
|
+
background-color: white;
|
170
|
+
border: 1px solid #aaa;
|
171
|
+
border-radius: 4px;
|
172
|
+
cursor: text; }
|
173
|
+
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
|
174
|
+
box-sizing: border-box;
|
175
|
+
list-style: none;
|
176
|
+
margin: 0;
|
177
|
+
padding: 0 5px;
|
178
|
+
width: 100%; }
|
179
|
+
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
|
180
|
+
color: #999;
|
181
|
+
margin-top: 5px;
|
182
|
+
float: left; }
|
183
|
+
.select2-container--default .select2-selection--multiple .select2-selection__clear {
|
184
|
+
cursor: pointer;
|
185
|
+
float: right;
|
186
|
+
font-weight: bold;
|
187
|
+
margin-top: 5px;
|
188
|
+
margin-right: 10px; }
|
189
|
+
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
190
|
+
background-color: #e4e4e4;
|
191
|
+
border: 1px solid #aaa;
|
192
|
+
border-radius: 4px;
|
193
|
+
cursor: default;
|
194
|
+
float: left;
|
195
|
+
margin-right: 5px;
|
196
|
+
margin-top: 5px;
|
197
|
+
padding: 0 5px; }
|
198
|
+
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
199
|
+
color: #999;
|
200
|
+
cursor: pointer;
|
201
|
+
display: inline-block;
|
202
|
+
font-weight: bold;
|
203
|
+
margin-right: 2px; }
|
204
|
+
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
|
205
|
+
color: #333; }
|
206
|
+
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder {
|
207
|
+
float: right; }
|
208
|
+
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
209
|
+
margin-left: 5px;
|
210
|
+
margin-right: auto; }
|
211
|
+
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
212
|
+
margin-left: 2px;
|
213
|
+
margin-right: auto; }
|
214
|
+
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
215
|
+
border: solid black 1px;
|
216
|
+
outline: 0; }
|
217
|
+
.select2-container--default.select2-container--disabled .select2-selection--multiple {
|
218
|
+
background-color: #eee;
|
219
|
+
cursor: default; }
|
220
|
+
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
|
221
|
+
display: none; }
|
222
|
+
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
|
223
|
+
border-top-left-radius: 0;
|
224
|
+
border-top-right-radius: 0; }
|
225
|
+
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
|
226
|
+
border-bottom-left-radius: 0;
|
227
|
+
border-bottom-right-radius: 0; }
|
228
|
+
.select2-container--default .select2-search--dropdown .select2-search__field {
|
229
|
+
border: 1px solid #aaa; }
|
230
|
+
.select2-container--default .select2-search--inline .select2-search__field {
|
231
|
+
background: transparent;
|
232
|
+
border: none;
|
233
|
+
outline: 0; }
|
234
|
+
.select2-container--default .select2-results > .select2-results__options {
|
235
|
+
max-height: 200px;
|
236
|
+
overflow-y: auto; }
|
237
|
+
.select2-container--default .select2-results__option[role=group] {
|
238
|
+
padding: 0; }
|
239
|
+
.select2-container--default .select2-results__option[aria-disabled=true] {
|
240
|
+
color: #999; }
|
241
|
+
.select2-container--default .select2-results__option[aria-selected=true] {
|
242
|
+
background-color: #ddd; }
|
243
|
+
.select2-container--default .select2-results__option .select2-results__option {
|
244
|
+
padding-left: 1em; }
|
245
|
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
|
246
|
+
padding-left: 0; }
|
247
|
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option {
|
248
|
+
margin-left: -1em;
|
249
|
+
padding-left: 2em; }
|
250
|
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
251
|
+
margin-left: -2em;
|
252
|
+
padding-left: 3em; }
|
253
|
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
254
|
+
margin-left: -3em;
|
255
|
+
padding-left: 4em; }
|
256
|
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
257
|
+
margin-left: -4em;
|
258
|
+
padding-left: 5em; }
|
259
|
+
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
260
|
+
margin-left: -5em;
|
261
|
+
padding-left: 6em; }
|
262
|
+
.select2-container--default .select2-results__option--highlighted[aria-selected] {
|
263
|
+
background-color: #5897fb;
|
264
|
+
color: white; }
|
265
|
+
.select2-container--default .select2-results__group {
|
266
|
+
cursor: default;
|
267
|
+
display: block;
|
268
|
+
padding: 6px; }
|
269
|
+
|
270
|
+
.select2-container--classic .select2-selection--single {
|
271
|
+
background-color: #f6f6f6;
|
272
|
+
border: 1px solid #aaa;
|
273
|
+
border-radius: 4px;
|
274
|
+
outline: 0;
|
275
|
+
background-image: -webkit-linear-gradient(top, #ffffff 50%, #eeeeee 100%);
|
276
|
+
background-image: -o-linear-gradient(top, #ffffff 50%, #eeeeee 100%);
|
277
|
+
background-image: linear-gradient(to bottom, #ffffff 50%, #eeeeee 100%);
|
278
|
+
background-repeat: repeat-x;
|
279
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0); }
|
280
|
+
.select2-container--classic .select2-selection--single:focus {
|
281
|
+
border: 1px solid #5897fb; }
|
282
|
+
.select2-container--classic .select2-selection--single .select2-selection__rendered {
|
283
|
+
color: #444;
|
284
|
+
line-height: 28px; }
|
285
|
+
.select2-container--classic .select2-selection--single .select2-selection__clear {
|
286
|
+
cursor: pointer;
|
287
|
+
float: right;
|
288
|
+
font-weight: bold;
|
289
|
+
margin-right: 10px; }
|
290
|
+
.select2-container--classic .select2-selection--single .select2-selection__placeholder {
|
291
|
+
color: #999; }
|
292
|
+
.select2-container--classic .select2-selection--single .select2-selection__arrow {
|
293
|
+
background-color: #ddd;
|
294
|
+
border: none;
|
295
|
+
border-left: 1px solid #aaa;
|
296
|
+
border-top-right-radius: 4px;
|
297
|
+
border-bottom-right-radius: 4px;
|
298
|
+
height: 26px;
|
299
|
+
position: absolute;
|
300
|
+
top: 1px;
|
301
|
+
right: 1px;
|
302
|
+
width: 20px;
|
303
|
+
background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
304
|
+
background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
305
|
+
background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
|
306
|
+
background-repeat: repeat-x;
|
307
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#cccccc', GradientType=0); }
|
308
|
+
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
|
309
|
+
border-color: #888 transparent transparent transparent;
|
310
|
+
border-style: solid;
|
311
|
+
border-width: 5px 4px 0 4px;
|
312
|
+
height: 0;
|
313
|
+
left: 50%;
|
314
|
+
margin-left: -4px;
|
315
|
+
margin-top: -2px;
|
316
|
+
position: absolute;
|
317
|
+
top: 50%;
|
318
|
+
width: 0; }
|
319
|
+
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
320
|
+
float: left; }
|
321
|
+
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
322
|
+
border: none;
|
323
|
+
border-right: 1px solid #aaa;
|
324
|
+
border-radius: 0;
|
325
|
+
border-top-left-radius: 4px;
|
326
|
+
border-bottom-left-radius: 4px;
|
327
|
+
left: 1px;
|
328
|
+
right: auto; }
|
329
|
+
.select2-container--classic.select2-container--open .select2-selection--single {
|
330
|
+
border: 1px solid #5897fb; }
|
331
|
+
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
|
332
|
+
background: transparent;
|
333
|
+
border: none; }
|
334
|
+
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
335
|
+
border-color: transparent transparent #888 transparent;
|
336
|
+
border-width: 0 4px 5px 4px; }
|
337
|
+
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
|
338
|
+
border-top: none;
|
339
|
+
border-top-left-radius: 0;
|
340
|
+
border-top-right-radius: 0;
|
341
|
+
background-image: -webkit-linear-gradient(top, #ffffff 0%, #eeeeee 50%);
|
342
|
+
background-image: -o-linear-gradient(top, #ffffff 0%, #eeeeee 50%);
|
343
|
+
background-image: linear-gradient(to bottom, #ffffff 0%, #eeeeee 50%);
|
344
|
+
background-repeat: repeat-x;
|
345
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0); }
|
346
|
+
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
|
347
|
+
border-bottom: none;
|
348
|
+
border-bottom-left-radius: 0;
|
349
|
+
border-bottom-right-radius: 0;
|
350
|
+
background-image: -webkit-linear-gradient(top, #eeeeee 50%, #ffffff 100%);
|
351
|
+
background-image: -o-linear-gradient(top, #eeeeee 50%, #ffffff 100%);
|
352
|
+
background-image: linear-gradient(to bottom, #eeeeee 50%, #ffffff 100%);
|
353
|
+
background-repeat: repeat-x;
|
354
|
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0); }
|
355
|
+
.select2-container--classic .select2-selection--multiple {
|
356
|
+
background-color: white;
|
357
|
+
border: 1px solid #aaa;
|
358
|
+
border-radius: 4px;
|
359
|
+
cursor: text;
|
360
|
+
outline: 0; }
|
361
|
+
.select2-container--classic .select2-selection--multiple:focus {
|
362
|
+
border: 1px solid #5897fb; }
|
363
|
+
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
|
364
|
+
list-style: none;
|
365
|
+
margin: 0;
|
366
|
+
padding: 0 5px; }
|
367
|
+
.select2-container--classic .select2-selection--multiple .select2-selection__clear {
|
368
|
+
display: none; }
|
369
|
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
|
370
|
+
background-color: #e4e4e4;
|
371
|
+
border: 1px solid #aaa;
|
372
|
+
border-radius: 4px;
|
373
|
+
cursor: default;
|
374
|
+
float: left;
|
375
|
+
margin-right: 5px;
|
376
|
+
margin-top: 5px;
|
377
|
+
padding: 0 5px; }
|
378
|
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
|
379
|
+
color: #888;
|
380
|
+
cursor: pointer;
|
381
|
+
display: inline-block;
|
382
|
+
font-weight: bold;
|
383
|
+
margin-right: 2px; }
|
384
|
+
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
|
385
|
+
color: #555; }
|
386
|
+
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
387
|
+
float: right; }
|
388
|
+
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
389
|
+
margin-left: 5px;
|
390
|
+
margin-right: auto; }
|
391
|
+
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
392
|
+
margin-left: 2px;
|
393
|
+
margin-right: auto; }
|
394
|
+
.select2-container--classic.select2-container--open .select2-selection--multiple {
|
395
|
+
border: 1px solid #5897fb; }
|
396
|
+
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
|
397
|
+
border-top: none;
|
398
|
+
border-top-left-radius: 0;
|
399
|
+
border-top-right-radius: 0; }
|
400
|
+
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
|
401
|
+
border-bottom: none;
|
402
|
+
border-bottom-left-radius: 0;
|
403
|
+
border-bottom-right-radius: 0; }
|
404
|
+
.select2-container--classic .select2-search--dropdown .select2-search__field {
|
405
|
+
border: 1px solid #aaa;
|
406
|
+
outline: 0; }
|
407
|
+
.select2-container--classic .select2-search--inline .select2-search__field {
|
408
|
+
outline: 0; }
|
409
|
+
.select2-container--classic .select2-dropdown {
|
410
|
+
background-color: white;
|
411
|
+
border: 1px solid transparent; }
|
412
|
+
.select2-container--classic .select2-dropdown--above {
|
413
|
+
border-bottom: none; }
|
414
|
+
.select2-container--classic .select2-dropdown--below {
|
415
|
+
border-top: none; }
|
416
|
+
.select2-container--classic .select2-results > .select2-results__options {
|
417
|
+
max-height: 200px;
|
418
|
+
overflow-y: auto; }
|
419
|
+
.select2-container--classic .select2-results__option[role=group] {
|
420
|
+
padding: 0; }
|
421
|
+
.select2-container--classic .select2-results__option[aria-disabled=true] {
|
422
|
+
color: grey; }
|
423
|
+
.select2-container--classic .select2-results__option--highlighted[aria-selected] {
|
424
|
+
background-color: #3875d7;
|
425
|
+
color: white; }
|
426
|
+
.select2-container--classic .select2-results__group {
|
427
|
+
cursor: default;
|
428
|
+
display: block;
|
429
|
+
padding: 6px; }
|
430
|
+
.select2-container--classic.select2-container--open .select2-dropdown {
|
431
|
+
border-color: #5897fb; }
|
@@ -12,6 +12,13 @@ module Effective
|
|
12
12
|
Inputs::EffectiveStaticControl::Input.new(@object, @object_name, @template, method, merged_input_js_options(options)).to_html
|
13
13
|
end
|
14
14
|
|
15
|
+
def effective_select(method, options_tag = nil, options = {})
|
16
|
+
options[:collection] = options_tag
|
17
|
+
options[:label_method] = :to_s
|
18
|
+
options[:value_method] = :to_s
|
19
|
+
Inputs::EffectiveSelect::Input.new(@object, @object_name, @template, method, merged_input_js_options(options)).to_html
|
20
|
+
end
|
21
|
+
|
15
22
|
private
|
16
23
|
|
17
24
|
def merged_input_js_options(options)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Inputs
|
2
|
+
module EffectiveSelect
|
3
|
+
class Input < Effective::FormInput
|
4
|
+
delegate :collection_select, :to => :@template
|
5
|
+
|
6
|
+
def default_input_js_options
|
7
|
+
{:minimumResultsForSearch => 6, :tokenSeparators => [',', ' '], :width => 'style'}
|
8
|
+
end
|
9
|
+
|
10
|
+
def default_input_classes
|
11
|
+
[:effective_select]
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_html
|
15
|
+
collection_select(@object_name, @method, options.delete(:collection), options.delete(:label_method), options.delete(:value_method), options.merge({:selected => value}), options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def options
|
19
|
+
super do |options|
|
20
|
+
options[:multiple] = true if options[:tags]
|
21
|
+
|
22
|
+
# If multiple...
|
23
|
+
options['data-input-js-options'][:allowClear] = (!options[:multiple])
|
24
|
+
options[:include_blank] = false if options[:multiple]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# = simple_form_for @thing do |f|
|
2
|
+
# = f.input :category, :as => :effective_select
|
3
|
+
|
4
|
+
if defined?(SimpleForm)
|
5
|
+
|
6
|
+
class EffectiveSelectInput < SimpleForm::Inputs::CollectionSelectInput
|
7
|
+
def input(wrapper_options = nil)
|
8
|
+
label_method, value_method = detect_collection_methods
|
9
|
+
|
10
|
+
options = merge_wrapper_options(input_html_options, wrapper_options) || {}
|
11
|
+
|
12
|
+
# This gives us multiple and include_blank properly
|
13
|
+
options.merge!(input_options.select { |k, _| EffectiveFormInputs::REJECTED_INPUT_JS_OPTIONS.include?(k) })
|
14
|
+
|
15
|
+
options['data-input-js-options'] = input_options.reject { |k, _| EffectiveFormInputs::REJECTED_INPUT_JS_OPTIONS.include?(k) }
|
16
|
+
|
17
|
+
options[:collection] = collection
|
18
|
+
options[:label_method] = label_method
|
19
|
+
options[:value_method] = value_method
|
20
|
+
Inputs::EffectiveSelect::Input.new(object, object_name, template, attribute_name, options).to_html
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
/ this gives me a mechanism to test the inputs easily on a site with effective style_guide installed
|
2
2
|
|
3
|
-
= form_for Effective::StyleGuide.new(), :url => '/' do |f|
|
3
|
+
= form_for Effective::StyleGuide.new(:category => 'Category 2'), :url => '/' do |f|
|
4
4
|
= f.effective_date_time_picker :updated_at
|
5
5
|
= f.effective_date_picker :updated_at
|
6
|
+
= f.effective_select :category, 10.times.map { |x| "Category #{x}"}, :include_blank => false, :placeholder => 'Pleze chooze', :multiple => true
|
@@ -5,8 +5,10 @@ module EffectiveFormInputs
|
|
5
5
|
config.autoload_paths += Dir["#{config.root}/app/models/**/"]
|
6
6
|
|
7
7
|
initializer 'effective_orders.action_view' do |app|
|
8
|
-
|
9
|
-
|
8
|
+
Rails.application.config.to_prepare do
|
9
|
+
ActiveSupport.on_load :action_view do
|
10
|
+
ActionView::Helpers::FormBuilder.send(:include, Effective::FormBuilderInputs)
|
11
|
+
end
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
@@ -2,5 +2,5 @@ require "effective_form_inputs/engine"
|
|
2
2
|
require "effective_form_inputs/version"
|
3
3
|
|
4
4
|
module EffectiveFormInputs
|
5
|
-
REJECTED_INPUT_JS_OPTIONS = [:as, :hint, :error, :readonly, :disabled, :required, :label, :inline_label, :
|
5
|
+
REJECTED_INPUT_JS_OPTIONS = [:as, :hint, :error, :readonly, :disabled, :required, :label, :inline_label, :prompt, :min_max, :maxlength, :pattern, :input_html, :wrapper_html, :error_html, :id, :wrapper, :collection, :multiple, :include_blank, :label_method, :value_method]
|
6
6
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_form_inputs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: simple_form
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.1.0
|
27
41
|
description: Collection of Form Inputs
|
28
42
|
email:
|
29
43
|
- info@codeandeffect.com
|
@@ -41,16 +55,25 @@ files:
|
|
41
55
|
- app/assets/javascripts/effective_date_time_picker/input.js
|
42
56
|
- app/assets/javascripts/effective_date_time_picker/moment.js
|
43
57
|
- app/assets/javascripts/effective_form_inputs.js
|
58
|
+
- app/assets/javascripts/effective_select/initialize.js.coffee
|
59
|
+
- app/assets/javascripts/effective_select/input.js
|
60
|
+
- app/assets/javascripts/effective_select/select2.js
|
44
61
|
- app/assets/stylesheets/effective_date_picker/input.scss
|
45
62
|
- app/assets/stylesheets/effective_date_time_picker/bootstrap-datetimepicker.scss
|
46
63
|
- app/assets/stylesheets/effective_date_time_picker/input.scss
|
47
64
|
- app/assets/stylesheets/effective_form_inputs.scss
|
65
|
+
- app/assets/stylesheets/effective_select/bootstrap-theme.css
|
66
|
+
- app/assets/stylesheets/effective_select/input.scss
|
67
|
+
- app/assets/stylesheets/effective_select/overrides.scss
|
68
|
+
- app/assets/stylesheets/effective_select/select2.css
|
48
69
|
- app/models/effective/form_builder_inputs.rb
|
49
70
|
- app/models/effective/form_input.rb
|
50
71
|
- app/models/inputs/effective_date_picker/input.rb
|
51
72
|
- app/models/inputs/effective_date_picker_input.rb
|
52
73
|
- app/models/inputs/effective_date_time_picker/input.rb
|
53
74
|
- app/models/inputs/effective_date_time_picker_input.rb
|
75
|
+
- app/models/inputs/effective_select/input.rb
|
76
|
+
- app/models/inputs/effective_select_input.rb
|
54
77
|
- app/models/inputs/effective_static_control/input.rb
|
55
78
|
- app/models/inputs/effective_static_control_input.rb
|
56
79
|
- app/views/effective/style_guide/_form_default.html.haml
|