awesomplete 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -14
- data/lib/awesomplete/monkey_patch.rb +12 -8
- data/lib/awesomplete/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8dbdffa99c7b4db201b4a20d7383717c60bb161
|
4
|
+
data.tar.gz: 1303b9ad188717b58259ef089252cfef351b9ddf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a5fcd8cba3d35016004a8e34cc644bb2ae491b7c174f512e6adcaf4c5e857e895f3e9a72daa546b3c2b265bfe4f02a3e5c64425077ff30ebc266b81c8e8dfc0
|
7
|
+
data.tar.gz: 39bc86d1b5b96aba300a619c43a93675a4e028fd36d9d44d35bcfee94f4b1924a91a61b953461a3750a595c4993f25703af7025bcd4c88c33158ffd56e0d429a
|
data/README.md
CHANGED
@@ -41,30 +41,36 @@ in controller:
|
|
41
41
|
|
42
42
|
```erb
|
43
43
|
def index
|
44
|
-
@
|
44
|
+
@input_one = ['five', 'six', 'seven']
|
45
|
+
@input_two = ['one', 'two', 'three']
|
45
46
|
end
|
46
47
|
```
|
47
48
|
|
48
|
-
|
49
|
+
with [`form_for`](http://apidock.com/rails/ActionView/Helpers/FormHelper/form_for):
|
49
50
|
|
50
51
|
```erb
|
51
|
-
<%=
|
52
|
+
<%= form_for(:post, url: posts_path) do |f| %>
|
53
|
+
<%= f.awesomplete_field(:name, collection: @input_one) %>
|
52
54
|
```
|
53
55
|
|
54
|
-
|
55
|
-
You can configurate this autocomplete by two ways:
|
56
|
+
with [`simple_form`](https://github.com/plataformatec/simple_form) :smile: :
|
56
57
|
|
57
|
-
|
58
|
+
```erb
|
59
|
+
<%= simple_form_for(:post, url: posts_path) do |i| %>
|
60
|
+
<%= i.awesomplete_field(:title, collection: @input_two) %>
|
61
|
+
```
|
62
|
+
|
63
|
+
or just in view:
|
64
|
+
|
65
|
+
```erb
|
66
|
+
<%= awesomplete_field(:name, collection: @input_one) %>
|
67
|
+
```
|
58
68
|
|
59
|
-
|
60
|
-
|
61
|
-
```
|
69
|
+
## Configure
|
70
|
+
You can configurate this autocomplete:
|
62
71
|
|
63
|
-
|
72
|
+
#TODO
|
64
73
|
|
65
|
-
```javascript
|
66
|
-
#TODO
|
67
|
-
```
|
68
74
|
* * *
|
69
75
|
|
70
76
|
|
@@ -72,7 +78,7 @@ You can configurate this autocomplete by two ways:
|
|
72
78
|
|
73
79
|
1. Write update version task.
|
74
80
|
|
75
|
-
2.
|
81
|
+
2. More options
|
76
82
|
|
77
83
|
Kiselenko Roman
|
78
84
|
|
@@ -1,10 +1,14 @@
|
|
1
|
-
ActionView::Helpers::FormBuilder.
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
#{
|
7
|
-
|
8
|
-
|
1
|
+
[ActionView::Helpers::FormTagHelper, ActionView::Helpers::FormBuilder].each do |scope|
|
2
|
+
scope.class_eval do
|
3
|
+
define_method :awesomplete_field do |name, options|
|
4
|
+
<<-INP.squish.html_safe
|
5
|
+
<input class='awesomplete' name='#{name}' list='#{name}_list' >
|
6
|
+
<datalist id='#{name}_list'>
|
7
|
+
#{options[:collection].map { |i| '<option>'+ i +'</option>' }}
|
8
|
+
</datalist>
|
9
|
+
INP
|
10
|
+
end
|
9
11
|
end
|
10
12
|
end
|
13
|
+
|
14
|
+
|
data/lib/awesomplete/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awesomplete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fishbullet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|