recordselect 3.3.2 → 3.3.3
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 +7 -0
- data/app/assets/javascripts/jquery/record_select.js +6 -12
- data/app/assets/javascripts/prototype/record_select.js +5 -11
- data/app/assets/stylesheets/record_select.css.erb +16 -12
- data/app/views/record_select/_list.html.erb +1 -1
- data/lib/record_select/config.rb +0 -7
- data/lib/record_select/extensions/routing_mapper.rb +1 -10
- data/lib/record_select/helpers/record_select_helper.rb +0 -11
- data/lib/record_select/version.rb +1 -1
- metadata +13 -44
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
data.tar.gz: e8159d9a713401f593434b51de0dedf9a4caa019
|
4
|
+
metadata.gz: 96a5a44a3671f03c89d0c87aee1e93b53c96c3b6
|
5
|
+
SHA512:
|
6
|
+
data.tar.gz: 6c30d217a4be293c002f96a4703dabd0f36e2f2e2140ffe1be83146e072da1644d4e045deb18d68d6bf121ccfe45955f795fed6602a0b0acdb8804b916872b61
|
7
|
+
metadata.gz: 39aff08d2163bee6999df71dd46bb486b123761a910aa7e13135f6d154ef9abe7148d2efbeaefcd343fc7d70a164c71f40d202eb2fbb242af84602e28c68d30c
|
@@ -101,14 +101,11 @@ if (typeof(jQuery.fn.delayedObserver) === 'undefined') {
|
|
101
101
|
|
102
102
|
jQuery(document).ready(function() {
|
103
103
|
RecordSelect.document_loaded = true;
|
104
|
-
jQuery(document).on('
|
104
|
+
jQuery(document).on('click', 'div.record-select li.record', function(event) {
|
105
105
|
var link = jQuery(this);
|
106
|
-
if (link) {
|
107
|
-
|
108
|
-
|
109
|
-
} else {
|
110
|
-
link.toggleClass("selected");
|
111
|
-
}
|
106
|
+
if (link.length) {
|
107
|
+
RecordSelect.select_item(link);
|
108
|
+
return false;
|
112
109
|
}
|
113
110
|
return true;
|
114
111
|
});
|
@@ -117,12 +114,11 @@ jQuery(document).ready(function() {
|
|
117
114
|
var RecordSelect = new Object();
|
118
115
|
RecordSelect.document_loaded = false;
|
119
116
|
|
120
|
-
RecordSelect.
|
117
|
+
RecordSelect.select_item = function(item) {
|
121
118
|
var e = item.closest('.record-select-handler');
|
122
119
|
var onselect = e.get(0).onselect || e.attr('onselect');
|
123
120
|
if (typeof onselect != 'function') onselect = eval(onselect);
|
124
|
-
if (onselect)
|
125
|
-
{
|
121
|
+
if (onselect) {
|
126
122
|
try {
|
127
123
|
var label = jQuery.trim(item.find('label').first().text());
|
128
124
|
if (!label) label = item.text();
|
@@ -130,9 +126,7 @@ RecordSelect.notify = function(item) {
|
|
130
126
|
} catch(e) {
|
131
127
|
alert(e);
|
132
128
|
}
|
133
|
-
return false;
|
134
129
|
}
|
135
|
-
else return true;
|
136
130
|
}
|
137
131
|
|
138
132
|
RecordSelect.observe = function(id) {
|
@@ -1,13 +1,10 @@
|
|
1
1
|
document.observe("dom:loaded", function() {
|
2
2
|
RecordSelect.document_loaded = true;
|
3
|
-
document.on('
|
3
|
+
document.on('click', 'div.record-select li.record', function(event) {
|
4
4
|
var link = event.findElement();
|
5
5
|
if (link) {
|
6
|
-
|
7
|
-
|
8
|
-
} else {
|
9
|
-
link.toggleClassName("selected");
|
10
|
-
}
|
6
|
+
RecordSelect.select_item(link);
|
7
|
+
event.stop();
|
11
8
|
}
|
12
9
|
return true;
|
13
10
|
});
|
@@ -28,20 +25,17 @@ Form.Element.AfterActivity = function(element, callback, delay) {
|
|
28
25
|
var RecordSelect = new Object();
|
29
26
|
RecordSelect.document_loaded = false;
|
30
27
|
|
31
|
-
RecordSelect.
|
28
|
+
RecordSelect.select_item = function(item) {
|
32
29
|
var e = Element.up(item, '.record-select-handler');
|
33
30
|
var onselect = e.onselect || e.getAttribute('onselect');
|
34
31
|
if (typeof onselect != 'function') onselect = eval(onselect);
|
35
|
-
if (onselect)
|
36
|
-
{
|
32
|
+
if (onselect) {
|
37
33
|
try {
|
38
34
|
onselect(item.parentNode.id.substr(2), (item.down('label') || item).innerHTML.unescapeHTML(), e);
|
39
35
|
} catch(e) {
|
40
36
|
alert(e);
|
41
37
|
}
|
42
|
-
return false;
|
43
38
|
}
|
44
|
-
else return true;
|
45
39
|
};
|
46
40
|
|
47
41
|
RecordSelect.observe = function(id) {
|
@@ -38,19 +38,19 @@
|
|
38
38
|
clear: both;
|
39
39
|
}
|
40
40
|
|
41
|
-
.record-select a {
|
41
|
+
.record-select .record, .record-select a {
|
42
|
+
cursor: pointer;
|
42
43
|
color: #0066cc;
|
43
44
|
text-decoration: none;
|
44
45
|
}
|
45
46
|
|
46
|
-
.record-select ol a {
|
47
|
+
.record-select ol .record, .record-select ol a {
|
47
48
|
display: block;
|
48
|
-
zoom: 1;
|
49
49
|
background-color: #e6f2ff;
|
50
50
|
padding: 2px 4px;
|
51
51
|
}
|
52
52
|
|
53
|
-
.record-select ol .even
|
53
|
+
.record-select ol .even {
|
54
54
|
background-color: #ffffff;
|
55
55
|
}
|
56
56
|
|
@@ -70,6 +70,16 @@
|
|
70
70
|
vertical-align: middle;
|
71
71
|
}
|
72
72
|
|
73
|
+
.record-select ol .current,
|
74
|
+
.record-select ol li:hover {
|
75
|
+
background-color: #ffff88;
|
76
|
+
}
|
77
|
+
.record-select ol li a:hover {
|
78
|
+
color: inherit;
|
79
|
+
background-color: inherit;
|
80
|
+
}
|
81
|
+
|
82
|
+
.record-select ol li.found:hover,
|
73
83
|
.record-select ol .found {
|
74
84
|
text-align: center;
|
75
85
|
font-style: italic;
|
@@ -78,14 +88,8 @@
|
|
78
88
|
border-bottom: 1px solid #afd0f5;
|
79
89
|
}
|
80
90
|
|
81
|
-
.record-select ol .
|
82
|
-
|
83
|
-
background-color: #ffff88;
|
84
|
-
}
|
85
|
-
|
86
|
-
.record-select ol a.selected {
|
87
|
-
background-color: #666;
|
88
|
-
color: #fff;
|
91
|
+
.record-select ol li.found:hover {
|
92
|
+
background-color: inherit;
|
89
93
|
}
|
90
94
|
|
91
95
|
.record-select-container {
|
@@ -18,7 +18,7 @@ next_url = url_for(pagination_url_params.merge(:page => page.next.number)) if pa
|
|
18
18
|
<% end -%>
|
19
19
|
<% page.items.each do |record| -%>
|
20
20
|
<li class="record <%= cycle 'odd', 'even' %>" id="rs<%= record.id -%>">
|
21
|
-
<%=
|
21
|
+
<%= render_record_from_config(record) %>
|
22
22
|
</li>
|
23
23
|
<% end -%>
|
24
24
|
<% if page.next? -%>
|
data/lib/record_select/config.rb
CHANGED
@@ -17,8 +17,6 @@ module RecordSelect
|
|
17
17
|
@label = options[:label]
|
18
18
|
|
19
19
|
@include = options[:include]
|
20
|
-
|
21
|
-
@link = options[:link]
|
22
20
|
end
|
23
21
|
|
24
22
|
def self.js_framework=(framework)
|
@@ -88,11 +86,6 @@ module RecordSelect
|
|
88
86
|
@label ||= proc {|r| r.to_label}
|
89
87
|
end
|
90
88
|
|
91
|
-
# whether wrap the text returned by label in a link or not
|
92
|
-
def link?
|
93
|
-
@link.nil? || @link
|
94
|
-
end
|
95
|
-
|
96
89
|
protected
|
97
90
|
|
98
91
|
# A singularized underscored version of the model we're browsing
|
@@ -1,18 +1,9 @@
|
|
1
1
|
module ActionDispatch
|
2
2
|
module Routing
|
3
|
-
RECORD_SELECT_ROUTING = {
|
4
|
-
:collection => {:browse => :get},
|
5
|
-
:member => {:select => :post}
|
6
|
-
}
|
7
3
|
class Mapper
|
8
4
|
module Base
|
9
5
|
def record_select_routes
|
10
|
-
collection
|
11
|
-
ActionDispatch::Routing::RECORD_SELECT_ROUTING[:collection].each {|name, type| send(type, name)}
|
12
|
-
end
|
13
|
-
member do
|
14
|
-
ActionDispatch::Routing::RECORD_SELECT_ROUTING[:member].each {|name, type| send(type, name)}
|
15
|
-
end
|
6
|
+
get :browse, :on => :collection
|
16
7
|
end
|
17
8
|
end
|
18
9
|
end
|
@@ -163,17 +163,6 @@ module RecordSelectHelper
|
|
163
163
|
end
|
164
164
|
|
165
165
|
private
|
166
|
-
# render the record using the renderer and add a link to select the record
|
167
|
-
def render_record_in_list(record, controller_path)
|
168
|
-
text = render_record_from_config(record)
|
169
|
-
if record_select_config.link?
|
170
|
-
url_options = {:controller => controller_path, :action => :select, :id => record.id}
|
171
|
-
link_to text, url_options, :method => :post, :remote => true, :class => ''
|
172
|
-
else
|
173
|
-
text
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
166
|
|
178
167
|
# uses renderer (defaults to record_select_config.label) to determine how the given record renders.
|
179
168
|
def render_record_from_config(record, renderer = record_select_config.label)
|
metadata
CHANGED
@@ -1,13 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recordselect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 3
|
8
|
-
- 3
|
9
|
-
- 2
|
10
|
-
version: 3.3.2
|
4
|
+
version: 3.3.3
|
11
5
|
platform: ruby
|
12
6
|
authors:
|
13
7
|
- Sergio Cambra
|
@@ -17,53 +11,38 @@ autorequire:
|
|
17
11
|
bindir: bin
|
18
12
|
cert_chain: []
|
19
13
|
|
20
|
-
date:
|
14
|
+
date: 2014-05-19 00:00:00 Z
|
21
15
|
dependencies:
|
22
16
|
- !ruby/object:Gem::Dependency
|
23
|
-
type: :development
|
24
17
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
18
|
requirements:
|
27
|
-
-
|
19
|
+
- &id004
|
20
|
+
- ">="
|
28
21
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 0
|
32
22
|
version: "0"
|
33
23
|
version_requirements: *id001
|
34
24
|
prerelease: false
|
25
|
+
type: :development
|
35
26
|
name: shoulda
|
36
27
|
- !ruby/object:Gem::Dependency
|
37
|
-
type: :development
|
38
28
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
29
|
requirements:
|
41
30
|
- - ~>
|
42
31
|
- !ruby/object:Gem::Version
|
43
|
-
hash: 23
|
44
|
-
segments:
|
45
|
-
- 1
|
46
|
-
- 0
|
47
|
-
- 0
|
48
32
|
version: 1.0.0
|
49
33
|
version_requirements: *id002
|
50
34
|
prerelease: false
|
35
|
+
type: :development
|
51
36
|
name: bundler
|
52
37
|
- !ruby/object:Gem::Dependency
|
53
|
-
type: :runtime
|
54
38
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
39
|
requirements:
|
57
40
|
- - ">="
|
58
41
|
- !ruby/object:Gem::Version
|
59
|
-
hash: 5
|
60
|
-
segments:
|
61
|
-
- 3
|
62
|
-
- 1
|
63
|
-
- 3
|
64
42
|
version: 3.1.3
|
65
43
|
version_requirements: *id003
|
66
44
|
prerelease: false
|
45
|
+
type: :runtime
|
67
46
|
name: rails
|
68
47
|
description: RecordSelect is a Rails widget to help you pick one record out of many. I designed it as a more usable and performant alternative to generating a massive dropdown list
|
69
48
|
email: activescaffold@googlegroups.com
|
@@ -106,35 +85,25 @@ files:
|
|
106
85
|
homepage: http://github.com/scambra/recordselect
|
107
86
|
licenses:
|
108
87
|
- MIT
|
88
|
+
metadata: {}
|
89
|
+
|
109
90
|
post_install_message:
|
110
91
|
rdoc_options: []
|
111
92
|
|
112
93
|
require_paths:
|
113
94
|
- lib
|
114
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
96
|
requirements:
|
117
|
-
-
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
hash: 3
|
120
|
-
segments:
|
121
|
-
- 0
|
122
|
-
version: "0"
|
97
|
+
- *id004
|
123
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
-
none: false
|
125
99
|
requirements:
|
126
|
-
-
|
127
|
-
- !ruby/object:Gem::Version
|
128
|
-
hash: 3
|
129
|
-
segments:
|
130
|
-
- 0
|
131
|
-
version: "0"
|
100
|
+
- *id004
|
132
101
|
requirements: []
|
133
102
|
|
134
103
|
rubyforge_project:
|
135
|
-
rubygems_version:
|
104
|
+
rubygems_version: 2.0.7
|
136
105
|
signing_key:
|
137
|
-
specification_version:
|
106
|
+
specification_version: 4
|
138
107
|
summary: RecordSelect widget as a replacement for massive drop down lists
|
139
108
|
test_files:
|
140
109
|
- test/recordselect_test.rb
|