spree_autosuggest 2.0.0 → 2.0.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 +4 -4
- data/.gitignore +1 -0
- data/README.md +24 -7
- data/app/assets/javascripts/{store → frontend}/autosuggest.js.coffee +0 -0
- data/app/assets/javascripts/{store → frontend}/spree_autosuggest.js.coffee.erb +1 -1
- data/app/controllers/base_controller_decorator.rb +1 -1
- data/lib/generators/spree_autosuggest/install/install_generator.rb +6 -1
- data/lib/tasks/seed.rake +2 -2
- data/spree_autosuggest.gemspec +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84d37fd471ca76cd753275430e49ad348e16b24a
|
4
|
+
data.tar.gz: 19f73c134e37719d7b70460854c01eac75caab00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9845fe7d4fe6fb5c939ad2cce3015690eca3b479d3e82b167421cf706610a1dee1b989c69d2f57627824ee3942446e24261551427f4c931a0995484a03f8a88
|
7
|
+
data.tar.gz: 37aece41466bd459b7fd5ba8ff4f7f81e4f65945a105d4e39523a52aa538ad95012b54ebe2ac862d2fa07335beb69883e3c35089501b3d26a2b33c6a480a407b
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,29 @@
|
|
1
|
-
Spree Autosuggest
|
2
|
-
=================
|
1
|
+
# Spree Autosuggest
|
3
2
|
|
4
3
|
This extension adds suggestions for product search.
|
5
4
|
|
6
|
-
|
5
|
+

|
7
6
|
|
8
|
-
|
9
|
-
2. Run `rails g spree_autosuggest:install`
|
10
|
-
3. Run `rake spree_autosuggest:seed` to add all Taxon & Product names to the autosuggest database
|
7
|
+
## Installation
|
11
8
|
|
12
|
-
|
9
|
+
1. Add the Spree Autosuggest gem to your `Gemfile`:
|
10
|
+
```ruby
|
11
|
+
gem 'spree_autosuggest'
|
12
|
+
```
|
13
|
+
|
14
|
+
2. Run:
|
15
|
+
```sh
|
16
|
+
$ bundle install
|
17
|
+
$ rails g spree_autosuggest:install
|
18
|
+
```
|
19
|
+
|
20
|
+
3. In order to add all Taxon & Product names to the autosuggest database run:
|
21
|
+
```sh
|
22
|
+
rake spree_autosuggest:seed
|
23
|
+
```
|
24
|
+
|
25
|
+
Copyright (c) 2012-2015 [ademidov][1], [divineforest][2] and other [contributors][3], released under the [New BSD License].
|
26
|
+
|
27
|
+
[1]: https://github.com/ademidov
|
28
|
+
[2]: https://github.com/divineforest
|
29
|
+
[3]: https://github.com/evrone/spree_autosuggest/graphs/contributors
|
File without changes
|
@@ -6,7 +6,7 @@ Spree::BaseController.class_eval do
|
|
6
6
|
keywords = @searcher.try!(:keywords)
|
7
7
|
|
8
8
|
if @products.present? and keywords.present?
|
9
|
-
query = Spree::Suggestion.
|
9
|
+
query = Spree::Suggestion.find_or_initialize_by(keywords: keywords)
|
10
10
|
|
11
11
|
query.items_found = @products.size
|
12
12
|
query.increment(:count)
|
@@ -3,7 +3,12 @@ module SpreeAutosuggest
|
|
3
3
|
class InstallGenerator < Rails::Generators::Base
|
4
4
|
|
5
5
|
def add_javascripts
|
6
|
-
append_file "
|
6
|
+
append_file "vendor/assets/javascripts/spree/frontend/all.js",
|
7
|
+
"//= require jquery-ui/autocomplete\n//= require frontend/spree_autosuggest\n"
|
8
|
+
end
|
9
|
+
|
10
|
+
def add_stylesheets
|
11
|
+
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require jquery-ui/autocomplete\n", before: /\*\//, verbose: true
|
7
12
|
end
|
8
13
|
|
9
14
|
def add_migrations
|
data/lib/tasks/seed.rake
CHANGED
@@ -3,7 +3,7 @@ namespace :spree_autosuggest do
|
|
3
3
|
# all taxons with more than two words
|
4
4
|
Spree::Taxon.where('parent_id IS NOT NULL').each do |taxon|
|
5
5
|
searcher = Spree::Config.searcher_class.new(:taxon => taxon.id)
|
6
|
-
query = Spree::Suggestion.
|
6
|
+
query = Spree::Suggestion.find_or_initialize_by(keywords: taxon.name)
|
7
7
|
query.items_found = searcher.retrieve_products.size
|
8
8
|
query.count = Spree::Autosuggest::Config[:min_count] + 1
|
9
9
|
query.save
|
@@ -11,7 +11,7 @@ namespace :spree_autosuggest do
|
|
11
11
|
|
12
12
|
# all product names
|
13
13
|
Spree::Product.find_each do |product|
|
14
|
-
query = Spree::Suggestion.
|
14
|
+
query = Spree::Suggestion.find_or_initialize_by(keywords: product.name)
|
15
15
|
query.items_found = 1
|
16
16
|
query.count = Spree::Autosuggest::Config[:min_count] + 1
|
17
17
|
query.save
|
data/spree_autosuggest.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.platform = Gem::Platform::RUBY
|
4
4
|
s.name = 'spree_autosuggest'
|
5
|
-
s.version = '2.0.
|
5
|
+
s.version = '2.0.2'
|
6
6
|
s.summary = 'Search suggestions for Spree'
|
7
7
|
s.description = 'Search suggestions for Spree'
|
8
8
|
s.required_ruby_version = '>= 1.8.7'
|
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.author = 'Demidov Aleksey, Alexander Balashov'
|
11
11
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
|
+
s.files -= ['screenshot.png']
|
13
14
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
15
|
s.require_path = 'lib'
|
15
16
|
s.requirements << 'none'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_autosuggest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Demidov Aleksey, Alexander Balashov
|
@@ -107,8 +107,8 @@ files:
|
|
107
107
|
- README.md
|
108
108
|
- Rakefile
|
109
109
|
- Versionfile
|
110
|
-
- app/assets/javascripts/
|
111
|
-
- app/assets/javascripts/
|
110
|
+
- app/assets/javascripts/frontend/autosuggest.js.coffee
|
111
|
+
- app/assets/javascripts/frontend/spree_autosuggest.js.coffee.erb
|
112
112
|
- app/controllers/base_controller_decorator.rb
|
113
113
|
- app/controllers/spree/suggestions_controller.rb
|
114
114
|
- app/models/spree/suggestion.rb
|