spree_core 1.1.6 → 1.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/images/{creditcards → credit_cards}/amex_cid.gif +0 -0
- data/app/assets/images/{creditcards/creditcard.gif → credit_cards/credit_card.gif} +0 -0
- data/app/assets/images/{creditcards → credit_cards}/discover_cid.gif +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/american_express.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/cirrus.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/delta.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/dinersclub.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/directdebit.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/discover.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/egold.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/maestro.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/master.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/paypal.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/solo.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/switch.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/visa.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/visaelectron.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/westernunion.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/wirecard.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/icons/worldpay.png +0 -0
- data/app/assets/images/{creditcards → credit_cards}/master_cid.jpg +0 -0
- data/app/assets/images/{creditcards → credit_cards}/visa_cid.gif +0 -0
- data/app/assets/javascripts/admin/admin.js.erb +12 -136
- data/app/assets/javascripts/admin/checkouts/edit.js +18 -35
- data/app/assets/javascripts/admin/gateway.js +2 -2
- data/app/assets/javascripts/admin/images/index.js.coffee +12 -0
- data/app/assets/javascripts/admin/images/new.js.coffee +4 -0
- data/app/assets/javascripts/admin/orders/edit.js +1 -1
- data/app/assets/javascripts/admin/orders/edit_form.js +0 -2
- data/app/assets/javascripts/admin/product_autocomplete.js.erb +116 -0
- data/app/assets/javascripts/store/cart.js.coffee +7 -0
- data/app/assets/javascripts/store/checkout.js.coffee +57 -0
- data/app/assets/javascripts/store/product.js.coffee +36 -0
- data/app/assets/stylesheets/admin/admin.css.erb +5 -0
- data/app/assets/stylesheets/admin/spree_core.css +1 -0
- data/app/assets/stylesheets/store/screen.css.scss +15 -1
- data/app/assets/stylesheets/store/variables.css.scss +29 -29
- data/app/controllers/spree/admin/banners_controller.rb +14 -0
- data/app/controllers/spree/admin/base_controller.rb +11 -0
- data/app/controllers/spree/admin/images_controller.rb +13 -5
- data/app/controllers/spree/admin/line_items_controller.rb +16 -25
- data/app/controllers/spree/admin/mail_methods_controller.rb +1 -8
- data/app/controllers/spree/admin/option_types_controller.rb +0 -25
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +3 -3
- data/app/controllers/spree/admin/orders_controller.rb +23 -14
- data/app/controllers/spree/admin/payment_methods_controller.rb +1 -7
- data/app/controllers/spree/admin/payments_controller.rb +5 -5
- data/app/controllers/spree/admin/products_controller.rb +15 -5
- data/app/controllers/spree/admin/prototypes_controller.rb +2 -2
- data/app/controllers/spree/admin/reports_controller.rb +1 -7
- data/app/controllers/spree/admin/resource_controller.rb +130 -130
- data/app/controllers/spree/admin/search_controller.rb +47 -0
- data/app/controllers/spree/admin/taxons_controller.rb +0 -43
- data/app/controllers/spree/base_controller.rb +2 -1
- data/app/controllers/spree/checkout_controller.rb +29 -10
- data/app/controllers/spree/orders_controller.rb +7 -11
- data/app/controllers/spree/products_controller.rb +5 -1
- data/app/helpers/spree/account_helper.rb +4 -0
- data/app/helpers/spree/admin/base_helper.rb +2 -44
- data/app/helpers/spree/admin/navigation_helper.rb +1 -3
- data/app/helpers/spree/admin/orders_helper.rb +3 -2
- data/app/helpers/spree/admin/products_helper.rb +21 -0
- data/app/helpers/spree/base_helper.rb +14 -11
- data/app/helpers/spree/checkout_helper.rb +5 -1
- data/app/helpers/spree/orders_helper.rb +5 -0
- data/app/helpers/spree/products_helper.rb +4 -0
- data/app/helpers/spree/trackers_helper.rb +4 -0
- data/app/models/spree/ability.rb +70 -0
- data/app/models/spree/address.rb +4 -12
- data/app/models/spree/adjustment.rb +30 -8
- data/app/models/spree/app_configuration.rb +1 -1
- data/app/models/spree/calculator/price_sack.rb +3 -5
- data/app/models/spree/country.rb +1 -4
- data/app/models/spree/{creditcard.rb → credit_card.rb} +4 -4
- data/app/models/spree/gateway.rb +2 -2
- data/app/models/spree/gateway/bogus.rb +10 -10
- data/app/models/spree/gateway/bogus_simple.rb +4 -4
- data/app/models/spree/image.rb +3 -12
- data/app/models/spree/inventory_unit.rb +4 -6
- data/app/models/spree/{user.rb → legacy_user.rb} +7 -6
- data/app/models/spree/line_item.rb +4 -5
- data/app/models/spree/option_type.rb +4 -6
- data/app/models/spree/option_value.rb +1 -1
- data/app/models/spree/order.rb +90 -132
- data/app/models/spree/order/checkout.rb +124 -0
- data/app/models/spree/payment.rb +6 -6
- data/app/models/spree/payment/processing.rb +34 -38
- data/app/models/spree/payment_method.rb +2 -2
- data/app/models/spree/preference.rb +2 -0
- data/app/models/spree/preferences/preferable_class_methods.rb +0 -2
- data/app/models/spree/preferences/store.rb +3 -21
- data/app/models/spree/product.rb +41 -43
- data/app/models/spree/product/scopes.rb +9 -25
- data/app/models/spree/product_option_type.rb +2 -2
- data/app/models/spree/product_property.rb +9 -4
- data/app/models/spree/property.rb +1 -1
- data/app/models/spree/prototype.rb +2 -2
- data/app/models/spree/return_authorization.rb +2 -2
- data/app/models/spree/role.rb +1 -1
- data/app/models/spree/shipment.rb +6 -5
- data/app/models/spree/shipping_method.rb +19 -13
- data/app/models/spree/state.rb +2 -5
- data/app/models/spree/state_change.rb +1 -1
- data/app/models/spree/tax_rate.rb +8 -1
- data/app/models/spree/taxon.rb +5 -1
- data/app/models/spree/taxonomy.rb +1 -1
- data/app/models/spree/tokenized_permission.rb +6 -0
- data/app/models/spree/tracker.rb +1 -1
- data/app/models/spree/variant.rb +13 -40
- data/app/models/spree/zone.rb +15 -14
- data/app/models/spree/zone_member.rb +1 -1
- data/app/views/spree/admin/image_settings/edit.html.erb +2 -2
- data/app/views/spree/admin/images/_form.html.erb +8 -4
- data/app/views/spree/admin/images/index.html.erb +1 -1
- data/app/views/spree/admin/line_items/create.js.erb +1 -1
- data/app/views/spree/admin/option_types/_option_value_fields.html.erb +1 -1
- data/app/views/spree/admin/option_types/index.html.erb +1 -1
- data/app/views/spree/admin/orders/_add_product.html.erb +1 -1
- data/app/views/spree/admin/orders/customer_details/edit.html.erb +1 -1
- data/app/views/spree/admin/orders/index.html.erb +4 -4
- data/app/views/spree/admin/orders/show.html.erb +1 -1
- data/app/views/spree/admin/payments/_form.html.erb +1 -1
- data/app/views/spree/admin/payments/new.html.erb +0 -4
- data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +1 -1
- data/app/views/spree/admin/payments/source_views/_gateway.html.erb +2 -2
- data/app/views/spree/admin/products/_form.html.erb +21 -5
- data/app/views/spree/admin/products/index.html.erb +2 -2
- data/app/views/spree/admin/properties/_form.html.erb +1 -1
- data/app/views/spree/admin/properties/index.html.erb +1 -1
- data/app/views/spree/admin/return_authorizations/_form.html.erb +33 -17
- data/app/views/spree/admin/return_authorizations/edit.html.erb +2 -2
- data/app/views/spree/admin/shared/_address_form.html.erb +1 -1
- data/app/views/spree/admin/shared/_head.html.erb +12 -2
- data/app/views/spree/admin/shared/_order_tabs.html.erb +1 -4
- data/app/views/spree/admin/shared/_product_tabs.html.erb +0 -6
- data/app/views/spree/admin/shared/_show_resource_links.html.erb +3 -3
- data/app/views/spree/admin/shared/_tabs.html.erb +1 -2
- data/app/views/spree/admin/shipments/edit.html.erb +2 -2
- data/app/views/spree/admin/shipping_methods/_form.html.erb +1 -1
- data/app/views/spree/admin/states/_state_list.html.erb +1 -1
- data/app/views/spree/admin/tax_rates/index.html.erb +1 -1
- data/app/views/spree/admin/taxonomies/_form.html.erb +1 -1
- data/app/views/spree/admin/taxons/_form.html.erb +1 -1
- data/app/views/spree/admin/taxons/_taxon_table.html.erb +2 -2
- data/app/views/spree/admin/variants/_form.html.erb +13 -13
- data/app/views/spree/admin/variants/index.html.erb +1 -7
- data/app/views/spree/checkout/_address.html.erb +10 -4
- data/app/views/spree/checkout/edit.html.erb +0 -1
- data/app/views/spree/checkout/payment/_gateway.html.erb +5 -5
- data/app/views/spree/checkout/registration.html.erb +2 -2
- data/app/views/spree/content/cvv.html.erb +6 -6
- data/app/views/spree/layouts/spree_application.html.erb +4 -48
- data/app/views/spree/order_mailer/cancel_email.text.erb +5 -5
- data/app/views/spree/order_mailer/confirm_email.text.erb +6 -7
- data/app/views/spree/orders/_adjustments.html.erb +14 -0
- data/app/views/spree/orders/_form.html.erb +1 -0
- data/app/views/spree/orders/show.html.erb +3 -3
- data/app/views/spree/products/_thumbnails.html.erb +1 -1
- data/app/views/spree/products/index.html.erb +1 -1
- data/app/views/spree/shared/_footer.html.erb +6 -0
- data/app/views/spree/shared/_google_analytics.html.erb +15 -16
- data/app/views/spree/shared/_head.html.erb +3 -9
- data/app/views/spree/shared/_header.html.erb +5 -0
- data/app/views/spree/shared/_main_nav_bar.html.erb +6 -0
- data/app/views/spree/shared/_nav_bar.html.erb +7 -3
- data/app/views/spree/shared/_order_details.html.erb +14 -11
- data/app/views/spree/shared/_sidebar.html.erb +3 -0
- data/app/views/spree/shared/unauthorized.html.erb +0 -0
- data/app/views/spree/shipment_mailer/shipped_email.text.erb +7 -7
- data/app/views/spree/taxons/show.html.erb +1 -1
- data/config/initializers/check_for_orphaned_preferences.rb +1 -1
- data/config/initializers/spree.rb +0 -12
- data/config/initializers/user_class_extensions.rb +25 -0
- data/config/initializers/workarounds_for_ruby19.rb +72 -0
- data/config/locales/en.yml +11 -24
- data/config/routes.rb +7 -37
- data/db/migrate/20090823005402_spree_zero_nine_zero.rb +14 -12
- data/db/migrate/20091015153048_add_openid_field_to_users.rb +9 -7
- data/db/migrate/20100209144531_polymorphic_payments.rb +5 -5
- data/db/migrate/20100214212536_assign_creditcard_txns_to_payment.rb +4 -4
- data/db/migrate/20100528185820_add_index_on_users_persistence_token.rb +3 -1
- data/db/migrate/20100811163637_add_guest_flag.rb +3 -1
- data/db/migrate/20100901171814_change_guest_flag_to_anonymous.rb +3 -1
- data/db/migrate/20101026184959_generate_anonymous_users.rb +3 -3
- data/db/migrate/20101103212716_drop_anonymous_field_for_user.rb +3 -1
- data/db/migrate/20111007143030_namespace_top_level_models.rb +18 -1
- data/db/migrate/20120315064358_migrate_images_from_products_to_variants.rb +6 -4
- data/db/migrate/20120509055454_create_tokenized_permissions_table.rb +16 -0
- data/db/migrate/20120530012000_rename_creditcards_to_credit_cards.rb +11 -0
- data/db/migrate/20120604203654_remove_credit_total_from_orders.rb +5 -0
- data/lib/generators/spree/custom_user/custom_user_generator.rb +53 -0
- data/lib/generators/spree/custom_user/templates/authentication_helpers.rb.tt +28 -0
- data/lib/generators/spree/custom_user/templates/initializer.rb.tt +1 -0
- data/lib/generators/spree/custom_user/templates/migration.rb.tt +7 -0
- data/lib/generators/spree/dummy/dummy_generator.rb +3 -0
- data/lib/generators/spree/dummy/templates/initializers/custom_user.rb +1 -0
- data/lib/generators/spree/install/templates/app/assets/javascripts/admin/all.js +0 -1
- data/lib/generators/spree/install/templates/app/assets/javascripts/store/all.js +0 -1
- data/lib/generators/spree/install/templates/app/assets/stylesheets/admin/all.css +0 -1
- data/lib/generators/spree/install/templates/app/assets/stylesheets/store/all.css +0 -1
- data/lib/generators/spree/install/templates/config/initializers/spree.rb +2 -0
- data/lib/spree/core.rb +15 -2
- data/lib/spree/core/controller_helpers.rb +123 -62
- data/lib/spree/core/current_order.rb +5 -0
- data/lib/spree/core/engine.rb +1 -1
- data/lib/spree/core/mail_settings.rb +1 -2
- data/lib/spree/core/permalinks.rb +1 -5
- data/lib/spree/core/preference_rescue.rb +8 -4
- data/lib/spree/core/relation_serialization.rb +9 -0
- data/lib/spree/core/respond_with.rb +1 -1
- data/lib/spree/core/s3_support.rb +25 -0
- data/lib/spree/core/search/base.rb +2 -5
- data/lib/spree/core/ssl_requirement.rb +2 -2
- data/lib/spree/core/store_helpers.rb +1 -2
- data/lib/spree/core/testing_support/controller_requests.rb +1 -0
- data/lib/spree/core/testing_support/env.rb +2 -0
- data/lib/spree/core/testing_support/factories/{creditcard_factory.rb → credit_card_factory.rb} +3 -3
- data/lib/spree/core/testing_support/factories/payment_factory.rb +1 -1
- data/lib/spree/core/testing_support/factories/product_factory.rb +4 -4
- data/lib/spree/core/testing_support/factories/user_factory.rb +3 -3
- data/lib/spree/core/testing_support/factories/zone_factory.rb +2 -3
- data/lib/spree/core/token_resource.rb +27 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/product_filters.rb +12 -13
- data/lib/tasks/core.rake +1 -1
- metadata +146 -154
- data/app/assets/images/noimage/large.png +0 -0
- data/app/assets/javascripts/admin/images/index.js +0 -10
- data/app/assets/javascripts/admin/images/new.js +0 -5
- data/app/assets/javascripts/admin/products.js +0 -2
- data/app/assets/javascripts/store/cart.js +0 -11
- data/app/assets/javascripts/store/checkout.js +0 -78
- data/app/assets/javascripts/store/product.js +0 -49
- data/app/controllers/spree/admin/users_controller.rb +0 -68
- data/app/views/spree/admin/option_types/_available.html.erb +0 -28
- data/app/views/spree/admin/option_types/_selected.html.erb +0 -26
- data/app/views/spree/admin/option_types/available.js.erb +0 -2
- data/app/views/spree/admin/option_types/select.js.erb +0 -3
- data/app/views/spree/admin/option_types/selected.html.erb +0 -6
- data/app/views/spree/admin/orders/history.html.erb +0 -29
- data/app/views/spree/admin/products/_option_types.html.erb +0 -40
- data/app/views/spree/admin/shared/_additional_field.html.erb +0 -5
- data/app/views/spree/admin/shared/_routes.html.erb +0 -8
- data/app/views/spree/admin/shared/_translations.html.erb +0 -17
- data/app/views/spree/admin/taxons/available.js.erb +0 -26
- data/app/views/spree/admin/taxons/remove.html.erb +0 -1
- data/app/views/spree/admin/taxons/select.js.erb +0 -2
- data/app/views/spree/admin/taxons/selected.html.erb +0 -42
- data/app/views/spree/admin/users/_form.html.erb +0 -19
- data/app/views/spree/admin/users/edit.html.erb +0 -14
- data/app/views/spree/admin/users/index.html.erb +0 -48
- data/app/views/spree/admin/users/new.html.erb +0 -14
- data/app/views/spree/admin/users/show.html.erb +0 -21
- data/app/views/spree/shared/_store_menu.html.erb +0 -2
- data/config/initializers/rails_5868.rb +0 -8
- data/db/migrate/20120605211305_make_users_email_index_unique.rb +0 -10
- data/db/migrate/20121017010007_remove_not_null_constraint_from_products_on_hand.rb +0 -11
- data/db/sample/users.rb +0 -61
- data/lib/generators/spree/sandbox/sandbox_generator.rb +0 -36
- data/lib/generators/spree/sandbox/templates/rails/routes.rb +0 -7
- data/lib/spree/core/ext/array.rb +0 -14
- data/lib/spree/core/ext/hash.rb +0 -75
- data/lib/spree/core/ext/string.rb +0 -10
- data/lib/tasks/install.rake +0 -18
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,5 +1,6 @@
|
|
1
|
-
//<%#encoding: UTF-8%>
|
2
1
|
//= require_self
|
2
|
+
//= require admin/product_autocomplete
|
3
|
+
//= require select2
|
3
4
|
|
4
5
|
/**
|
5
6
|
This is a collection of javascript functions and whatnot
|
@@ -44,129 +45,13 @@ $.fn.radioControlsVisibilityOfElement = function(dependentElementSelector){
|
|
44
45
|
});
|
45
46
|
}
|
46
47
|
|
47
|
-
// Product autocompletion
|
48
|
-
image_html = function(item){
|
49
|
-
return "<img src='" + item['images'][0]["mini_url"] + "'/>";
|
50
|
-
}
|
51
|
-
|
52
|
-
format_product_autocomplete = function(item){
|
53
|
-
var html = "";
|
54
|
-
|
55
|
-
var product = item.data['product'];
|
56
|
-
|
57
|
-
if(item.data['variant']==undefined){
|
58
|
-
if(product['images'].length!=0){
|
59
|
-
html = image_html(product);
|
60
|
-
}
|
61
|
-
|
62
|
-
html += "<div><h4>" + product['name'] + "</h4>";
|
63
|
-
if (product['master']) {
|
64
|
-
html += "<span><strong>" + Spree.translations.sku + ":</strong>" + product['master']['sku'] + "</span>";
|
65
|
-
}
|
66
|
-
html += "<span><strong>" + Spree.translations.on_hand + ":</strong>" + product['count_on_hand'] + "</span></div>";
|
67
|
-
}else{
|
68
|
-
// variant
|
69
|
-
var variant = item.data['variant'];
|
70
|
-
var name = item.data.product['name'];
|
71
|
-
|
72
|
-
if(variant['images'].length!=0){
|
73
|
-
html = image_html(variant);
|
74
|
-
}else{
|
75
|
-
if(product['images'].length!=0){
|
76
|
-
html = image_html(product);
|
77
|
-
}
|
78
|
-
}
|
79
|
-
|
80
|
-
name += " - " + $.map(variant['option_values'], function(option_value){
|
81
|
-
return option_value["option_type"]["presentation"] + ": " + option_value['presentation'];
|
82
|
-
}).join(", ")
|
83
|
-
|
84
|
-
html += "<div><h4>" + name + "</h4>";
|
85
|
-
html += "<span><strong>" + Spree.translations.sku + ":</strong>" + variant['sku'] + "</span>";
|
86
|
-
html += "<span><strong>" + Spree.translations.on_hand + ":</strong>" + variant['count_on_hand'] + "</span></div>";
|
87
|
-
}
|
88
|
-
|
89
|
-
return html
|
90
|
-
}
|
91
|
-
|
92
|
-
prep_product_autocomplete_data = function(data){
|
93
|
-
return $.map(eval(data), function(row) {
|
94
|
-
|
95
|
-
var product = row['product'];
|
96
|
-
|
97
|
-
if(product['variants'].length>0 && ['expand_variants']){
|
98
|
-
//variants
|
99
|
-
return $.map(product['variants'], function(variant){
|
100
|
-
|
101
|
-
var name = product['name'];
|
102
|
-
name += " - " + $.map(variant['option_values'], function(option_value){
|
103
|
-
return option_value["option_type"]["presentation"] + ": " + option_value['presentation'];
|
104
|
-
}).join(", ");
|
105
|
-
|
106
|
-
return {
|
107
|
-
data: {product: product, variant: variant},
|
108
|
-
value: name,
|
109
|
-
result: name
|
110
|
-
}
|
111
|
-
});
|
112
|
-
}else{
|
113
|
-
return {
|
114
|
-
data: {product: product},
|
115
|
-
value: product['name'],
|
116
|
-
result: product['name']
|
117
|
-
}
|
118
|
-
}
|
119
|
-
});
|
120
|
-
}
|
121
|
-
|
122
|
-
$.fn.product_autocomplete = function(){
|
123
|
-
return this.each(function() {
|
124
|
-
$(this).autocomplete({
|
125
|
-
source: function(request, response) {
|
126
|
-
$.get(Spree.routes.product_search + '?' + jQuery.param({ q: $('#add_product_name').val(), authenticity_token: encodeURIComponent($('meta[name=csrf-token]').attr("content"))}), function(data) {
|
127
|
-
result = prep_product_autocomplete_data(data)
|
128
|
-
response(result);
|
129
|
-
});
|
130
|
-
},
|
131
|
-
minLength: 4,
|
132
|
-
focus: function(event, ui) {
|
133
|
-
$('#add_product_name').val(ui.item.label);
|
134
|
-
return false;
|
135
|
-
},
|
136
|
-
select: function(event, ui) {
|
137
|
-
$('#add_product_name').val(ui.item.label);
|
138
|
-
product = ui.item.data;
|
139
|
-
if (product['variant'] == undefined) {
|
140
|
-
// product
|
141
|
-
$('#add_variant_id').val(product['product']['master']['id']);
|
142
|
-
} else {
|
143
|
-
// variant
|
144
|
-
$('#add_variant_id').val(product['variant']['id']);
|
145
|
-
}
|
146
|
-
return false;
|
147
|
-
}
|
148
|
-
}).data("autocomplete")._renderItem = function(ul, item) {
|
149
|
-
$(ul).addClass('ac_results');
|
150
|
-
html = format_product_autocomplete(item);
|
151
|
-
return $("<li></li>")
|
152
|
-
.data("item.autocomplete", item)
|
153
|
-
.append("<a>" + html + "</a>")
|
154
|
-
.appendTo(ul);
|
155
|
-
}
|
156
|
-
|
157
|
-
$(this).data("autocomplete")._resizeMenu = function() {
|
158
|
-
var ul = this.menu.element;
|
159
|
-
ul.outerWidth(this.element.outerWidth());
|
160
|
-
}
|
161
|
-
});
|
162
|
-
}
|
163
48
|
|
164
49
|
$.fn.objectPicker = function(url){
|
165
50
|
$(this).tokenInput(url + "&authenticity_token=" + escape(AUTH_TOKEN), {
|
166
51
|
searchDelay : 600,
|
167
|
-
hintText :
|
168
|
-
noResultsText :
|
169
|
-
searchingText :
|
52
|
+
hintText : strings.type_to_search,
|
53
|
+
noResultsText : strings.no_results,
|
54
|
+
searchingText : strings.searching,
|
170
55
|
prePopulateFromInput : true
|
171
56
|
});
|
172
57
|
};
|
@@ -175,18 +60,14 @@ $.fn.productPicker = function(){
|
|
175
60
|
$(this).objectPicker(Spree.routes.product_search_basic);
|
176
61
|
}
|
177
62
|
|
178
|
-
$.fn.userPicker = function(){
|
179
|
-
$(this).objectPicker(Spree.routes.user_search);
|
180
|
-
}
|
181
|
-
|
182
63
|
handle_date_picker_fields = function(){
|
183
64
|
$('.datepicker').datepicker({
|
184
|
-
dateFormat:
|
185
|
-
dayNames:
|
186
|
-
dayNamesMin:
|
187
|
-
monthNames:
|
188
|
-
prevText:
|
189
|
-
nextText:
|
65
|
+
dateFormat: "<%= ::I18n.t(:format, :scope => 'spree.date_picker', :default => 'yy/mm/dd') %>",
|
66
|
+
dayNames: <%= ::I18n.t(:day_names, :scope => :date).to_json %>,
|
67
|
+
dayNamesMin: <%= ::I18n.t(:abbr_day_names, :scope => :date).to_json %>,
|
68
|
+
monthNames: <%= (::I18n.t(:month_names, :scope => :date).delete_if(&:blank?)).to_json %>,
|
69
|
+
prevText: '<%= ::I18n.t(:previous) %>',
|
70
|
+
nextText: '<%= ::I18n.t(:next) %>',
|
190
71
|
showOn: "button",
|
191
72
|
buttonImage: "<%= asset_path 'datepicker/cal.gif' %>",
|
192
73
|
buttonImageOnly: true
|
@@ -194,6 +75,7 @@ handle_date_picker_fields = function(){
|
|
194
75
|
}
|
195
76
|
|
196
77
|
$(document).ready(function(){
|
78
|
+
handle_date_picker_fields();
|
197
79
|
$(".observe_field").on('change', function() {
|
198
80
|
target = $(this).attr("data-update");
|
199
81
|
ajax_indicator = $(this).attr("data-ajax-indicator") || '#busy_indicator';
|
@@ -252,9 +134,6 @@ $(document).ready(function(){
|
|
252
134
|
});
|
253
135
|
|
254
136
|
$('.tokeninput.products').productPicker();
|
255
|
-
$('.tokeninput.users').userPicker();
|
256
|
-
|
257
|
-
handle_date_picker_fields();
|
258
137
|
|
259
138
|
$('body').on('click', '.select_properties_from_prototype', function(){
|
260
139
|
$("#busy_indicator").show();
|
@@ -294,9 +173,6 @@ $(document).ready(function(){
|
|
294
173
|
});
|
295
174
|
});
|
296
175
|
|
297
|
-
});
|
298
|
-
|
299
|
-
jQuery(document).ready(function() {
|
300
176
|
$('a.dismiss').click(function() {
|
301
177
|
$(this).parent().fadeOut();
|
302
178
|
});
|
@@ -1,4 +1,5 @@
|
|
1
1
|
$(document).ready(function(){
|
2
|
+
|
2
3
|
add_address = function(addr){
|
3
4
|
var html = "";
|
4
5
|
if(addr!=undefined){
|
@@ -80,7 +81,7 @@ $(document).ready(function(){
|
|
80
81
|
$('#user_id').val(ui.item.data['id']);
|
81
82
|
$('#guest_checkout_true').prop("checked", false);
|
82
83
|
$('#guest_checkout_false').prop("checked", true);
|
83
|
-
$('#guest_checkout_false').
|
84
|
+
$('#guest_checkout_false').prob("disabled", false);
|
84
85
|
return true;
|
85
86
|
}
|
86
87
|
}).data("autocomplete")._renderItem = function(ul, item) {
|
@@ -100,40 +101,6 @@ $(document).ready(function(){
|
|
100
101
|
|
101
102
|
}
|
102
103
|
|
103
|
-
|
104
|
-
|
105
|
-
$('input#order_use_billing').click(function() {
|
106
|
-
show_billing(!$(this).is(':checked'));
|
107
|
-
});
|
108
|
-
|
109
|
-
$('#guest_checkout_true').change(function() {
|
110
|
-
$('#customer_search').val("");
|
111
|
-
$('#user_id').val("");
|
112
|
-
$('#checkout_email').val("");
|
113
|
-
|
114
|
-
$('#order_bill_address_attributes_firstname').val("");
|
115
|
-
$('#order_bill_address_attributes_lastname').val("");
|
116
|
-
$('#order_bill_address_attributes_company').val("");
|
117
|
-
$('#order_bill_address_attributes_address1').val("");
|
118
|
-
$('#order_bill_address_attributes_address2').val("");
|
119
|
-
$('#order_bill_address_attributes_city').val("");
|
120
|
-
$('#order_bill_address_attributes_zipcode').val("");
|
121
|
-
$('#order_bill_address_attributes_state_id').val("");
|
122
|
-
$('#order_bill_address_attributes_country_id').val("");
|
123
|
-
$('#order_bill_address_attributes_phone').val("");
|
124
|
-
|
125
|
-
$('#order_ship_address_attributes_firstname').val("");
|
126
|
-
$('#order_ship_address_attributes_lastname').val("");
|
127
|
-
$('#order_bill_address_attributes_company').val("");
|
128
|
-
$('#order_ship_address_attributes_address1').val("");
|
129
|
-
$('#order_ship_address_attributes_address2').val("");
|
130
|
-
$('#order_ship_address_attributes_city').val("");
|
131
|
-
$('#order_ship_address_attributes_zipcode').val("");
|
132
|
-
$('#order_ship_address_attributes_state_id').val("");
|
133
|
-
$('#order_ship_address_attributes_country_id').val("");
|
134
|
-
$('#order_ship_address_attributes_phone').val("");
|
135
|
-
});
|
136
|
-
|
137
104
|
var show_billing = function(show) {
|
138
105
|
if(show) {
|
139
106
|
$('#shipping').show();
|
@@ -146,6 +113,22 @@ $(document).ready(function(){
|
|
146
113
|
}
|
147
114
|
}
|
148
115
|
|
116
|
+
$('input#order_use_billing').click(function() {
|
117
|
+
show_billing(!$(this).is(':checked'));
|
118
|
+
});
|
119
|
+
|
120
|
+
$('#guest_checkout_true').change(function() {
|
121
|
+
$('#customer_search').val("");
|
122
|
+
$('#user_id').val("");
|
123
|
+
$('#checkout_email').val("");
|
124
|
+
|
125
|
+
var fields = ["firstname", "lastname", "company", "address1", "address2",
|
126
|
+
"city", "zipcode", "state_id", "country_id", "phone"]
|
127
|
+
$.each(fields, function(i, field) {
|
128
|
+
$('#order_bill_address_attributes' + field).val("");
|
129
|
+
$('#order_ship_address_attributes' + field).val("");
|
130
|
+
})
|
131
|
+
});
|
149
132
|
});
|
150
133
|
|
151
134
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
$(function() {
|
1
|
+
$(function() {
|
2
2
|
var original_gtwy_type = $('#gtwy-type').attr('value');
|
3
3
|
$('div#gateway-settings-warning').hide();
|
4
4
|
$('#gtwy-type').change(function() {
|
@@ -10,4 +10,4 @@ $(function() {
|
|
10
10
|
$('div#gateway-settings-warning').show();
|
11
11
|
}
|
12
12
|
});
|
13
|
-
})
|
13
|
+
})
|
@@ -4,8 +4,6 @@ $(document).ready(function() {
|
|
4
4
|
$(input).on('change', function() {
|
5
5
|
|
6
6
|
var id = "#" + $(this).attr('id').replace("_quantity", "_id");
|
7
|
-
console.log($(this))
|
8
|
-
console.log($(id))
|
9
7
|
|
10
8
|
jQuery.post("/admin/orders/" + $('input#order_number').val() + "/line_items/" + $(id).val(),
|
11
9
|
{ _method: "put", "line_item[quantity]": $(this).val()},
|
@@ -0,0 +1,116 @@
|
|
1
|
+
// Product autocompletion
|
2
|
+
image_html = function(item){
|
3
|
+
return "<img src='" + item['images'][0]["mini_url"] + "'/>";
|
4
|
+
}
|
5
|
+
|
6
|
+
format_product_autocomplete = function(item){
|
7
|
+
var html = "";
|
8
|
+
|
9
|
+
var product = item.data['product'];
|
10
|
+
|
11
|
+
if(item.data['variant']==undefined){
|
12
|
+
if(product['images'].length!=0){
|
13
|
+
html = image_html(product);
|
14
|
+
}
|
15
|
+
|
16
|
+
html += "<div><h4>" + product['name'] + "</h4>";
|
17
|
+
if (product['master']) {
|
18
|
+
html += "<span><strong><%= ::I18n.t(:sku) %>: </strong>" + product['master']['sku'] + "</span>";
|
19
|
+
}
|
20
|
+
html += "<span><strong><%= ::I18n.t(:on_hand) %>: </strong>" + product['count_on_hand'] + "</span></div>";
|
21
|
+
}else{
|
22
|
+
// variant
|
23
|
+
var variant = item.data['variant'];
|
24
|
+
var name = item.data.product['name'];
|
25
|
+
|
26
|
+
if(variant['images'].length!=0){
|
27
|
+
html = image_html(variant);
|
28
|
+
}else{
|
29
|
+
if(product['images'].length!=0){
|
30
|
+
html = image_html(product);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
name += " - " + $.map(variant['option_values'], function(option_value){
|
35
|
+
return option_value["option_type"]["presentation"] + ": " + option_value['presentation'];
|
36
|
+
}).join(", ")
|
37
|
+
|
38
|
+
html += "<div><h4>" + name + "</h4>";
|
39
|
+
html += "<span><strong><%= ::I18n.t(:sku) %>: </strong>" + variant['sku'] + "</span>";
|
40
|
+
html += "<span><strong><%= ::I18n.t(:on_hand) %>: </strong>" + variant['count_on_hand'] + "</span></div>";
|
41
|
+
}
|
42
|
+
|
43
|
+
return html
|
44
|
+
}
|
45
|
+
|
46
|
+
prep_product_autocomplete_data = function(data){
|
47
|
+
return $.map(eval(data), function(row) {
|
48
|
+
|
49
|
+
var product = row['product'];
|
50
|
+
|
51
|
+
if(product['variants'].length>0 && ['expand_variants']){
|
52
|
+
//variants
|
53
|
+
return $.map(product['variants'], function(variant){
|
54
|
+
|
55
|
+
var name = product['name'];
|
56
|
+
name += " - " + $.map(variant['option_values'], function(option_value){
|
57
|
+
return option_value["option_type"]["presentation"] + ": " + option_value['presentation'];
|
58
|
+
}).join(", ");
|
59
|
+
|
60
|
+
return {
|
61
|
+
data: {product: product, variant: variant},
|
62
|
+
value: name,
|
63
|
+
result: name
|
64
|
+
}
|
65
|
+
});
|
66
|
+
}else{
|
67
|
+
return {
|
68
|
+
data: {product: product},
|
69
|
+
value: product['name'],
|
70
|
+
result: product['name']
|
71
|
+
}
|
72
|
+
}
|
73
|
+
});
|
74
|
+
}
|
75
|
+
|
76
|
+
$.fn.product_autocomplete = function(){
|
77
|
+
return this.each(function() {
|
78
|
+
$(this).autocomplete({
|
79
|
+
source: function(request, response) {
|
80
|
+
$.get(Spree.routes.product_search + '?' + jQuery.param({ q: $('.product_autocomplete').val(), authenticity_token: encodeURIComponent($('meta[name=csrf-token]').attr("content"))}), function(data) {
|
81
|
+
result = prep_product_autocomplete_data(data)
|
82
|
+
response(result);
|
83
|
+
});
|
84
|
+
},
|
85
|
+
minLength: 4,
|
86
|
+
focus: function(event, ui) {
|
87
|
+
$('.product_autocomplete').val(ui.item.label);
|
88
|
+
return false;
|
89
|
+
},
|
90
|
+
select: function(event, ui) {
|
91
|
+
$('.product_autocomplete').val(ui.item.label);
|
92
|
+
product = ui.item.data;
|
93
|
+
if (product['variant'] == undefined) {
|
94
|
+
// product
|
95
|
+
$('#add_variant_id').val(product['product']['master']['id']);
|
96
|
+
} else {
|
97
|
+
// variant
|
98
|
+
$('#add_variant_id').val(product['variant']['id']);
|
99
|
+
}
|
100
|
+
return false;
|
101
|
+
}
|
102
|
+
}).data("autocomplete")._renderItem = function(ul, item) {
|
103
|
+
$(ul).addClass('ac_results');
|
104
|
+
html = format_product_autocomplete(item);
|
105
|
+
return $("<li></li>")
|
106
|
+
.data("item.autocomplete", item)
|
107
|
+
.append("<a>" + html + "</a>")
|
108
|
+
.appendTo(ul);
|
109
|
+
}
|
110
|
+
|
111
|
+
$(this).data("autocomplete")._resizeMenu = function() {
|
112
|
+
var ul = this.menu.element;
|
113
|
+
ul.outerWidth(this.element.outerWidth());
|
114
|
+
}
|
115
|
+
});
|
116
|
+
}
|