Permalink
Browse files

Initial upgrade release.

  • Loading branch information...
stephskardal committed Mar 31, 2014
1 parent 1ebdb12 commit ef4a33ba199c27e18e39434c7cd9aec659c2081f
Showing with 770 additions and 823 deletions.
  1. +0 −14 Gemfile
  2. +18 −149 Gemfile.lock
  3. +6 −0 README.md
  4. +4 −0 RELEASE_NOTES
  5. +18 −15 app/assets/javascripts/piggybak/piggybak.js
  6. +7 −4 app/assets/javascripts/piggybak/piggybak.states.js
  7. +114 −0 app/assets/javascripts/rails_admin/custom/ui.js.erb
  8. +15 −3 app/controllers/piggybak/orders_controller.rb
  9. +8 −11 app/models/piggybak/address.rb
  10. +3 −4 app/models/piggybak/country.rb
  11. +3 −3 app/models/piggybak/line_item.rb
  12. +11 −6 app/models/piggybak/order.rb
  13. +2 −3 app/models/piggybak/order_note.rb
  14. +4 −7 app/models/piggybak/payment.rb
  15. +2 −4 app/models/piggybak/payment_method.rb
  16. +2 −4 app/models/piggybak/payment_method_value.rb
  17. +4 −7 app/models/piggybak/sellable.rb
  18. +2 −4 app/models/piggybak/shipment.rb
  19. +1 −1 app/models/piggybak/shipping_calculator/flat_rate.rb
  20. +1 −1 app/models/piggybak/shipping_calculator/range.rb
  21. 0 app/models/piggybak/shipping_method
  22. +3 −6 app/models/piggybak/shipping_method.rb
  23. +2 −3 app/models/piggybak/shipping_method_value.rb
  24. +0 −1 app/models/piggybak/state.rb
  25. +6 −10 app/models/piggybak/tax_calculator/percent.rb
  26. +5 −6 app/models/piggybak/tax_method.rb
  27. +2 −3 app/models/piggybak/tax_method_value.rb
  28. +2 −2 app/views/piggybak/orders/_user_details.html.erb
  29. +1 −0 app/views/rails_admin/main/_copy_from_billing.html.erb
  30. +0 −15 app/views/rails_admin/main/_copy_from_billing.html.haml
  31. +2 −7 app/views/rails_admin/main/_location_select.html.haml
  32. +1 −25 app/views/rails_admin/main/_polymorphic_nested.html.haml
  33. +17 −19 config/routes.rb
  34. +19 −0 db/migrate/20140325133841_upgrade_piggybak_tables.rb
  35. +0 −5 lib/currency.rb
  36. +1 −477 lib/piggybak.rb
  37. +2 −0 lib/piggybak/config.rb
  38. +481 −0 lib/piggybak/engine.rb
  39. +1 −1 lib/piggybak/version.rb
  40. +0 −3 piggybak.gemspec
View
14 Gemfile
@@ -4,17 +4,3 @@ source "http://rubygems.org"
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# jquery-rails is used by the dummy application
gem "jquery-rails"
# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
# To use debugger
# gem 'debugger'
gem "countries"
gem "rack-ssl-enforcer"
View
@@ -1,183 +1,52 @@
PATH
remote: .
specs:
piggybak (0.6.33)
piggybak (0.7.0)
activemerchant
countries
devise
rack-ssl-enforcer
rails (~> 3.2.8)
rails_admin (~> 0.4.5)
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.16)
actionpack (= 3.2.16)
mail (~> 2.5.4)
actionpack (3.2.16)
activemodel (= 3.2.16)
activesupport (= 3.2.16)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
active_utils (2.0.1)
active_utils (2.0.2)
activesupport (>= 2.3.11)
i18n
activemerchant (1.42.4)
activemerchant (1.42.7)
active_utils (~> 2.0, >= 2.0.1)
activesupport (>= 2.3.14, < 5.0.0)
builder (>= 2.1.2, < 4.0.0)
i18n (~> 0.5)
json (~> 1.7)
money (< 7.0.0)
nokogiri (~> 1.4)
activemodel (3.2.16)
activesupport (= 3.2.16)
builder (~> 3.0.0)
activerecord (3.2.16)
activemodel (= 3.2.16)
activesupport (= 3.2.16)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.16)
activemodel (= 3.2.16)
activesupport (= 3.2.16)
activesupport (3.2.16)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
arel (3.0.3)
atomic (1.1.14)
bcrypt-ruby (3.1.2)
bootstrap-sass (2.3.2.2)
sass (~> 3.2)
builder (3.0.4)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
activesupport (4.0.4)
i18n (~> 0.6, >= 0.6.9)
minitest (~> 4.2)
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
atomic (1.1.16)
builder (3.2.2)
countries (0.9.3)
currencies (~> 0.4.2)
currencies (0.4.2)
devise (3.2.2)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
erubis (2.7.0)
execjs (2.0.2)
font-awesome-rails (3.2.1.3)
railties (>= 3.2, < 5.0)
haml (4.0.5)
tilt
hike (1.2.3)
i18n (0.6.9)
journey (1.0.4)
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (3.0.1)
jquery-rails
railties (>= 3.1.0)
json (1.8.1)
kaminari (0.15.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25.1)
mini_portile (0.5.2)
monetize (0.1.3)
money (6.0.1)
mini_portile (0.5.3)
minitest (4.7.5)
money (6.1.1)
i18n (~> 0.6.4)
monetize (~> 0.1.3)
multi_json (1.8.4)
nested_form (0.3.2)
multi_json (1.9.2)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
orm_adapter (0.5.0)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-pjax (0.7.0)
nokogiri (~> 1.5)
rack (~> 1.3)
rack-ssl (1.3.3)
rack
rack-ssl-enforcer (0.2.6)
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.16)
actionmailer (= 3.2.16)
actionpack (= 3.2.16)
activerecord (= 3.2.16)
activeresource (= 3.2.16)
activesupport (= 3.2.16)
bundler (~> 1.0)
railties (= 3.2.16)
rails_admin (0.4.9)
bootstrap-sass (~> 2.2)
builder (~> 3.0)
coffee-rails (>= 3.1, < 5)
font-awesome-rails (~> 3.0)
haml (~> 4.0)
jquery-rails (>= 2.1, < 4)
jquery-ui-rails (~> 3.0)
kaminari (~> 0.14)
nested_form (~> 0.3)
rack-pjax (~> 0.6)
rails (~> 3.1)
remotipart (~> 1.0)
safe_yaml (~> 0.6)
sass-rails (~> 3.1)
railties (3.2.16)
actionpack (= 3.2.16)
activesupport (= 3.2.16)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.1.1)
rdoc (3.12.2)
json (~> 1.4)
remotipart (1.2.1)
safe_yaml (0.9.7)
sass (3.2.13)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
thor (0.18.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.38)
warden (1.2.3)
rack (>= 1.0)
thread_safe (0.3.1)
atomic (>= 1.1.7, < 2)
tzinfo (0.3.39)
PLATFORMS
ruby
DEPENDENCIES
countries
jquery-rails
piggybak!
rack-ssl-enforcer
View
@@ -11,6 +11,8 @@ Modular / mountable ecommerce gem. Features:
* Fully defined backend RailsAdmin interface for adding orders on the backend
* Piggybak 0.7.0 is compatible with Rails 4, and earlier versions compatible with Rails 3.
Announcements
========
@@ -42,6 +44,10 @@ Installation
piggybak install
* Add piggybak/piggybak-application to your main application.js:
//= require piggybak/piggybak-application
(NOTE: If you run into an error saying that piggybak gem is missing, use bundle exec piggybak install)
* Follow the instructions [here][documentation] to read more about the integration points and product configuration in Piggybak.
View
@@ -1,3 +1,7 @@
0.7.0
Released: 03.31.2014
* Initial release for Rails 4 upgrade
0.6.33
Released: 01.22.2014
* Order total calculation update to be more clear in admin.
@@ -4,15 +4,18 @@ var page_load = 1;
var shipping_field;
$(function() {
shipping_field = $('#piggybak_order_line_items_attributes_0_shipment_attributes_shipping_method_id');
if($('form#new_order').size() == 0) {
return;
}
shipping_field = $('#order_line_items_attributes_0_shipment_attributes_shipping_method_id');
piggybak.initialize_listeners();
piggybak.update_shipping_options($('#piggybak_order_shipping_address_attributes_state_id'), function() {
$('#piggybak_order_shipments_attributes_0_shipping_method_id').val(previous_shipping);
piggybak.update_shipping_options($('#order_shipping_address_attributes_state_id'), function() {
$('#order_shipments_attributes_0_shipping_method_id').val(previous_shipping);
});
piggybak.update_tax();
$('#new_piggybak_order').validate({
$('#new_order').validate({
submitHandler: function(form) {
var submit = $($('#new_piggybak_order input[type=submit]'));
var submit = $($('#new_order input[type=submit]'));
submit.prop('disabled',true);
submit.attr('value','Processing...');
form.submit()
@@ -21,20 +24,20 @@ $(function() {
});
var piggybak = {
shipping_els: '#piggybak_order_shipping_address_attributes_state_id,#piggybak_order_shipping_address_attributes_country_id,#piggybak_order_shipping_address_attributes_zip',
shipping_els: '#order_shipping_address_attributes_state_id,#order_shipping_address_attributes_country_id,#order_shipping_address_attributes_zip',
initialize_listeners: function() {
$(document).on('change', piggybak.shipping_els, function() {
piggybak.update_shipping_options($(this));
});
$(document).on('change', '#piggybak_order_billing_address_attributes_state_id', function() {
$(document).on('change', '#order_billing_address_attributes_state_id', function() {
piggybak.update_tax();
});
$('#shipping select').change(function() {
piggybak.update_totals();
});
$('#shipping_address #copy').click(function() {
$('#shipping_address #copy').on('click', function() {
piggybak.copy_from_billing();
piggybak.update_shipping_options($('#piggybak_order_shipping_address_attributes_state_id'));
piggybak.update_shipping_options($('#order_shipping_address_attributes_state_id'));
return false;
});
return;
@@ -44,11 +47,11 @@ var piggybak = {
var id = $(j).attr('id').replace(/billing_address/, 'shipping_address');
$('#' + id).val($(j).val());
});
var country = $('#piggybak_order_billing_address_attributes_country_id').val();
$('#piggybak_order_shipping_address_attributes_country_id').val(country);
var country = $('#order_billing_address_attributes_country_id').val();
$('#order_shipping_address_attributes_country_id').val(country);
piggybak_states.update_state_option('shipping', function() {
var state = $('#piggybak_order_billing_address_attributes_state_id').val();
$('#piggybak_order_shipping_address_attributes_state_id').val(state);
var state = $('#order_billing_address_attributes_state_id').val();
$('#order_shipping_address_attributes_state_id').val(state);
});
$('#shipping_address input').valid();
},
@@ -107,7 +110,7 @@ var piggybak = {
});
$('#billing_address input, #billing_address select').each(function(i, j) {
var id = $(j).attr('id');
id = id.replace("piggybak_order_billing_address_attributes_", '');
id = id.replace("order_billing_address_attributes_", '');
billing_data[id] = $(j).val();
});
$.ajax({
@@ -141,7 +144,7 @@ var piggybak = {
$('#shipping_address input, #shipping_address select').each(function(i, j) {
var id = $(j).attr('id');
if(typeof(id) !== 'undefined') {
id = id.replace("piggybak_order_shipping_address_attributes_", '');
id = id.replace("order_shipping_address_attributes_", '');
if($(j).is(':checkbox')) {
shipping_data[id] = $(j).is(':checked');
} else {
@@ -2,10 +2,10 @@ var geodata;
var piggybak_states = {
initialize_listeners: function() {
$('#piggybak_order_shipping_address_attributes_country_id').change(function() {
$('#order_shipping_address_attributes_country_id').change(function() {
piggybak_states.update_state_option('shipping');
});
$('#piggybak_order_billing_address_attributes_country_id').change(function() {
$('#order_billing_address_attributes_country_id').change(function() {
piggybak_states.update_state_option('billing');
});
return;
@@ -23,7 +23,7 @@ var piggybak_states = {
});
},
update_state_option: function(type, block) {
var country_field = $('#piggybak_order_' + type + '_address_attributes_country_id');
var country_field = $('#order_' + type + '_address_attributes_country_id');
var country_id = country_field.val();
var new_field;
@@ -35,7 +35,7 @@ var piggybak_states = {
} else {
new_field = $('<input>');
}
var old_field = $('#piggybak_order_' + type + '_address_attributes_state_id');
var old_field = $('#order_' + type + '_address_attributes_state_id');
new_field.attr('name', old_field.attr('name')).attr('id', old_field.attr('id'));
if(old_field.prop('tagName') == new_field.prop('tagName')) {
new_field.val(old_field.val());
@@ -50,6 +50,9 @@ var piggybak_states = {
};
$(function() {
if($('form#new_order').size() == 0) {
return;
}
piggybak_states.populate_geodata();
piggybak_states.initialize_listeners();
});
Oops, something went wrong.

0 comments on commit ef4a33b

Please sign in to comment.