recordselect 3.10.4 → 3.10.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbec8fe7307cc016095843fff9ff55706c5982a7773a590dc80be7a4b5f58271
|
4
|
+
data.tar.gz: e5d51be0faf92fc8241c59981eb94245deeacdb454d6092dd4dcd2f31993d7ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76208f34d043176e2ca3bd0c8b5b701d0526f3fc4c9e668fd39db4a56ef8cd8c17583427d626fff4366e45923ff040201470adea1eb2a623d1dc17285ccd5e00
|
7
|
+
data.tar.gz: af24de9c32c0a8cfc1c78097d3548b3cfb5b26f7ebc83992d1d70894a1f5bad8f4020930d24b08861279f49d7ddff0b524e9f2d0ef6a988e6ab02b412d1a7e14
|
@@ -131,6 +131,18 @@ jQuery(document).ready(function() {
|
|
131
131
|
rs.current_xhr = null;
|
132
132
|
}
|
133
133
|
});
|
134
|
+
jQuery(document).on('click', 'input.recordselect ~ .clear-input-button', function() {
|
135
|
+
var $clear_button = jQuery(event.target), $input = $clear_button.prevAll('input');
|
136
|
+
if (!$input.length) return;
|
137
|
+
$input.val('').removeClass('selected');
|
138
|
+
$clear_button.removeClass('enabled');
|
139
|
+
});
|
140
|
+
jQuery(document).on('input recordselect:change', 'input.recordselect', function(event) {
|
141
|
+
var $clear_button = jQuery(event.target).nextAll('.clear-input-button').first();
|
142
|
+
if (!$clear_button.length) return;
|
143
|
+
if (jQuery(event.target).val()) $clear_button.addClass('enabled');
|
144
|
+
else $clear_button.removeClass('enabled');
|
145
|
+
});
|
134
146
|
});
|
135
147
|
|
136
148
|
var RecordSelect = new Object();
|
@@ -148,3 +148,32 @@ iframe.record-select-mask {
|
|
148
148
|
background-repeat: no-repeat;
|
149
149
|
padding-right: 20px;
|
150
150
|
}
|
151
|
+
|
152
|
+
.recordselect + input[type=hidden] + button.clear-input-button {
|
153
|
+
/* button position */
|
154
|
+
position: relative;
|
155
|
+
right: 20px;
|
156
|
+
top: 3px;
|
157
|
+
/* button appearane */
|
158
|
+
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23777'><path d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>");
|
159
|
+
background-color: transparent;
|
160
|
+
width: 16px;
|
161
|
+
height: 16px;
|
162
|
+
appearance: none;
|
163
|
+
border: none;
|
164
|
+
border-radius: 50%;
|
165
|
+
margin: 0;
|
166
|
+
cursor: pointer;
|
167
|
+
text-indent: 20px;
|
168
|
+
overflow: hidden;
|
169
|
+
display: none;
|
170
|
+
&.enabled {
|
171
|
+
display: inline-block;
|
172
|
+
}
|
173
|
+
&:hover {
|
174
|
+
background-color: lightgray;
|
175
|
+
}
|
176
|
+
}
|
177
|
+
.recordselect.selected + input[type=hidden] + button.clear-input-button {
|
178
|
+
right: 40px;
|
179
|
+
}
|
@@ -46,18 +46,22 @@ module RecordSelectHelper
|
|
46
46
|
options[:id] ||= name.gsub(/[\[\]]/, '_')
|
47
47
|
options[:class] ||= ''
|
48
48
|
options[:class] << ' recordselect'
|
49
|
+
options[:clear_button] = true unless options.include? :clear_button
|
49
50
|
|
50
51
|
controller = assert_controller_responds(options.delete(:controller))
|
51
52
|
params = options.delete(:params)
|
52
53
|
record_select_options = {id: record_select_id(controller.controller_path)}
|
53
54
|
record_select_options[:field_name] = options.delete(:field_name) if options[:field_name]
|
55
|
+
clear_button_class = 'clear-input-button'
|
54
56
|
if current and not current.new_record?
|
55
57
|
record_select_options[:id] = current.id
|
56
58
|
record_select_options[:label] = label_for_field(current, controller)
|
59
|
+
clear_button_class << ' enabled'
|
57
60
|
end
|
58
61
|
record_select_options.merge! options[:rs] if options[:rs]
|
59
62
|
|
60
63
|
html = text_field_tag(name, nil, options.merge(:autocomplete => 'off', :onfocus => "this.focused=true", :onblur => "this.focused=false"))
|
64
|
+
html << button_tag('x', type: :reset, class: clear_button_class, aria_label: 'Clear input', title: 'Clear input') if options[:clear_button]
|
61
65
|
url = url_for({:action => :browse, :controller => controller.controller_path}.merge(params))
|
62
66
|
html << javascript_tag("new RecordSelect.Single(#{options[:id].to_json}, #{url.to_json}, #{record_select_options.to_json});")
|
63
67
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recordselect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.10.
|
4
|
+
version: 3.10.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Cambra
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-02-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
|
-
rubygems_version: 3.3
|
102
|
+
rubygems_version: 3.2.3
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: RecordSelect widget as a replacement for massive drop down lists
|