bootstrap3_autocomplete_input 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3984546e55a3e5317b09cdbe36833bc5a3edbba
4
- data.tar.gz: 8a4be701f1df3af192ac81f2536b2cf58a4e6045
3
+ metadata.gz: 4ebf0f58fea9e6ed3c085ff49463d504bf366cfd
4
+ data.tar.gz: 0dcfaa307cc8bcef94178b25261db98c7e7a888c
5
5
  SHA512:
6
- metadata.gz: 5af72f1caba9c06b3611829bb258337c81d8ec580bcd65c29bed40b63a846bcaad92506a23a083c1174f48d457e5914e157b5b4688a441981bc2cc17fc67dce9
7
- data.tar.gz: 5268b1b9bf7c652f3ab8c1f041d7c6165cc676bc5a819c9fe58e8bdf8066f8e43e0665daaec1595b24873337e257f484b5be467b277537a8165f05b7ad07b2c1
6
+ metadata.gz: e8250393800b754ad487b88ed82ad09c86f5f7c1c50a7501022759957bd25ec02a228a35869b9e62bb9ec9fb62034c142ab86dfd4e97b5d9270c4415e0a08296
7
+ data.tar.gz: 08fbe63f54804eb6cfaa2b131ba27b58e3f03fb53937822debddd38d5d5965c83e4d6f18c60855c49979091b2f964d0cc1d96a7b53b1ad522b45c9dcb4b8dd01
@@ -1,4 +1,4 @@
1
- class AutocompleteInput < SimpleForm::Inputs::TextInput
1
+ class AutocompleteInput < SimpleForm::Inputs::TextInput
2
2
  #enable :placeholder, :maxlength
3
3
 
4
4
  def input(wrapper_options = nil)
@@ -16,12 +16,16 @@ class AutocompleteInput < SimpleForm::Inputs::TextInput
16
16
 
17
17
  hidden_options = {}
18
18
  hidden_options[:id] = hidden_id
19
+ hidden_options[:input_html] ||= {}
19
20
 
20
21
  # value
21
- value_method = hidden_options[:id]
22
+ value_method = "#{attribute_name}_id"
22
23
  if object.respond_to?(value_method)
23
- hidden_options[:value] = object.send(value_method)
24
+ v = object.send(value_method)
25
+ elsif new_html_options.has_key?(:value)
26
+ v = new_html_options[:value]
24
27
  end
28
+ hidden_options[:value] = v unless v.nil?
25
29
 
26
30
  out << @builder.hidden_field(hidden_name, hidden_options)
27
31
  end
@@ -56,6 +60,10 @@ class AutocompleteInput < SimpleForm::Inputs::TextInput
56
60
  new_options["data-min-length"] = options[:minLength] || 1
57
61
  new_options["data-afterSelect"] = options[:afterSelect] || false
58
62
 
63
+ # value
64
+ new_options[:value] = options[:value_text] || ''
65
+
66
+
59
67
  input_html_options.merge new_options
60
68
  end
61
69
 
@@ -12,7 +12,6 @@ function autocomplete_query(obj){
12
12
  rows = [];
13
13
 
14
14
  var name = obj.attr('name');
15
- //autocomplete_data_static[name] = {"map":[], "values": []};
16
15
 
17
16
  // load data from remote server
18
17
  $.getJSON( obj.attr('data-source-query'), {q: q},
@@ -1,3 +1,3 @@
1
1
  module Bootstrap3AutocompleteInput
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap3_autocomplete_input
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Ivak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-08 00:00:00.000000000 Z
11
+ date: 2015-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails