spree_retailers 0.70.0.0 → 1.0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -1
- data/LICENSE +1 -1
- data/README.md +66 -26
- data/Versionfile +1 -0
- data/app/controllers/spree/admin/retailers_controller.rb +19 -0
- data/app/controllers/spree/retailers_controller.rb +11 -0
- data/app/helpers/{retailers_helper.rb → spree/retailers_helper.rb} +4 -7
- data/app/models/{retailer.rb → spree/retailer.rb} +1 -1
- data/app/overrides/spree_retailers.rb +2 -2
- data/app/views/{admin → spree/admin}/hooks/_retailers_tab.html.erb +0 -0
- data/app/views/{admin → spree/admin}/retailers/_form.html.erb +0 -0
- data/app/views/{admin → spree/admin}/retailers/edit.html.erb +2 -0
- data/app/views/{admin → spree/admin}/retailers/index.html.erb +3 -5
- data/app/views/{admin → spree/admin}/retailers/new.html.erb +2 -1
- data/app/views/{admin → spree/admin}/retailers/show.html.erb +0 -0
- data/app/views/{retailers → spree/retailers}/_list.html.erb +0 -0
- data/app/views/{retailers → spree/retailers}/_retailer.html.erb +0 -0
- data/app/views/{retailers → spree/retailers}/index.html.erb +1 -1
- data/config/locales/en.yml +8 -12
- data/config/routes.rb +5 -5
- data/{lib/generators/templates/db/migrate/install_spree_retailers.rb → db/migrate/20111213000442_install_spree_retailers.rb} +0 -0
- data/db/migrate/20111213000450_add_spree_namespace_to_retailers.rb +5 -0
- data/lib/generators/spree_retailers/install_generator.rb +2 -20
- data/lib/spree_retailers.rb +4 -21
- data/lib/spree_retailers/engine.rb +21 -0
- data/lib/spree_retailers/version.rb +1 -1
- data/spree_retailers.gemspec +6 -6
- data/test/dummy_hooks/before_migrate.rb +19 -10
- data/test/dummy_hooks/templates/spree_user_error_fix.rb +3 -0
- data/test/dummy_hooks/templates/store/screen.css +749 -0
- data/test/fixtures/{retailers.yml → spree/retailers.yml} +3 -3
- data/test/fixtures/{states.yml → spree/states.yml} +0 -0
- data/test/integration/spree/admin/retailers_integration_test.rb +88 -0
- data/test/integration/spree/retailers_integration_test.rb +21 -0
- data/test/support/files/1.jpg +0 -0
- data/test/support/integration_case.rb +70 -0
- data/test/test_helper.rb +22 -5
- data/test/unit/{retailer_test.rb → spree/retailer_test.rb} +3 -10
- metadata +68 -53
- data/app/controllers/admin/retailers_controller.rb +0 -19
- data/app/controllers/retailers_controller.rb +0 -11
- data/lib/spree_core/action_callbacks.rb +0 -26
- data/test/functional/admin/retailers_controller_test.rb +0 -54
- data/test/functional/retailers_controller_test.rb +0 -12
@@ -1,19 +0,0 @@
|
|
1
|
-
class Admin::RetailersController < Admin::ResourceController
|
2
|
-
|
3
|
-
before_filter :get_locations, :except => [:index,:destroy]
|
4
|
-
|
5
|
-
private
|
6
|
-
|
7
|
-
def collection
|
8
|
-
params[:search] ||= {}
|
9
|
-
params[:search][:meta_sort] ||= "name.asc"
|
10
|
-
@search = super.search(params[:search])
|
11
|
-
@collection = @search.page(params[:page]).per(Spree::Config[:orders_per_page])
|
12
|
-
end
|
13
|
-
|
14
|
-
def get_locations
|
15
|
-
@countries = Country.all.collect{|country| country.name }.sort
|
16
|
-
@states = State.where(:country_id => 214).collect{|state| [state.name, state.abbr] }.sort
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
class RetailersController < Spree::BaseController
|
2
|
-
|
3
|
-
def index
|
4
|
-
@retailers = Retailer.order(:country, :state, :name)
|
5
|
-
@states = {}
|
6
|
-
State.where(:abbr => @retailers.collect(&:state).uniq).all.each do |state|
|
7
|
-
@states[state.abbr] = state.name
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Spree
|
2
|
-
class ActionCallbacks
|
3
|
-
attr_reader :before_methods
|
4
|
-
attr_reader :after_methods
|
5
|
-
attr_reader :fails_methods
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
@before_methods = []
|
9
|
-
@after_methods = []
|
10
|
-
@fails_methods = []
|
11
|
-
end
|
12
|
-
|
13
|
-
def before(method)
|
14
|
-
@before_methods << method
|
15
|
-
end
|
16
|
-
|
17
|
-
def after(method)
|
18
|
-
@after_methods << method
|
19
|
-
end
|
20
|
-
|
21
|
-
def fails(method)
|
22
|
-
@fails_methods << method
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class Admin::RetailersControllerTest < ActionController::TestCase
|
4
|
-
|
5
|
-
fixtures :states, :retailers
|
6
|
-
|
7
|
-
should "get index" do
|
8
|
-
get :index
|
9
|
-
assert_not_nil assigns(:retailers)
|
10
|
-
assert_response :success
|
11
|
-
end
|
12
|
-
|
13
|
-
should "get new" do
|
14
|
-
get :new
|
15
|
-
assert_not_nil assigns(:retailer)
|
16
|
-
assert assigns(:retailer).new_record?
|
17
|
-
assert_response :success
|
18
|
-
end
|
19
|
-
|
20
|
-
should "post to create" do
|
21
|
-
post :create, :retailer => { "name" => "Rita Taylor", "address" => "1000 State St", "address2" => "Suite 100", "city" => "Santa Barbara", "state" => "CA", "zipcode" => "93101", "country" => "United States", "phone" => "805-555-5555", "email" => "ritataylor@example.com", "url" => "ritataylor.example.com" }
|
22
|
-
retailer = assigns(:retailer)
|
23
|
-
assert_not_nil retailer
|
24
|
-
assert retailer.errors.empty?
|
25
|
-
assert !retailer.new_record?
|
26
|
-
assert_redirected_to admin_retailers_path
|
27
|
-
end
|
28
|
-
|
29
|
-
context "With an existing retailer" do
|
30
|
-
|
31
|
-
setup do
|
32
|
-
@retailer = retailers(:one)
|
33
|
-
end
|
34
|
-
|
35
|
-
should "get edit" do
|
36
|
-
get :edit, :id => @retailer.to_param
|
37
|
-
assert_not_nil assigns(:retailer)
|
38
|
-
assert_response :success
|
39
|
-
end
|
40
|
-
|
41
|
-
should "put to update" do
|
42
|
-
put :update, :id => @retailer.to_param, :retailer => { "name" => "Buy From-us-alot", "address" => "2400 State St", "address2" => "", "city" => "Santa Barbara", "state" => "CA", "zipcode" => "93101", "country" => "United States", "phone" => "805-555-5555", "email" => "ritataylor@example.com", "url" => "ritataylor.example.com" }
|
43
|
-
assert_not_nil assigns(:retailer)
|
44
|
-
assert_redirected_to admin_retailers_path
|
45
|
-
end
|
46
|
-
|
47
|
-
should "delete to destroy" do
|
48
|
-
delete :destroy, :id => @retailer.to_param
|
49
|
-
assert_redirected_to admin_retailers_path
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|