recordselect 3.10.4 → 3.10.6
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: a803f4cce0feb7095d6ab279c96c7c21c000c4793a18ecf31ba853201d7a657e
|
4
|
+
data.tar.gz: '09a46eba1ccd474a57f85fc5898a8bb189933921ad966fc0c13f82ec8b30dab5'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b71316cb9333e52790f6f73ef953c356254ccaa2cb92a8b18efa1a34fbb644e507d41b325687e6d71cae3386673f44520db16a29fee5d7007cf163c72e25f785
|
7
|
+
data.tar.gz: 0dff189b2e67a6a41c03946513ada59ffa901dfd48192c68b0c590e89b82fca3005ae4a50f9040169894be3b3103e2baa39290311ab2d060ea442e9c338fb87c
|
@@ -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: :button, 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.6
|
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-03-21 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
|