uber_select_rails 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/uber_select_rails/version.rb +1 -1
- data/vendor/assets/javascript/uber_select/README.md +6 -0
- data/vendor/assets/javascript/uber_select/javascript/jquery.uber-select.js +1 -0
- data/vendor/assets/javascript/uber_select/javascript/uber_search.js +5 -1
- data/vendor/assets/javascript/uber_select/test.html +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41f2e1a1877958978c0a5577a899c31130a2a77e6392e5aa05b61286e5cfa4df
|
4
|
+
data.tar.gz: ed725ab8f9ab6d676c77c340cec323ee6082c539500fffe02611694e0de05c5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dab72aac31c287920ea7ce4d75c3919c9a27d5954efc537fd609f6f87d3f9841bf55a5c083ff48f1af66c62135fe221dc1f9e8679ab87e247b08e9ab6256016
|
7
|
+
data.tar.gz: b633f6e04dd022376cf002ace1752ec08e84821255717ac85365372521cef766b0cd8b7750207b0eb683fa79360a70f02308c09e5768aea70aa653d17f42c50b
|
@@ -94,6 +94,9 @@ Data is an array of objects. Each object may have the following properties:
|
|
94
94
|
- ##### text
|
95
95
|
String shown to the user in the list of results. This value is required if *value* is not provided.
|
96
96
|
|
97
|
+
- ##### selectedText
|
98
|
+
String shown to the user in the output container when this option is selected. *optional*
|
99
|
+
|
97
100
|
- ##### value
|
98
101
|
This is matched against the *value* option passed UberSearch and will appear selected if it matches. It is also used to match against search input text when the user searches. This value is required if *text* is not provided.
|
99
102
|
|
@@ -103,6 +106,9 @@ Data is an array of objects. Each object may have the following properties:
|
|
103
106
|
- ##### visibility
|
104
107
|
This is used to determine whether the option appears only when searching or only when not searching. Values accepted: `query`, `no-query`. *optional*
|
105
108
|
|
109
|
+
- ##### disabled
|
110
|
+
This is used to determine whether the option appears disabled. *optional*
|
111
|
+
|
106
112
|
- ##### group
|
107
113
|
This is used to visually group options. All options with the same group will appear together. *optional*
|
108
114
|
|
@@ -79,6 +79,7 @@
|
|
79
79
|
// This is optimized for performance and does not use jQuery convenience methods. Seems to be about 30% faster loading during non-scientific tests.
|
80
80
|
datum = {
|
81
81
|
text: option.textContent,
|
82
|
+
selectedText: getAttribute(option, 'data-selected-text'),
|
82
83
|
value: getAttribute(option, 'value'),
|
83
84
|
disabled: getAttribute(option, 'disabled'),
|
84
85
|
matchValue: getAttribute(option, 'data-match-value'),
|
@@ -288,7 +288,11 @@ var UberSearch = function(data, options){
|
|
288
288
|
}
|
289
289
|
|
290
290
|
function textFromValue(value){
|
291
|
-
return $.map(data, function(datum){
|
291
|
+
return $.map(data, function(datum) {
|
292
|
+
if (datum.value == value) {
|
293
|
+
return datum.selectedText || datum.text
|
294
|
+
}
|
295
|
+
})[0]
|
292
296
|
}
|
293
297
|
|
294
298
|
function updateMessages(){
|
@@ -199,6 +199,22 @@
|
|
199
199
|
<p>This example has a disabled select that should disable the entire UI.</p>
|
200
200
|
</span>
|
201
201
|
|
202
|
+
<span class="example">
|
203
|
+
<label for="select">
|
204
|
+
Selected Text
|
205
|
+
</label>
|
206
|
+
<select>
|
207
|
+
<option></option>
|
208
|
+
<option>Jimmy Johnson</option>
|
209
|
+
<option data-selected-text="Good Choice!">Custom Selected Text</option>
|
210
|
+
<option>Cosmo Kramer</option>
|
211
|
+
<option>Bob Zickowski</option>
|
212
|
+
<option>Nicholas Cage</option>
|
213
|
+
<option>Queen Latifah</option>
|
214
|
+
</select>
|
215
|
+
<p>This example has an option with <code>data-selected-text</code> that should show custom text in the output container when selected.</p>
|
216
|
+
</span>
|
217
|
+
|
202
218
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
203
219
|
<script src="javascript/string_extensions.js"></script>
|
204
220
|
<script src="javascript/search_field.js"></script>
|