recordselect 3.2.3 → 3.2.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -507,7 +507,7 @@ RecordSelect.Multiple = RecordSelect.Abstract.extend({
|
|
507
507
|
|
508
508
|
// decide where the <li> entries should be placed
|
509
509
|
if (this.options.list) this.list_container = jQuery(this.options.list);
|
510
|
-
else this.list_container = this.obj.
|
510
|
+
else this.list_container = this.obj.siblings('ul');
|
511
511
|
|
512
512
|
// take the input name from the text input, and store it for this.add()
|
513
513
|
this.input_name = this.obj.attr('name');
|
@@ -4,16 +4,11 @@ module RecordSelect
|
|
4
4
|
# params => [:page, :search]
|
5
5
|
def browse
|
6
6
|
conditions = record_select_conditions
|
7
|
-
klass = record_select_model
|
8
|
-
@count = klass.count
|
7
|
+
klass = record_select_model.where(conditions).includes(record_select_includes)
|
8
|
+
@count = klass.count
|
9
9
|
@count = @count.length if @count.is_a? ActiveSupport::OrderedHash
|
10
10
|
pager = ::Paginator.new(@count, record_select_config.per_page) do |offset, per_page|
|
11
|
-
klass.
|
12
|
-
:select => record_select_select||"*",
|
13
|
-
:include => [record_select_includes, record_select_config.include].flatten.compact,
|
14
|
-
:limit => per_page,
|
15
|
-
:conditions => conditions,
|
16
|
-
:order => record_select_config.order_by)
|
11
|
+
klass.select(record_select_select).includes(record_select_config.include).order(record_select_config.order_by).limit(per_page).offset(offset).all
|
17
12
|
end
|
18
13
|
@page = pager.page(params[:page] || 1)
|
19
14
|
|
@@ -129,6 +129,7 @@ module RecordSelectHelper
|
|
129
129
|
record_select_options[:current] = current.inject([]) { |memo, record| memo.push({:id => record.id, :label => label_for_field(record, controller)}) }
|
130
130
|
|
131
131
|
html = text_field_tag("#{name}[]", nil, options.merge(:autocomplete => 'off', :onfocus => "this.focused=true", :onblur => "this.focused=false"))
|
132
|
+
html << hidden_field_tag("#{name}[]", '', :id => nil)
|
132
133
|
html << content_tag('ul', '', :class => 'record-select-list');
|
133
134
|
|
134
135
|
# js identifier so we can talk to it.
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recordselect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 3.2.
|
9
|
+
- 4
|
10
|
+
version: 3.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sergio Cambra
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-
|
20
|
+
date: 2012-12-07 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
type: :development
|