spree_maker_advanced_search 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -0
- data/.rspec +1 -0
- data/Gemfile +6 -0
- data/LICENSE +26 -0
- data/README.ja.md +54 -0
- data/README.md +56 -0
- data/Rakefile +15 -0
- data/app/assets/javascripts/admin/spree_advanced_search.js +1 -0
- data/app/assets/javascripts/admin/spree_maker_advanced_search.js +1 -0
- data/app/assets/javascripts/store/spree_advanced_search.js +1 -0
- data/app/assets/javascripts/store/spree_maker_advanced_search.js +1 -0
- data/app/assets/stylesheets/admin/spree_advanced_search.css +3 -0
- data/app/assets/stylesheets/admin/spree_maker_advanced_search.css +3 -0
- data/app/assets/stylesheets/store/spree_advanced_search.css +32 -0
- data/app/assets/stylesheets/store/spree_maker_advanced_search.css +3 -0
- data/app/controllers/products_controller_decorator.rb +18 -0
- data/app/overrides/add_advanced_search_link_to_nav_bar.rb +10 -0
- data/app/overrides/add_advanced_search_link_to_navigation.rb +13 -0
- data/app/views/spree/products/advanced_search.html.erb +74 -0
- data/bin/rails +7 -0
- data/config/locales/en.yml +24 -0
- data/config/locales/ja.yml +24 -0
- data/config/routes.rb +4 -0
- data/lib/generators/spree_maker_advanced_search/install/install_generator.rb +31 -0
- data/lib/spree_maker_advanced_search.rb +2 -0
- data/lib/spree_maker_advanced_search/engine.rb +22 -0
- data/lib/spree_maker_advanced_search/factories.rb +6 -0
- data/spec/spec_helper.rb +82 -0
- metadata +283 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Copyright (c) 2014 [name of plugin creator]
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice,
|
8
|
+
this list of conditions and the following disclaimer.
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
* Neither the name Spree nor the names of its contributors may be used to
|
13
|
+
endorse or promote products derived from this software without specific
|
14
|
+
prior written permission.
|
15
|
+
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
20
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
21
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
22
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
23
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
26
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.ja.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
SpreeMakerAdvancedSearch
|
2
|
+
========================
|
3
|
+
|
4
|
+
目的
|
5
|
+
-------
|
6
|
+
* 分類群やメーカーを指定して詳細検索でき、並べ替えを行えるようにします。
|
7
|
+
|
8
|
+
検索メニューの下に「詳細検索」リンクを表示。
|
9
|
+
詳細検索ページは、検索オプションとホームと同じデフォルトの結果を表示します。
|
10
|
+
検索オプション下の「ソート」リンクを使用して、検索結果をソートすることができます。
|
11
|
+
![MakerAdvancedSearch](https://raw.githubusercontent.com/wiki/digitalm/spree_maker_advanced_search/images/makeradvancedsearch1.jpg)
|
12
|
+
|
13
|
+
依存関係
|
14
|
+
------------
|
15
|
+
* [spree_add_on_menu](https://github.com/digitalm/spree_add_on_menu)
|
16
|
+
* [spree_maker_search](https://github.com/digitalm/spree_maker_search)
|
17
|
+
|
18
|
+
Installation
|
19
|
+
------------
|
20
|
+
|
21
|
+
Add spree_maker_advanced_search to your Gemfile:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'spree_maker_advanced_search', github: 'digitalm/spree_maker_advanced_search'
|
25
|
+
```
|
26
|
+
|
27
|
+
Bundle your dependencies and run the installation generator:
|
28
|
+
|
29
|
+
```shell
|
30
|
+
bundle
|
31
|
+
bundle exec rails g spree_add_on_menu:instal
|
32
|
+
bundle exec rails g spree_maker_search:instal
|
33
|
+
bundle exec rails g spree_maker_advanced_search:install
|
34
|
+
```
|
35
|
+
|
36
|
+
Testing
|
37
|
+
-------
|
38
|
+
|
39
|
+
Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.
|
40
|
+
|
41
|
+
```shell
|
42
|
+
bundle
|
43
|
+
bundle exec rake test_app
|
44
|
+
bundle exec rspec spec
|
45
|
+
```
|
46
|
+
|
47
|
+
When testing your applications integration with this extension you may use it's factories.
|
48
|
+
Simply add this require statement to your spec_helper:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
require 'spree_maker_advanced_search/factories'
|
52
|
+
```
|
53
|
+
|
54
|
+
Copyright (c) 2014 [Exsight.inc](http://www.exsight.co.jp/) , released under the New BSD License
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
SpreeMakerAdvancedSearch
|
2
|
+
========================
|
3
|
+
|
4
|
+
Purpose
|
5
|
+
-------
|
6
|
+
* Enable Advanced search including to select taxons and makers and sorting.
|
7
|
+
|
8
|
+
Appears link "Advanced Search" under search menu.
|
9
|
+
Advanced search page shows search options and default results same as HOME.
|
10
|
+
You can sort search result using "Sorting" link below search options.
|
11
|
+
|
12
|
+
![MakerAdvancedSearch](https://raw.githubusercontent.com/wiki/digitalm/spree_maker_advanced_search/images/makeradvancedsearch1.jpg)
|
13
|
+
|
14
|
+
Dependency
|
15
|
+
------------
|
16
|
+
It needs
|
17
|
+
* [spree_add_on_menu](https://github.com/digitalm/spree_add_on_menu) for admin menu tab expanding
|
18
|
+
* [spree_maker_search](https://github.com/digitalm/spree_maker_search) for maker list managing
|
19
|
+
|
20
|
+
Installation
|
21
|
+
------------
|
22
|
+
|
23
|
+
Add spree_maker_advanced_search to your Gemfile:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
gem 'spree_maker_advanced_search', github: 'digitalm/spree_maker_advanced_search'
|
27
|
+
```
|
28
|
+
|
29
|
+
Bundle your dependencies and run the installation generator:
|
30
|
+
|
31
|
+
```shell
|
32
|
+
bundle
|
33
|
+
bundle exec rails g spree_add_on_menu:instal
|
34
|
+
bundle exec rails g spree_maker_search:instal
|
35
|
+
bundle exec rails g spree_maker_advanced_search:install
|
36
|
+
```
|
37
|
+
|
38
|
+
Testing
|
39
|
+
-------
|
40
|
+
|
41
|
+
Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.
|
42
|
+
|
43
|
+
```shell
|
44
|
+
bundle
|
45
|
+
bundle exec rake test_app
|
46
|
+
bundle exec rspec spec
|
47
|
+
```
|
48
|
+
|
49
|
+
When testing your applications integration with this extension you may use it's factories.
|
50
|
+
Simply add this require statement to your spec_helper:
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
require 'spree_maker_advanced_search/factories'
|
54
|
+
```
|
55
|
+
|
56
|
+
Copyright (c) 2014 [Exsight.inc](http://www.exsight.co.jp/) , released under the New BSD License
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'spree/testing_support/extension_rake'
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new
|
8
|
+
|
9
|
+
task :default => [:spec]
|
10
|
+
|
11
|
+
desc 'Generates a dummy app for testing'
|
12
|
+
task :test_app do
|
13
|
+
ENV['LIB_NAME'] = 'spree_maker_advanced_search'
|
14
|
+
Rake::Task['extension:test_app'].invoke
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require admin/spree_backend
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require admin/spree_backend
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require store/spree_frontend
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require store/spree_frontend
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
2
|
+
*= require store/spree_frontend
|
3
|
+
*/
|
4
|
+
.add_on_advanced_search {
|
5
|
+
display: block;
|
6
|
+
}
|
7
|
+
.add_on_advanced_search ul{
|
8
|
+
list-style :none;
|
9
|
+
}
|
10
|
+
.add_on_advanced_search ul li {
|
11
|
+
display: inline;
|
12
|
+
float: left;
|
13
|
+
padding: 0 1em;
|
14
|
+
border-left: solid 1px black;
|
15
|
+
}
|
16
|
+
.add_on_advanced_search li:first-child{
|
17
|
+
border-left: none;
|
18
|
+
}
|
19
|
+
|
20
|
+
.advanced_search_link_sidebar {
|
21
|
+
display: block;
|
22
|
+
}
|
23
|
+
.advanced_search_link_sidebar ul{
|
24
|
+
list-style :none;
|
25
|
+
}
|
26
|
+
nav#advanced_search_link_sidebar .add_on_advanced_search {
|
27
|
+
border-bottom: 1px solid #D9D9DB;
|
28
|
+
font-size: 14px;
|
29
|
+
margin-top: 5px;
|
30
|
+
margin-bottom: 5px;
|
31
|
+
text-transform: uppercase;
|
32
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Spree::ProductsController.class_eval do
|
2
|
+
|
3
|
+
def advanced_search
|
4
|
+
@searcher = build_searcher(params)
|
5
|
+
|
6
|
+
@products = @searcher.retrieve_products.includes(:add_on_makers).includes(:variants_including_master => :prices).includes(:taxons)
|
7
|
+
@q = @products.search(params[:q])
|
8
|
+
|
9
|
+
if params[:q]
|
10
|
+
is_blank = (params[:q][:s].blank? && params[:q][:name_cont].blank? && params[:q][:add_on_makers_id_eq].blank? && params[:q][:variants_including_master_sku_cont].blank? && params[:q][:variants_including_master_prices_amount_gteq].blank? && params[:q][:variants_including_master_prices_amount_lteq].blank?) ? true : false
|
11
|
+
unless is_blank
|
12
|
+
@products = @q.result.page.per(Spree::Config[:products_per_page])
|
13
|
+
end
|
14
|
+
end
|
15
|
+
render "advanced_search"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Deface::Override.new(:virtual_path => 'spree/shared/_nav_bar',
|
2
|
+
:name => 'add_advanced_search_link_to_nav_bar',
|
3
|
+
:insert_bottom => "li#search-bar",
|
4
|
+
:text => "
|
5
|
+
<nav id='advanced_search_link_search-bar'>
|
6
|
+
<ul>
|
7
|
+
<li><%= link_to( t('add_on.advanced_search.advanced_search'), products_advanced_search_path ) %></li>
|
8
|
+
</ul>
|
9
|
+
</nav>
|
10
|
+
")
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Deface::Override.new(:virtual_path => 'spree/products/show',
|
2
|
+
:name => 'add_advanced_search_link_to_navigation',
|
3
|
+
:insert_bottom => "[data-hook='taxon_sidebar_navigation']",
|
4
|
+
:text => "
|
5
|
+
<nav id='advanced_search_link_sidebar'>
|
6
|
+
<div class='navigation'>
|
7
|
+
<h6 class='filter-title'><%=t('add_on.advanced_search')%></h6>
|
8
|
+
<ul>
|
9
|
+
<li><%= link_to( t('add_on.advanced_search.advanced_search'), products_advanced_search_path ) %></li>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
</nav>
|
13
|
+
")
|
@@ -0,0 +1,74 @@
|
|
1
|
+
<% content_for :sidebar do %>
|
2
|
+
<div data-hook="homepage_sidebar_navigation">
|
3
|
+
<% if "spree/products" == params[:controller] && @taxon %>
|
4
|
+
<%= render :partial => 'spree/shared/filters' %>
|
5
|
+
<% else %>
|
6
|
+
<%= render :partial => 'spree/shared/taxonomies' %>
|
7
|
+
<% end %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<h1 class="taxon-title"><%= t("add_on.advanced_search.advanced_search") %></h1>
|
12
|
+
|
13
|
+
<%= search_form_for @q, url: products_advanced_search_path, :html => { :class => "spree/product/advanced_search" } do |f| %>
|
14
|
+
<div class="alpha twelve columns">
|
15
|
+
|
16
|
+
<div class="field">
|
17
|
+
<%= f.label t('add_on.advanced_search.add_on_makers_eq') %><br>
|
18
|
+
<%= f.select :add_on_makers_id_eq, options_from_collection_for_select(Spree::AddOnMaker.all, :id, :name, @q.add_on_makers_id_eq), include_blank: true %>
|
19
|
+
</div>
|
20
|
+
<div class="field">
|
21
|
+
<%= f.label t('add_on.advanced_search.name_cont') %><br>
|
22
|
+
<%= f.text_field :name_cont, :size => 60 %>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div class="field">
|
26
|
+
<%= f.label t('add_on.advanced_search.variants_including_master_sku_cont') %><br>
|
27
|
+
<%= f.text_field :variants_including_master_sku_cont, :size => 60 %>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<div class="field">
|
31
|
+
<%= f.label t('add_on.advanced_search.taxons_id_eq') %><br>
|
32
|
+
<%= f.select :taxons_id_eq, options_from_collection_for_select(Spree::Taxon.all, :id, :name, @q.taxons_id_eq), include_blank: true %>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div class="alpha two columns">
|
36
|
+
<%= f.label t('add_on.advanced_search.variants_min_cost_price_gteq') %><br>
|
37
|
+
<%= f.text_field :variants_including_master_prices_amount_gteq, :size => 10 %>
|
38
|
+
</div>
|
39
|
+
<div class="omega two columns">
|
40
|
+
<%= f.label t('add_on.advanced_search.variants_max_cost_price_lteq') %><br>
|
41
|
+
<%= f.text_field :variants_including_master_prices_amount_lteq, :size => 10 %>
|
42
|
+
</div>
|
43
|
+
<div class="clear"></div>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<%= f.submit Spree.t(:search) %>
|
47
|
+
|
48
|
+
|
49
|
+
<% end %>
|
50
|
+
<% if @products.any? %>
|
51
|
+
<div class='add_on_advanced_search'>
|
52
|
+
<ul>
|
53
|
+
<li><%= t('add_on.advanced_search.filter_elements') %></li>
|
54
|
+
</ul>
|
55
|
+
<ul>
|
56
|
+
<li><%= sort_link @q, :variants_including_master_prices_amount, t('add_on.advanced_search.variants_including_master_prices_amount'), default_order: :asc %></li>
|
57
|
+
<li><%= sort_link @q, :variants_including_master_sku, t('add_on.advanced_search.variants_including_master_sku'), default_order: :asc %></li>
|
58
|
+
<li><%= sort_link @q, :variants_including_master_updated_at, t('add_on.advanced_search.variants_including_master_updated_at'), default_order: :desc %></li>
|
59
|
+
<li><%= sort_link @q, :name, t('add_on.advanced_search.name'), default_order: :name %></li>
|
60
|
+
</ul>
|
61
|
+
</div>
|
62
|
+
<div class='clear'></div>
|
63
|
+
|
64
|
+
<% end %>
|
65
|
+
|
66
|
+
<div data-hook="advanced_search_results">
|
67
|
+
<% if @products.empty? %>
|
68
|
+
<h6 class="search-results-title"><%= Spree.t(:no_products_found) %></h6>
|
69
|
+
<% else %>
|
70
|
+
<div data-hook="advanced_search_products">
|
71
|
+
<%= render :partial => 'spree/shared/products', :locals => { :products => @products, :taxon => @taxon } %>
|
72
|
+
</div>
|
73
|
+
<% end %>
|
74
|
+
</div>
|
data/bin/rails
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
2
|
+
|
3
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
4
|
+
ENGINE_PATH = File.expand_path('../../lib/spree_maker_advanced_search/engine', __FILE__)
|
5
|
+
|
6
|
+
require 'rails/all'
|
7
|
+
require 'rails/engine/commands'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
en:
|
2
|
+
add_on:
|
3
|
+
advanced_search:
|
4
|
+
advanced_search: Advanced Search
|
5
|
+
name_cont: Product Name
|
6
|
+
add_on_makers_eq: Maker
|
7
|
+
taxons_id_eq: Taxon
|
8
|
+
variants_including_master_sku_cont: SKU
|
9
|
+
variants_min_cost_price_gteq: Minimum price
|
10
|
+
variants_max_cost_price_lteq: Maximum price
|
11
|
+
filter_elements: Sorting
|
12
|
+
name: Product Name
|
13
|
+
variants_including_master_sku: SKU
|
14
|
+
variants_including_master_prices_amount: Price
|
15
|
+
variants_including_master_updated_at: Latest
|
16
|
+
popularity: Popularity
|
17
|
+
name_asc: Name
|
18
|
+
name_desc: Name
|
19
|
+
variants_including_master_sku_asc: SKU
|
20
|
+
variants_including_master_sku_desc: SKU
|
21
|
+
variants_including_master_prices_amount_asc: Price lowest first
|
22
|
+
variants_including_master_prices_amount_desc: Price highest first
|
23
|
+
variants_including_master_updated_at_asc: Latest first
|
24
|
+
variants_including_master_updated_at_desc: Oldest first
|
@@ -0,0 +1,24 @@
|
|
1
|
+
ja:
|
2
|
+
add_on:
|
3
|
+
advanced_search:
|
4
|
+
advanced_search: 詳細検索
|
5
|
+
name_cont: 商品名
|
6
|
+
add_on_makers_eq: メーカー
|
7
|
+
taxons_id_eq: カテゴリ
|
8
|
+
variants_including_master_sku_cont: 品番
|
9
|
+
variants_min_cost_price_gteq: 下限価格
|
10
|
+
variants_max_cost_price_lteq: 上限価格
|
11
|
+
filter_elements: 並び替え
|
12
|
+
name: 商品名
|
13
|
+
variants_including_master_sku: 品番
|
14
|
+
variants_including_master_prices_amount: 価格
|
15
|
+
variants_including_master_updated_at: 新着
|
16
|
+
popularity: 人気
|
17
|
+
name_asc: 商品名昇順
|
18
|
+
name_desc: 商品名降順
|
19
|
+
variants_including_master_sku_asc: 品番昇順
|
20
|
+
variants_including_master_sku_desc: 品番降順
|
21
|
+
variants_including_master_prices_amount_asc: 価格が安い順
|
22
|
+
variants_including_master_prices_amount_desc: 価格が高い順
|
23
|
+
variants_including_master_updated_at_asc: 新着昇順
|
24
|
+
variants_including_master_updated_at_desc: 新着降順
|
data/config/routes.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
module SpreeMakerAdvancedSearch
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
|
5
|
+
class_option :auto_run_migrations, :type => :boolean, :default => false
|
6
|
+
|
7
|
+
def add_javascripts
|
8
|
+
append_file 'app/assets/javascripts/store/all.js', "//= require store/spree_maker_advanced_search\n"
|
9
|
+
append_file 'app/assets/javascripts/admin/all.js', "//= require admin/spree_maker_advanced_search\n"
|
10
|
+
end
|
11
|
+
|
12
|
+
def add_stylesheets
|
13
|
+
inject_into_file 'app/assets/stylesheets/store/all.css', " *= require store/spree_maker_advanced_search\n", :before => /\*\//, :verbose => true
|
14
|
+
inject_into_file 'app/assets/stylesheets/admin/all.css', " *= require admin/spree_maker_advanced_search\n", :before => /\*\//, :verbose => true
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_migrations
|
18
|
+
run 'bundle exec rake railties:install:migrations FROM=spree_maker_advanced_search'
|
19
|
+
end
|
20
|
+
|
21
|
+
def run_migrations
|
22
|
+
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask 'Would you like to run the migrations now? [Y/n]')
|
23
|
+
if run_migrations
|
24
|
+
run 'bundle exec rake db:migrate'
|
25
|
+
else
|
26
|
+
puts 'Skipping rake db:migrate, don\'t forget to run it!'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module SpreeMakerAdvancedSearch
|
2
|
+
class Engine < Rails::Engine
|
3
|
+
require 'spree/core'
|
4
|
+
isolate_namespace Spree
|
5
|
+
engine_name 'spree_maker_advanced_search'
|
6
|
+
|
7
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
8
|
+
|
9
|
+
# use rspec for tests
|
10
|
+
config.generators do |g|
|
11
|
+
g.test_framework :rspec
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.activate
|
15
|
+
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
|
16
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
config.to_prepare &method(:activate).to_proc
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
# Define your Spree extensions Factories within this file to enable applications, and other extensions to use and override them.
|
3
|
+
#
|
4
|
+
# Example adding this to your spec_helper will load these Factories for use:
|
5
|
+
# require 'spree_maker_advanced_search/factories'
|
6
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Run Coverage report
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter 'spec/dummy'
|
5
|
+
add_group 'Controllers', 'app/controllers'
|
6
|
+
add_group 'Helpers', 'app/helpers'
|
7
|
+
add_group 'Mailers', 'app/mailers'
|
8
|
+
add_group 'Models', 'app/models'
|
9
|
+
add_group 'Views', 'app/views'
|
10
|
+
add_group 'Libraries', 'lib'
|
11
|
+
end
|
12
|
+
|
13
|
+
# Configure Rails Environment
|
14
|
+
ENV['RAILS_ENV'] = 'test'
|
15
|
+
|
16
|
+
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
17
|
+
|
18
|
+
require 'rspec/rails'
|
19
|
+
require 'database_cleaner'
|
20
|
+
require 'ffaker'
|
21
|
+
|
22
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
23
|
+
# in spec/support/ and its subdirectories.
|
24
|
+
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
|
25
|
+
|
26
|
+
# Requires factories defined in spree_core
|
27
|
+
require 'spree/testing_support/factories'
|
28
|
+
require 'spree/testing_support/controller_requests'
|
29
|
+
require 'spree/testing_support/authorization_helpers'
|
30
|
+
require 'spree/testing_support/url_helpers'
|
31
|
+
|
32
|
+
# Requires factories defined in lib/spree_maker_advanced_search/factories.rb
|
33
|
+
require 'spree_maker_advanced_search/factories'
|
34
|
+
|
35
|
+
RSpec.configure do |config|
|
36
|
+
config.include FactoryGirl::Syntax::Methods
|
37
|
+
|
38
|
+
# == URL Helpers
|
39
|
+
#
|
40
|
+
# Allows access to Spree's routes in specs:
|
41
|
+
#
|
42
|
+
# visit spree.admin_path
|
43
|
+
# current_path.should eql(spree.products_path)
|
44
|
+
config.include Spree::TestingSupport::UrlHelpers
|
45
|
+
|
46
|
+
# == Mock Framework
|
47
|
+
#
|
48
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
49
|
+
#
|
50
|
+
# config.mock_with :mocha
|
51
|
+
# config.mock_with :flexmock
|
52
|
+
# config.mock_with :rr
|
53
|
+
config.mock_with :rspec
|
54
|
+
config.color = true
|
55
|
+
|
56
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
57
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
58
|
+
|
59
|
+
# Capybara javascript drivers require transactional fixtures set to false, and we use DatabaseCleaner
|
60
|
+
# to cleanup after each test instead. Without transactional fixtures set to false the records created
|
61
|
+
# to setup a test will be unavailable to the browser, which runs under a seperate server instance.
|
62
|
+
config.use_transactional_fixtures = false
|
63
|
+
|
64
|
+
# Ensure Suite is set to use transactions for speed.
|
65
|
+
config.before :suite do
|
66
|
+
DatabaseCleaner.strategy = :transaction
|
67
|
+
DatabaseCleaner.clean_with :truncation
|
68
|
+
end
|
69
|
+
|
70
|
+
# Before each spec check if it is a Javascript test and switch between using database transactions or not where necessary.
|
71
|
+
config.before :each do
|
72
|
+
DatabaseCleaner.strategy = example.metadata[:js] ? :truncation : :transaction
|
73
|
+
DatabaseCleaner.start
|
74
|
+
end
|
75
|
+
|
76
|
+
# After each spec clean the database.
|
77
|
+
config.after :each do
|
78
|
+
DatabaseCleaner.clean
|
79
|
+
end
|
80
|
+
|
81
|
+
config.fail_fast = ENV['FAIL_FAST'] || false
|
82
|
+
end
|
metadata
ADDED
@@ -0,0 +1,283 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spree_maker_advanced_search
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- digitalm
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-05-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: spree_core
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.1.4
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.1.4
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: spree_add_on_menu
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0.1'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0.1'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: spree_maker_search
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.1'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.1'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: capybara
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.1'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2.1'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: coffee-rails
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: database_cleaner
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: factory_girl
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '4.2'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '4.2'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: ffaker
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: rspec-rails
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ~>
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '2.13'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ~>
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '2.13'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: sass-rails
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
- !ruby/object:Gem::Dependency
|
175
|
+
name: selenium-webdriver
|
176
|
+
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ! '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
type: :development
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: simplecov
|
192
|
+
requirement: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ! '>='
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0'
|
198
|
+
type: :development
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ! '>='
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
206
|
+
- !ruby/object:Gem::Dependency
|
207
|
+
name: sqlite3
|
208
|
+
requirement: !ruby/object:Gem::Requirement
|
209
|
+
none: false
|
210
|
+
requirements:
|
211
|
+
- - ! '>='
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
214
|
+
type: :development
|
215
|
+
prerelease: false
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
none: false
|
218
|
+
requirements:
|
219
|
+
- - ! '>='
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
description: Advanced search includes to select taxons and makers, and sorting.
|
223
|
+
email: digitalm.github@gmail.com
|
224
|
+
executables: []
|
225
|
+
extensions: []
|
226
|
+
extra_rdoc_files: []
|
227
|
+
files:
|
228
|
+
- .gitignore
|
229
|
+
- .rspec
|
230
|
+
- Gemfile
|
231
|
+
- LICENSE
|
232
|
+
- README.ja.md
|
233
|
+
- README.md
|
234
|
+
- Rakefile
|
235
|
+
- app/assets/javascripts/admin/spree_advanced_search.js
|
236
|
+
- app/assets/javascripts/admin/spree_maker_advanced_search.js
|
237
|
+
- app/assets/javascripts/store/spree_advanced_search.js
|
238
|
+
- app/assets/javascripts/store/spree_maker_advanced_search.js
|
239
|
+
- app/assets/stylesheets/admin/spree_advanced_search.css
|
240
|
+
- app/assets/stylesheets/admin/spree_maker_advanced_search.css
|
241
|
+
- app/assets/stylesheets/store/spree_advanced_search.css
|
242
|
+
- app/assets/stylesheets/store/spree_maker_advanced_search.css
|
243
|
+
- app/controllers/products_controller_decorator.rb
|
244
|
+
- app/overrides/add_advanced_search_link_to_nav_bar.rb
|
245
|
+
- app/overrides/add_advanced_search_link_to_navigation.rb
|
246
|
+
- app/views/spree/products/advanced_search.html.erb
|
247
|
+
- bin/rails
|
248
|
+
- config/locales/en.yml
|
249
|
+
- config/locales/ja.yml
|
250
|
+
- config/routes.rb
|
251
|
+
- lib/generators/spree_maker_advanced_search/install/install_generator.rb
|
252
|
+
- lib/spree_maker_advanced_search.rb
|
253
|
+
- lib/spree_maker_advanced_search/engine.rb
|
254
|
+
- lib/spree_maker_advanced_search/factories.rb
|
255
|
+
- spec/spec_helper.rb
|
256
|
+
homepage: https://github.com/digitalm/spree_maker_advanced_search
|
257
|
+
licenses: []
|
258
|
+
post_install_message:
|
259
|
+
rdoc_options: []
|
260
|
+
require_paths:
|
261
|
+
- lib
|
262
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
263
|
+
none: false
|
264
|
+
requirements:
|
265
|
+
- - ! '>='
|
266
|
+
- !ruby/object:Gem::Version
|
267
|
+
version: 1.9.3
|
268
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
269
|
+
none: false
|
270
|
+
requirements:
|
271
|
+
- - ! '>='
|
272
|
+
- !ruby/object:Gem::Version
|
273
|
+
version: '0'
|
274
|
+
requirements:
|
275
|
+
- none
|
276
|
+
rubyforge_project:
|
277
|
+
rubygems_version: 1.8.23
|
278
|
+
signing_key:
|
279
|
+
specification_version: 3
|
280
|
+
summary: ! 'Spree Extension : Enable to advanced product search including taxons and
|
281
|
+
makers.'
|
282
|
+
test_files:
|
283
|
+
- spec/spec_helper.rb
|