constructorio 1.0.3 → 1.0.4

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: 0afa62571df5734cb0bec7f26976b1ff8b4ed039
4
- data.tar.gz: 8bfbffbaee6ff520ec59a6d5208ef3fd5dba5b7d
3
+ metadata.gz: a44d85b592d503fee64cbf411daf318ab52fcfc9
4
+ data.tar.gz: 29aefce25803f2b066488c1550a047ee04ed0071
5
5
  SHA512:
6
- metadata.gz: 479bdfc0a8a29dfbcb15254af5f36a88438db4763f53d5ccbaa3a67cd5af066ac9f673483b154e36e788b9f47daa4f3e093b36a4dece7e899dd0581804f9db8b
7
- data.tar.gz: cfeca1527e5c9f1d543e38a514e41e02310c5a181d9e11c29effcbd288d1a68fb8c2a85468317ebf7efe2fcb8778927518c3a99fb893069b600fd3e8d5ab29b6
6
+ metadata.gz: 736e434f3feae53f9c501764871c7a96529efc39fdd124f557dd8fc55db98fe44cb25f6e03d31222497cb47d78739ce0173d6b861dd74683731c4b9e285f2898
7
+ data.tar.gz: 84df4cf7349f73b33f54cd0aa60f14a4f15b72d45630f442f1be4777550abb7b49a40fee1075abc5e41e2c84a6c1c821753b4ca9e801139bf06885045299abd0
data/README.md CHANGED
@@ -32,7 +32,7 @@ To add autocomplete to a model:
32
32
  ```
33
33
  class MyModel < ActiveRecord::Base
34
34
  include ConstructorIO
35
- autocomplete(['attribute1', 'attribute2'])
35
+ constructorio_autocomplete(['attribute1', 'attribute2'])
36
36
  end
37
37
 
38
38
  ```
@@ -40,7 +40,7 @@ end
40
40
  To attach an autocomplete dropdown to an input field, just insert this in your view:
41
41
 
42
42
  ```
43
- <%= autocomplete(dom_id: 'id_of_input_field') %>
43
+ <%= constructorio_autocomplete(dom_id: 'id_of_input_field') %>
44
44
  ```
45
45
 
46
46
  To import an existing data set into Constructor.io, you can use the rake task:
data/lib/constructorio.rb CHANGED
@@ -40,7 +40,7 @@ module ConstructorIO
40
40
  # "product_name", "description"
41
41
  # - or -
42
42
  # { 'attribute' => 'product_name', 'metadata' => { metadata_one => ->{ something_dynamic }} }
43
- def autocomplete(fields, autocomplete_key = ConstructorIO.configuration.autocomplete_key)
43
+ def constructorio_autocomplete(fields, autocomplete_key = ConstructorIO.configuration.autocomplete_key)
44
44
  # All fields require an attribute
45
45
  field_names = fields.map { |f| f.is_a?(String) ? f : f['attribute'] }
46
46
  raise MissingItemName if field_names.include? nil
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ConstructorIO
4
4
  module Helper
5
- def autocomplete(options = {})
5
+ def constructorio_autocomplete(options = {})
6
6
  result = %Q|<script type="text/javascript" src="//cnstrc.com/js/ac.js"></script>\n|
7
7
  result += %Q|<script>$(document).ready(function(){ $('##{options[:dom_id]}').constructorAutocomplete({ key: '#{ConstructorIO.configuration.autocomplete_key}' }); })</script>|
8
8
  return result.html_safe
@@ -1,3 +1,3 @@
1
1
  module ConstructorIO
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
data/test/test_helper.rb CHANGED
@@ -25,7 +25,7 @@ end
25
25
 
26
26
  class Person < ActiveRecord::Base
27
27
  include ConstructorIO
28
- autocomplete [{
28
+ constructorio_autocomplete [{
29
29
  'attribute' => 'first_name',
30
30
  'metadata' => {
31
31
  'test_metadata' => 'test_values',
@@ -37,13 +37,13 @@ end
37
37
  class PersonSimple < ActiveRecord::Base
38
38
  self.table_name = 'people'
39
39
  include ConstructorIO
40
- autocomplete [ 'first_name' ]
40
+ constructorio_autocomplete [ 'first_name' ]
41
41
  end
42
42
 
43
43
  class PersonNoKey < ActiveRecord::Base
44
44
  self.table_name = 'people'
45
45
  include ConstructorIO
46
- autocomplete [{'attribute' => 'last_name'}]
46
+ constructorio_autocomplete [{'attribute' => 'last_name'}]
47
47
  end
48
48
 
49
49
  class FakeView
@@ -6,6 +6,6 @@ class ViewHelperTest < MiniTest::Test
6
6
  end
7
7
 
8
8
  def test_autocomplete_html
9
- assert_equal @fakeview.autocomplete(dom_id: 'a'), "<script type=\"text/javascript\" src=\"//cnstrc.com/js/ac.js\"></script>\n<script>$(document).ready(function(){ $('#a').constructorAutocomplete({ key: 'example_autocomplete_key' }); })</script>"
9
+ assert_equal @fakeview.constructorio_autocomplete(dom_id: 'a'), "<script type=\"text/javascript\" src=\"//cnstrc.com/js/ac.js\"></script>\n<script>$(document).ready(function(){ $('#a').constructorAutocomplete({ key: 'example_autocomplete_key' }); })</script>"
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: constructorio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Lai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-15 00:00:00.000000000 Z
11
+ date: 2015-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord