auto_awesomplete_tag 0.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 05c98af8fe00d9ccb251e63d0ac14b95de67e54c
4
+ data.tar.gz: a2f6003ccf102802d1eff116a4c6d3a311478672
5
+ SHA512:
6
+ metadata.gz: d239c43093ee95545a8a77d703edd7caa7d73e3e2be2fae1c187c25987b976dca95f8ee2c42b38e2aefda2092af5d56d546c7a5fcebfe00f86f7e7241cea513f
7
+ data.tar.gz: 26b4a632f4b76cef2f75922810f382b70d4db0ff02d81fe64e23e863a2866545aacfd834c50ae0b2d8024ed47bde905adc242c8699058ebec7a994e5ff65de14
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in auto_awesomplete_tag.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 lisichkin
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,64 @@
1
+ # AutoAwesompleteTag
2
+
3
+ Provide tag-helper methods for create awesomplete elements by the same way as any other view elements.
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/auto_awesomplete_tag.png)](http://badge.fury.io/rb/auto_awesomplete_tag)
6
+
7
+ ## Installation
8
+
9
+ Firstly install [AutoAwesomplete](https://github.com/Tab10id/auto_awesomplete#installation) with
10
+ dependency. Then add this line to your application's Gemfile:
11
+
12
+ gem 'auto_awesomplete_tag'
13
+
14
+ And execute:
15
+
16
+ $ bundle
17
+
18
+ ## Example
19
+
20
+ (stub)
21
+
22
+ ## Usage
23
+
24
+ Gem provide only one helper method for initialize awesomplete elements:
25
+
26
+ * awesomplete_ajax_tag
27
+
28
+ details about realization you can find on
29
+ [AutoAwesomplete](https://github.com/Tab10id/auto_awesomplete#installation) page.
30
+
31
+ ### awesomplete_ajax_tag
32
+
33
+ awesomplete_ajax_tag(name, searcher, value = nil, options = {})
34
+
35
+ All allowed options for this helper can be found on
36
+ [AutoAwesomplete](https://github.com/Tab10id/auto_awesomplete#ajax-awesomplete-usage) page. look at example
37
+ below; this is an easy way to understand helper parameters.
38
+
39
+ #### Example of usage awesomplete_ajax_tag
40
+
41
+ If you define [SearchAdapter](https://github.com/Tab10id/auto_awesomplete#example-of-minimalistic-searchadapter)
42
+ named `MySearchAdapterName`, you can use the follow code:
43
+
44
+ = awesomplete_ajax_tag :my_awesomplete_name,
45
+ :my_search_adapter_name,
46
+ placeholder: 'Fill me now!',
47
+ search_method: :unusual_case,
48
+ class: 'my-awesomplete-input'
49
+
50
+ If you want lightweight selection over columns of `ActiveRecord` model:
51
+
52
+ = awesomplete_ajax_tag :my_awesomplete_name,
53
+ {class_name: :your_model_name, text_column: :name},
54
+ placeholder: 'Fill me now!'
55
+
56
+ In this case you get awesomplete with search by `name` column over model `YourModelName`.
57
+
58
+ ## Contributing
59
+
60
+ 1. Fork it ( http://github.com/Tab10id/auto_awesomplete_tag/fork )
61
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
62
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
63
+ 4. Push to the branch (`git push origin my-new-feature`)
64
+ 5. Create new Pull Request
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'auto_awesomplete_tag/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'auto_awesomplete_tag'
8
+ spec.version = AutoAwesompleteTag::VERSION
9
+ spec.authors = ['Dmitry Lisichkin']
10
+ spec.email = ['dima@sb42.ru']
11
+ spec.description = %q{ActionView helper method for initialize awesomplete elements}
12
+ spec.summary = spec.description
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'auto_awesomplete', '~> 0.0.1'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ end
@@ -0,0 +1,6 @@
1
+ require 'auto_awesomplete_tag/version'
2
+ require 'auto_awesomplete_tag/helpers'
3
+
4
+ module AutoAwesompleteTag
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,5 @@
1
+ require 'auto_awesomplete_tag/helpers/rails_helper.rb'
2
+
3
+ module AutoAwesompleteTag::RailsHelper; end
4
+
5
+ ActionView::Base.send :include, AutoAwesompleteTag::RailsHelper
@@ -0,0 +1,29 @@
1
+ module AutoAwesompleteTag
2
+ module RailsHelper
3
+ def awesomplete_ajax_tag(name, searcher, value = nil, options={})
4
+ original_classes = options.delete(:class)
5
+ original_data = options.delete(:data) || {}
6
+ search_method = options.delete(:search_method)
7
+ classes = ['auto-ajax-awesomplete', original_classes].compact.join(' ')
8
+ controller_params = {}
9
+ if searcher.is_a?(Hash)
10
+ controller_params[:default_class_name] = searcher[:class_name] if searcher[:class_name].present?
11
+ controller_params[:default_text_column] = searcher[:text_column] if searcher[:text_column].present?
12
+ controller_params[:label_method] = searcher[:label_method] if searcher[:label_method].present?
13
+ else
14
+ controller_params[:class_name] = searcher
15
+ end
16
+ if search_method.present?
17
+ controller_params.merge!({ search_method: search_method })
18
+ end
19
+ system_field_options = {
20
+ class: classes,
21
+ data: original_data.merge(
22
+ {awesomplete_href: auto_awesompletes_path(controller_params)}
23
+ )
24
+ }
25
+ field_options = system_field_options.merge(options)
26
+ text_field_tag(name, value, field_options)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,3 @@
1
+ module AutoAwesompleteTag
2
+ VERSION = '0.0.3'
3
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: auto_awesomplete_tag
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Dmitry Lisichkin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: auto_awesomplete
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ description: ActionView helper method for initialize awesomplete elements
42
+ email:
43
+ - dima@sb42.ru
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - auto_awesomplete_tag.gemspec
53
+ - lib/auto_awesomplete_tag.rb
54
+ - lib/auto_awesomplete_tag/helpers.rb
55
+ - lib/auto_awesomplete_tag/helpers/rails_helper.rb
56
+ - lib/auto_awesomplete_tag/version.rb
57
+ homepage: ''
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.0.2
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: ActionView helper method for initialize awesomplete elements
81
+ test_files: []
82
+ has_rdoc: