spree_core 0.40.4 → 0.50.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -1
- data/app/controllers/admin/base_controller.rb +0 -57
- data/app/controllers/admin/configurations_controller.rb +1 -1
- data/app/controllers/admin/general_settings_controller.rb +1 -1
- data/app/controllers/admin/images_controller.rb +18 -8
- data/app/controllers/admin/inventory_settings_controller.rb +1 -1
- data/app/controllers/admin/mail_settings_controller.rb +1 -1
- data/app/controllers/admin/option_types_controller.rb +11 -0
- data/app/controllers/admin/orders_controller.rb +16 -20
- data/app/controllers/admin/overview_controller.rb +1 -1
- data/app/controllers/admin/payment_methods_controller.rb +6 -6
- data/app/controllers/admin/product_groups_controller.rb +10 -11
- data/app/controllers/admin/product_properties_controller.rb +5 -5
- data/app/controllers/admin/product_scopes_controller.rb +12 -4
- data/app/controllers/admin/products_controller.rb +17 -12
- data/app/controllers/admin/properties_controller.rb +7 -7
- data/app/controllers/admin/prototypes_controller.rb +15 -15
- data/app/controllers/admin/reports_controller.rb +12 -11
- data/app/controllers/admin/shipments_controller.rb +0 -5
- data/app/controllers/admin/shipping_categories_controller.rb +6 -6
- data/app/controllers/admin/shipping_methods_controller.rb +1 -2
- data/app/controllers/admin/states_controller.rb +12 -12
- data/app/controllers/admin/tax_categories_controller.rb +2 -2
- data/app/controllers/admin/tax_rates_controller.rb +8 -8
- data/app/controllers/admin/tax_settings_controller.rb +1 -1
- data/app/controllers/admin/taxonomies_controller.rb +3 -3
- data/app/controllers/admin/taxons_controller.rb +1 -8
- data/app/controllers/admin/trackers_controller.rb +1 -1
- data/app/controllers/admin/users_controller.rb +6 -9
- data/app/controllers/admin/variants_controller.rb +13 -2
- data/app/controllers/admin/zones_controller.rb +9 -9
- data/app/controllers/checkout_controller.rb +5 -5
- data/app/controllers/products_controller.rb +1 -1
- data/app/controllers/taxons_controller.rb +3 -1
- data/app/helpers/admin/navigation_helper.rb +36 -19
- data/app/helpers/admin/payments_helper.rb +1 -1
- data/app/helpers/admin/product_groups_helper.rb +1 -1
- data/app/helpers/admin/product_properties_helper.rb +5 -5
- data/app/helpers/admin/products_helper.rb +2 -2
- data/app/helpers/admin/users_helper.rb +5 -2
- data/app/helpers/hook_helper.rb +3 -3
- data/app/helpers/products_helper.rb +0 -19
- data/app/helpers/spree/base_helper.rb +33 -2
- data/app/helpers/taxons_helper.rb +3 -3
- data/app/mailers/order_mailer.rb +2 -2
- data/app/mailers/shipment_mailer.rb +2 -2
- data/app/models/address.rb +42 -9
- data/app/models/adjustment.rb +8 -8
- data/app/models/app_configuration.rb +0 -6
- data/app/models/billing_integration.rb +1 -1
- data/app/models/calculator/sales_tax.rb +3 -3
- data/app/models/configuration.rb +1 -1
- data/app/models/country.rb +4 -5
- data/app/models/creditcard.rb +38 -31
- data/app/models/gateway.rb +14 -14
- data/app/models/gateway/beanstream.rb +4 -4
- data/app/models/gateway/bogus.rb +6 -6
- data/app/models/gateway/braintree.rb +88 -0
- data/app/models/gateway/eway.rb +3 -3
- data/app/models/image.rb +5 -4
- data/app/models/option_type.rb +1 -0
- data/app/models/order.rb +60 -21
- data/app/models/payment.rb +5 -32
- data/app/models/preference.rb +7 -7
- data/app/models/product.rb +22 -7
- data/app/models/product_group.rb +22 -26
- data/app/models/product_property.rb +5 -5
- data/app/models/product_scope.rb +26 -6
- data/app/models/property.rb +1 -1
- data/app/models/state.rb +2 -3
- data/app/models/tax_category.rb +1 -0
- data/app/models/tax_rate.rb +1 -2
- data/app/models/taxon.rb +12 -10
- data/app/models/taxonomy.rb +7 -4
- data/app/models/tracker.rb +1 -1
- data/app/models/user.rb +4 -0
- data/app/models/variant.rb +1 -1
- data/app/models/zone.rb +1 -1
- data/app/models/zone_member.rb +3 -3
- data/app/views/admin/{shared → adjustments}/_adjustments_table.html.erb +7 -4
- data/app/views/admin/adjustments/edit.html.erb +1 -1
- data/app/views/admin/adjustments/index.html.erb +2 -2
- data/app/views/admin/adjustments/new.html.erb +2 -1
- data/app/views/admin/general_settings/edit.html.erb +4 -12
- data/app/views/admin/general_settings/show.html.erb +0 -5
- data/app/views/admin/images/index.html.erb +8 -5
- data/app/views/admin/inventory_settings/show.html.erb +1 -1
- data/app/views/admin/mail_methods/index.html.erb +4 -4
- data/app/views/admin/option_types/_form.html.erb +4 -4
- data/app/views/admin/option_types/_option_value_fields.html.erb +2 -2
- data/app/views/admin/option_types/edit.html.erb +4 -2
- data/app/views/admin/option_types/index.html.erb +5 -5
- data/app/views/admin/orders/_line_item.html.erb +2 -1
- data/app/views/admin/orders/history.html.erb +6 -2
- data/app/views/admin/orders/index.html.erb +22 -19
- data/app/views/admin/orders/show.html.erb +1 -1
- data/app/views/admin/orders/user.html.erb +1 -1
- data/app/views/admin/payment_methods/index.html.erb +7 -5
- data/app/views/admin/payments/_list.html.erb +3 -3
- data/app/views/admin/payments/index.html.erb +1 -1
- data/app/views/admin/payments/show.html.erb +2 -2
- data/app/views/admin/product_groups/edit.html.erb +7 -7
- data/app/views/admin/product_groups/index.html.erb +5 -3
- data/app/views/admin/product_groups/update.js.erb +4 -3
- data/app/views/admin/product_properties/_product_property_fields.html.erb +3 -3
- data/app/views/admin/product_properties/index.html.erb +10 -5
- data/app/views/admin/product_scopes/destroy.js.erb +1 -0
- data/app/views/admin/products/index.html.erb +32 -33
- data/app/views/admin/properties/_form.html.erb +2 -2
- data/app/views/admin/properties/index.html.erb +4 -4
- data/app/views/admin/prototypes/index.html.erb +4 -4
- data/app/views/admin/shared/_address_form.html.erb +1 -1
- data/app/views/admin/shared/_calculator_fields.html.erb +1 -1
- data/app/views/admin/shared/_destroy.js.erb +15 -2
- data/app/views/admin/shared/_order_tabs.html.erb +1 -1
- data/app/views/admin/shared/_report_criteria.html.erb +1 -1
- data/app/views/admin/shipments/_form.html.erb +6 -2
- data/app/views/admin/shipments/edit.html.erb +1 -1
- data/app/views/admin/shipments/index.html.erb +4 -2
- data/app/views/admin/shipping_methods/_form.html.erb +2 -0
- data/app/views/admin/shipping_methods/index.html.erb +3 -2
- data/app/views/admin/states/_state_list.html.erb +11 -5
- data/app/views/admin/tax_categories/index.html.erb +9 -4
- data/app/views/admin/tax_settings/show.html.erb +2 -2
- data/app/views/admin/taxonomies/_list.html.erb +4 -2
- data/app/views/admin/taxonomies/index.html.erb +2 -2
- data/app/views/admin/taxons/_form.html.erb +1 -1
- data/app/views/admin/trackers/index.html.erb +5 -5
- data/app/views/admin/users/_form.html.erb +3 -4
- data/app/views/admin/users/index.html.erb +7 -6
- data/app/views/admin/users/show.html.erb +3 -3
- data/app/views/admin/variants/index.html.erb +21 -6
- data/app/views/admin/zones/_form.html.erb +9 -9
- data/app/views/admin/zones/_member_type.html.erb +5 -5
- data/app/views/admin/zones/index.html.erb +7 -5
- data/app/views/checkout/_address.html.erb +2 -2
- data/app/views/checkout/_payment.html.erb +3 -6
- data/app/views/layouts/admin.html.erb +3 -9
- data/app/views/layouts/spree_application.html.erb +2 -1
- data/app/views/orders/_line_item.html.erb +1 -1
- data/app/views/orders/edit.html.erb +17 -16
- data/app/views/orders/show.html.erb +1 -1
- data/app/views/shared/_admin_head.html.erb +1 -1
- data/app/views/shared/_error_messages.html.erb +2 -2
- data/app/views/shared/_filters.html.erb +4 -4
- data/app/views/shared/_head.html.erb +2 -2
- data/app/views/shared/_nav_bar.html.erb +2 -2
- data/app/views/shared/_products.html.erb +4 -2
- data/app/views/shared/_taxonomies.html.erb +15 -8
- data/app/views/shipment_mailer/shipped_email.text.erb +2 -2
- data/config/cucumber.yml +10 -0
- data/config/initializers/form_builder.rb +1 -5
- data/config/initializers/workarounds_for_ruby19.rb +5 -5
- data/config/locales/en.yml +33 -6
- data/config/routes.rb +18 -13
- data/db/migrate/20090923100315_add_count_on_hand_to_variants_and_products.rb +5 -5
- data/db/migrate/20091213222815_creditcard_last_four_digits.rb +5 -5
- data/db/migrate/20100105132138_shipment_id_for_inventory_units.rb +2 -2
- data/db/migrate/20100209025806_create_payment_methods.rb +3 -3
- data/db/migrate/20100209144531_polymorphic_payments.rb +1 -1
- data/db/migrate/20100214212536_assign_creditcard_txns_to_payment.rb +2 -2
- data/db/migrate/20100224153127_deleted_at_for_payment_methods.rb +1 -1
- data/db/migrate/20100506185838_add_description_to_taxons.rb +1 -1
- data/db/migrate/20100816212146_shipping_method_id_for_orders.rb +1 -1
- data/db/migrate/20101026184808_migrate_checkout_to_orders.rb +2 -2
- data/db/migrate/20101223215658_add_position_to_variants.rb +9 -0
- data/db/migrate/20110110130847_add_next_state_to_state_events.rb +9 -0
- data/db/migrate/20110111122537_add_position_to_option_types.rb +9 -0
- data/db/migrate/20110314192118_remove_trailing_slashes_in_taxon_permalinks.rb +17 -0
- data/lib/custom_fixtures.rb +1 -1
- data/lib/{seo_assist.rb → middleware/seo_assist.rb} +14 -8
- data/lib/product_filters.rb +49 -43
- data/lib/redirect_legacy_product_url.rb +5 -5
- data/lib/scopes.rb +2 -2
- data/lib/scopes/dynamic.rb +9 -16
- data/lib/scopes/product.rb +33 -16
- data/lib/scopes/variant.rb +4 -3
- data/lib/spree/calculated_adjustments.rb +5 -2
- data/lib/spree/config.rb +2 -0
- data/lib/spree/current_order.rb +4 -4
- data/lib/spree/mail_settings.rb +3 -2
- data/lib/spree/search/base.rb +9 -10
- data/lib/spree_base.rb +22 -23
- data/lib/spree_core.rb +10 -69
- data/lib/spree_core/authorize_net_cim_hack.rb +1 -1
- data/lib/spree_core/delegate_belongs_to.rb +18 -24
- data/lib/spree_core/enumerable_constants.rb +38 -38
- data/lib/spree_core/find_by_param.rb +8 -6
- data/lib/spree_core/preferences/preference_definition.rb +7 -7
- data/lib/spree_core/railtie.rb +58 -0
- data/lib/spree_core/ssl_requirement.rb +4 -3
- data/lib/spree_core/testing_support/factories.rb +13 -0
- data/lib/spree_core/testing_support/factories/address_factory.rb +20 -0
- data/lib/spree_core/testing_support/factories/adjustment_factory.rb +6 -0
- data/lib/spree_core/testing_support/factories/calculator_factory.rb +5 -0
- data/lib/spree_core/testing_support/factories/configuraion_factory.rb +4 -0
- data/lib/spree_core/testing_support/factories/country_factory.rb +7 -0
- data/lib/spree_core/testing_support/factories/creditcard_factory.rb +11 -0
- data/lib/spree_core/testing_support/factories/inventory_unit_factory.rb +7 -0
- data/lib/spree_core/testing_support/factories/line_item_factory.rb +8 -0
- data/lib/spree_core/testing_support/factories/mail_method_factory.rb +4 -0
- data/lib/spree_core/testing_support/factories/options_factory.rb +10 -0
- data/lib/spree_core/testing_support/factories/order_factory.rb +18 -0
- data/lib/spree_core/testing_support/factories/payment_factory.rb +26 -0
- data/lib/spree_core/testing_support/factories/payment_method_factory.rb +17 -0
- data/lib/spree_core/testing_support/factories/product_factory.rb +16 -0
- data/lib/spree_core/testing_support/factories/product_group_factory.rb +3 -0
- data/lib/spree_core/testing_support/factories/product_option_type_factory.rb +4 -0
- data/lib/spree_core/testing_support/factories/product_property_factory.rb +4 -0
- data/lib/spree_core/testing_support/factories/product_scope_factory.rb +6 -0
- data/lib/spree_core/testing_support/factories/property_factory.rb +4 -0
- data/lib/spree_core/testing_support/factories/prototype_factory.rb +4 -0
- data/lib/spree_core/testing_support/factories/return_authorization_factory.rb +8 -0
- data/lib/spree_core/testing_support/factories/role_factory.rb +9 -0
- data/lib/spree_core/testing_support/factories/shipment_factory.rb +9 -0
- data/lib/spree_core/testing_support/factories/shipping_category_factory.rb +5 -0
- data/lib/spree_core/testing_support/factories/shipping_method_factory.rb +7 -0
- data/lib/spree_core/testing_support/factories/state_factory.rb +11 -0
- data/lib/spree_core/testing_support/factories/tax_category_factory.rb +8 -0
- data/lib/spree_core/testing_support/factories/tax_rate_factory.rb +5 -0
- data/lib/spree_core/testing_support/factories/taxon_factory.rb +5 -0
- data/lib/spree_core/testing_support/factories/taxonomy_factory.rb +3 -0
- data/lib/spree_core/testing_support/factories/tracker_factory.rb +5 -0
- data/lib/spree_core/testing_support/factories/user_factory.rb +15 -0
- data/lib/spree_core/testing_support/factories/variant_factory.rb +14 -0
- data/lib/spree_core/testing_support/factories/zone_factory.rb +18 -0
- data/lib/spree_core/theme_support/hook.rb +1 -1
- data/lib/spree_core/theme_support/more_patches.rb +20 -20
- data/lib/spree_core/version.rb +5 -0
- data/lib/tasks/common.rb +30 -0
- data/lib/tasks/install.rake +1 -1
- data/lib/tasks/rake_util.rb +19 -0
- data/lib/tasks/taxon.rake +14 -0
- data/public/images/reorder.jpg +0 -0
- data/public/javascripts/admin.js +0 -6
- data/public/javascripts/admin/unobtrusive_handlers.js +28 -0
- data/public/javascripts/checkout.js +3 -3
- data/public/stylesheets/admin/admin-forms.css +1 -6
- data/public/stylesheets/admin/admin.css +0 -28
- data/public/stylesheets/screen.css +0 -280
- metadata +81 -43
- data/app/controllers/countries_controller.rb +0 -11
- data/app/models/spree/alert.rb +0 -13
- data/app/models/state_monitor.rb +0 -25
- data/app/views/admin/shared/_alert.html.erb +0 -6
- data/app/views/countries/index.js.erb +0 -1
- data/app/views/shared/_doc_and_xmlns.html.erb +0 -2
- data/app/views/users/edit.html.erb +0 -9
- data/app/views/users/show.html.erb +0 -46
- data/lib/spree_core/validation_group.rb +0 -143
- data/public/stylesheets/scaffold.css +0 -54
@@ -1,52 +1,52 @@
|
|
1
1
|
class Admin::PrototypesController < Admin::BaseController
|
2
2
|
resource_controller
|
3
3
|
after_filter :set_habtm_associations, :only => [:create, :update]
|
4
|
-
|
4
|
+
|
5
5
|
helper 'admin/product_properties'
|
6
|
-
|
6
|
+
|
7
7
|
def available
|
8
|
-
@prototypes = Prototype.
|
8
|
+
@prototypes = Prototype.order('name asc')
|
9
9
|
respond_to do |wants|
|
10
10
|
wants.html { render :layout => !request.xhr? }
|
11
11
|
end
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def select
|
15
15
|
load_object
|
16
16
|
@prototype_properties = @prototype.properties
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
new_action.response do |wants|
|
20
20
|
wants.html {
|
21
21
|
render :action => :new, :layout => !request.xhr?
|
22
22
|
}
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
# redirect to index (instead of r_c default of show view)
|
26
|
-
update.response do |wants|
|
26
|
+
update.response do |wants|
|
27
27
|
wants.html {redirect_to collection_url}
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
# redirect to index (instead of r_c default of show view)
|
31
|
-
create.response do |wants|
|
31
|
+
create.response do |wants|
|
32
32
|
wants.html {redirect_to collection_url}
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
destroy.success.wants.js { render_js_for_destroy }
|
36
|
-
|
36
|
+
|
37
37
|
private
|
38
38
|
def set_habtm_associations
|
39
39
|
object.property_ids = params[:property][:id] if params[:property]
|
40
40
|
object.option_type_ids = params[:option_type][:id] if params[:option_type]
|
41
|
-
end
|
41
|
+
end
|
42
42
|
|
43
43
|
def specified_rights(type)
|
44
44
|
rights = []
|
45
|
-
key = "#{type}_ids".to_sym
|
45
|
+
key = "#{type}_ids".to_sym
|
46
46
|
params[:permission][key] ||= []
|
47
47
|
params[:permission][key].each do |id|
|
48
|
-
rights << type.classify.constantize.find(id)
|
48
|
+
rights << type.classify.constantize.find(id)
|
49
49
|
end
|
50
50
|
rights
|
51
|
-
end
|
51
|
+
end
|
52
52
|
end
|
@@ -19,22 +19,23 @@ class Admin::ReportsController < Admin::BaseController
|
|
19
19
|
end
|
20
20
|
|
21
21
|
if params[:search] && !params[:search][:created_at_less_than].blank?
|
22
|
-
params[:search][:created_at_less_than] =
|
22
|
+
params[:search][:created_at_less_than] =
|
23
|
+
Time.zone.parse(params[:search][:created_at_less_than]).end_of_day rescue ""
|
23
24
|
end
|
24
25
|
|
25
|
-
params[:search]
|
26
|
-
|
27
|
-
|
26
|
+
if params[:search].delete(:completed_at_is_not_null) == "1"
|
27
|
+
params[:search][:completed_at_is_not_null] = true
|
28
|
+
else
|
29
|
+
params[:search][:completed_at_is_not_null] = false
|
28
30
|
end
|
29
31
|
|
30
|
-
params[:search][:
|
31
|
-
|
32
|
-
@search = Order.searchlogic(params[:search])
|
33
|
-
@orders = @search.do_search
|
32
|
+
params[:search][:meta_sort] ||= "created_at.desc"
|
34
33
|
|
35
|
-
@
|
36
|
-
@
|
37
|
-
@
|
34
|
+
@search = Order.metasearch(params[:search])
|
35
|
+
@orders = @search
|
36
|
+
@item_total = @search.sum(:item_total)
|
37
|
+
@adjustment_total = @search.sum(:adjustment_total)
|
38
|
+
@sales_total = @search.sum(:total)
|
38
39
|
end
|
39
40
|
|
40
41
|
private
|
@@ -46,12 +46,7 @@ class Admin::ShipmentsController < Admin::BaseController
|
|
46
46
|
|
47
47
|
def load_data
|
48
48
|
load_object
|
49
|
-
@selected_country_id ||= @order.bill_address.country_id unless @order.nil? || @order.bill_address.nil?
|
50
|
-
@selected_country_id ||= Spree::Config[:default_country_id]
|
51
49
|
@shipping_methods = ShippingMethod.all_available(@order, :back_end)
|
52
|
-
|
53
|
-
@states = State.find_all_by_country_id(@selected_country_id, :order => 'name')
|
54
|
-
@countries = Country.all
|
55
50
|
end
|
56
51
|
|
57
52
|
def edit_before # copy into instance variable before editing
|
@@ -1,16 +1,16 @@
|
|
1
|
-
class Admin::ShippingCategoriesController < Admin::BaseController
|
1
|
+
class Admin::ShippingCategoriesController < Admin::BaseController
|
2
2
|
resource_controller
|
3
|
-
|
3
|
+
|
4
4
|
layout 'admin'
|
5
|
-
|
5
|
+
|
6
6
|
update.response do |wants|
|
7
7
|
wants.html { redirect_to collection_url }
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
create.response do |wants|
|
11
11
|
wants.html { redirect_to collection_url }
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
destroy.success.wants.js { render_js_for_destroy }
|
15
|
-
|
15
|
+
|
16
16
|
end
|
@@ -15,7 +15,6 @@ class Admin::ShippingMethodsController < Admin::BaseController
|
|
15
15
|
|
16
16
|
def load_data
|
17
17
|
@available_zones = Zone.order(:name)
|
18
|
-
@calculators = ShippingMethod.calculators
|
19
|
-
@calculators.sort_by(&:name)
|
18
|
+
@calculators = ShippingMethod.calculators.sort_by(&:description)
|
20
19
|
end
|
21
20
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
class Admin::StatesController < Admin::BaseController
|
2
2
|
resource_controller
|
3
|
-
|
3
|
+
|
4
4
|
belongs_to :country
|
5
5
|
before_filter :load_data
|
6
|
-
|
6
|
+
|
7
7
|
index.response do |wants|
|
8
8
|
wants.html
|
9
9
|
wants.js do
|
@@ -14,17 +14,17 @@ class Admin::StatesController < Admin::BaseController
|
|
14
14
|
new_action.response do |wants|
|
15
15
|
wants.html {render :layout => !request.xhr?}
|
16
16
|
end
|
17
|
-
|
18
|
-
create.wants.html { redirect_to admin_country_states_url(@country) }
|
19
|
-
update.wants.html { redirect_to admin_country_states_url(@country) }
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
18
|
+
create.wants.html { redirect_to admin_country_states_url(@country) }
|
19
|
+
update.wants.html { redirect_to admin_country_states_url(@country) }
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def collection
|
24
|
+
@collection ||= end_of_association_chain.order('name')
|
25
|
+
end
|
26
|
+
|
27
27
|
def load_data
|
28
|
-
@countries = Country.
|
28
|
+
@countries = Country.order('name')
|
29
29
|
end
|
30
30
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Admin::TaxCategoriesController < Admin::BaseController
|
2
2
|
resource_controller
|
3
|
-
|
3
|
+
|
4
4
|
create.response do |wants|
|
5
5
|
wants.html { redirect_to collection_url }
|
6
6
|
end
|
@@ -8,6 +8,6 @@ class Admin::TaxCategoriesController < Admin::BaseController
|
|
8
8
|
update.response do |wants|
|
9
9
|
wants.html { redirect_to collection_url }
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
destroy.success.wants.js { render_js_for_destroy }
|
13
13
|
end
|
@@ -1,31 +1,31 @@
|
|
1
1
|
class Admin::TaxRatesController < Admin::BaseController
|
2
2
|
resource_controller
|
3
3
|
before_filter :load_data
|
4
|
-
|
4
|
+
|
5
5
|
create.success.wants.html { redirect_to collection_url }
|
6
|
-
update.success.wants.html { redirect_to collection_url }
|
6
|
+
update.success.wants.html { redirect_to collection_url }
|
7
7
|
destroy.success.wants.js { render_js_for_destroy }
|
8
|
-
|
8
|
+
|
9
9
|
update.after :update_after
|
10
10
|
create.after :create_after
|
11
|
-
|
12
|
-
private
|
11
|
+
|
12
|
+
private
|
13
13
|
def build_object
|
14
14
|
@object ||= end_of_association_chain.send((parent? ? :build : :new), object_params)
|
15
15
|
@object.calculator = params[:tax_rate][:calculator_type].constantize.new if params[:tax_rate]
|
16
16
|
@object.calculator ||= Calculator::SalesTax.new
|
17
17
|
@object
|
18
|
-
end
|
18
|
+
end
|
19
19
|
def load_data
|
20
20
|
@available_zones = Zone.order(:name)
|
21
21
|
@available_categories = TaxCategory.order(:name)
|
22
22
|
@calculators = TaxRate.calculators
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
def update_after
|
26
26
|
Rails.cache.delete('vat_rates')
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def create_after
|
30
30
|
Rails.cache.delete('vat_rates')
|
31
31
|
end
|
@@ -1,16 +1,16 @@
|
|
1
1
|
class Admin::TaxonomiesController < Admin::BaseController
|
2
2
|
resource_controller
|
3
|
-
|
3
|
+
|
4
4
|
create.wants.html {redirect_to edit_admin_taxonomy_url(@taxonomy)}
|
5
5
|
update.wants.html {redirect_to collection_url}
|
6
|
-
|
6
|
+
|
7
7
|
edit.response do |wants|
|
8
8
|
wants.html
|
9
9
|
wants.js do
|
10
10
|
render :partial => 'edit.html.erb'
|
11
11
|
end
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def get_children
|
15
15
|
@taxons = Taxon.find(params[:parent_id]).children
|
16
16
|
end
|
@@ -24,7 +24,7 @@ class Admin::TaxonsController < Admin::BaseController
|
|
24
24
|
if params[:q].blank?
|
25
25
|
@available_taxons = []
|
26
26
|
else
|
27
|
-
@available_taxons = Taxon.where('lower(name) LIKE ?', "%#{params[:q].downcase}%")
|
27
|
+
@available_taxons = Taxon.where('lower(name) LIKE ?', "%#{params[:q].mb_chars.downcase}%")
|
28
28
|
end
|
29
29
|
@available_taxons.delete_if { |taxon| @product.taxons.include?(taxon) }
|
30
30
|
respond_to do |format|
|
@@ -113,13 +113,6 @@ class Admin::TaxonsController < Admin::BaseController
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
-
def reposition_taxons(taxons)
|
117
|
-
taxons.each_with_index do |taxon, i|
|
118
|
-
taxon.position = i
|
119
|
-
taxon.save!
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
116
|
def load_permalink_part
|
124
117
|
@permalink_part = object.permalink.split("/").last
|
125
118
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
class Admin::UsersController < Admin::BaseController
|
2
2
|
resource_controller
|
3
|
+
|
4
|
+
# http://spreecommerce.com/blog/2010/11/02/json-hijacking-vulnerability/
|
3
5
|
before_filter :check_json_authenticity, :only => :index
|
4
6
|
before_filter :load_roles, :only => [:edit, :new, :update, :create]
|
5
7
|
|
@@ -31,17 +33,12 @@ class Admin::UsersController < Admin::BaseController
|
|
31
33
|
def collection
|
32
34
|
return @collection if @collection.present?
|
33
35
|
unless request.xhr?
|
34
|
-
@search = User.
|
35
|
-
|
36
|
-
#set order by to default or form result
|
37
|
-
@search.order ||= "ascend_by_email"
|
38
|
-
|
39
|
-
@collection = @search.do_search.paginate(:per_page => Spree::Config[:admin_products_per_page], :page => params[:page])
|
36
|
+
@search = User.registered.metasearch(params[:search])
|
37
|
+
@collection = @search.paginate(:per_page => Spree::Config[:admin_products_per_page], :page => params[:page])
|
40
38
|
|
41
39
|
#scope = scope.conditions "lower(email) = ?", @filter.email.downcase unless @filter.email.blank?
|
42
40
|
else
|
43
|
-
@collection = User.includes(:bill_address => [:state, :country],
|
44
|
-
:ship_address => [:state, :country]).where("users.email like :search
|
41
|
+
@collection = User.includes(:bill_address => [:state, :country], :ship_address => [:state, :country]).where("users.email like :search
|
45
42
|
OR addresses.firstname like :search
|
46
43
|
OR addresses.lastname like :search
|
47
44
|
OR ship_addresses_users.firstname like :search
|
@@ -56,9 +53,9 @@ class Admin::UsersController < Admin::BaseController
|
|
56
53
|
|
57
54
|
def save_user_roles
|
58
55
|
return unless params[:user]
|
56
|
+
return unless @user.respond_to?(:roles) # since roles are technically added by the auth module
|
59
57
|
@user.roles.delete_all
|
60
58
|
params[:user][:role] ||= {}
|
61
|
-
params[:user][:role][:user] = 1 # all new accounts have user role
|
62
59
|
Role.all.each { |role|
|
63
60
|
@user.roles << role unless params[:user][:role][role.name].blank?
|
64
61
|
}
|
@@ -35,6 +35,17 @@ class Admin::VariantsController < Admin::BaseController
|
|
35
35
|
format.js { render_js_for_destroy }
|
36
36
|
end
|
37
37
|
end
|
38
|
+
|
39
|
+
def update_positions
|
40
|
+
params[:positions].each do |id, index|
|
41
|
+
Variant.update_all(['position=?', index], ['id=?', id])
|
42
|
+
end
|
43
|
+
|
44
|
+
respond_to do |format|
|
45
|
+
format.html { redirect_to admin_product_variants_url(params[:product_id]) }
|
46
|
+
format.js { render :text => 'Ok' }
|
47
|
+
end
|
48
|
+
end
|
38
49
|
|
39
50
|
private
|
40
51
|
def create_before
|
@@ -47,9 +58,9 @@ class Admin::VariantsController < Admin::BaseController
|
|
47
58
|
@deleted = (params.key?(:deleted) && params[:deleted] == "on") ? "checked" : ""
|
48
59
|
|
49
60
|
if @deleted.blank?
|
50
|
-
@collection ||= end_of_association_chain
|
61
|
+
@collection ||= end_of_association_chain
|
51
62
|
else
|
52
|
-
@collection ||=
|
63
|
+
@collection ||= Variant.where(:product_id => @product.id).deleted
|
53
64
|
end
|
54
65
|
end
|
55
66
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Admin::ZonesController < Admin::BaseController
|
2
|
-
resource_controller
|
3
|
-
|
2
|
+
resource_controller
|
3
|
+
|
4
4
|
before_filter :load_data
|
5
5
|
|
6
6
|
create.response do |wants|
|
@@ -10,22 +10,22 @@ class Admin::ZonesController < Admin::BaseController
|
|
10
10
|
update.response do |wants|
|
11
11
|
wants.html { redirect_to collection_url }
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
destroy.success.wants.js { render_js_for_destroy }
|
15
|
-
|
15
|
+
|
16
16
|
private
|
17
17
|
def build_object
|
18
18
|
@object ||= end_of_association_chain.send parent? ? :build : :new, object_params
|
19
|
-
@object.zone_members.build() if @object.zone_members.empty?
|
19
|
+
@object.zone_members.build() if @object.zone_members.empty?
|
20
20
|
@object
|
21
21
|
end
|
22
22
|
|
23
23
|
def collection
|
24
24
|
params[:search] ||= {}
|
25
|
-
params[:search][:
|
26
|
-
@search = end_of_association_chain.
|
27
|
-
@collection = @search.
|
28
|
-
end
|
25
|
+
params[:search][:meta_sort] ||= "ascend_by_name"
|
26
|
+
@search = end_of_association_chain.metasearch(params[:search])
|
27
|
+
@collection = @search.paginate(:per_page => Spree::Config[:orders_per_page], :page => params[:page])
|
28
|
+
end
|
29
29
|
|
30
30
|
def load_data
|
31
31
|
@countries = Country.all.sort
|
@@ -17,7 +17,7 @@ class CheckoutController < Spree::BaseController
|
|
17
17
|
redirect_to checkout_state_path(@order.state) and return
|
18
18
|
end
|
19
19
|
|
20
|
-
if @order.state == "complete"
|
20
|
+
if @order.state == "complete" || @order.completed?
|
21
21
|
flash[:notice] = I18n.t(:order_processed_successfully)
|
22
22
|
flash[:commerce_tracking] = "nothing special"
|
23
23
|
redirect_to completion_route
|
@@ -64,8 +64,8 @@ class CheckoutController < Spree::BaseController
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def before_address
|
67
|
-
@order.bill_address ||= Address.new(:
|
68
|
-
@order.ship_address ||= Address.new(:
|
67
|
+
@order.bill_address ||= Address.new(:country_id => default_country_id)
|
68
|
+
@order.ship_address ||= Address.new(:country_id => default_country_id)
|
69
69
|
end
|
70
70
|
|
71
71
|
def before_delivery
|
@@ -81,8 +81,8 @@ class CheckoutController < Spree::BaseController
|
|
81
81
|
session[:order_id] = nil
|
82
82
|
end
|
83
83
|
|
84
|
-
def
|
85
|
-
|
84
|
+
def default_country_id
|
85
|
+
Spree::Config[:default_country_id]
|
86
86
|
end
|
87
87
|
|
88
88
|
def rescue_from_spree_gateway_error
|