nimbleshop_simply 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/assets/javascripts/nimbleshop_simply/load_states.js.coffee +10 -26
- data/app/assets/javascripts/nimbleshop_simply/mobile.simply.js +4 -0
- data/app/assets/javascripts/nimbleshop_simply/order.js.coffee +1 -1
- data/app/assets/javascripts/nimbleshop_simply/shipping_address_same_as_billing_address.js.coffee +2 -2
- data/app/assets/stylesheets/nimbleshop_simply/cart.css.scss +4 -0
- data/app/assets/stylesheets/nimbleshop_simply/mobile.simply.css +7 -0
- data/app/assets/stylesheets/nimbleshop_simply/mobile_simply.css +4 -0
- data/app/controllers/nimbleshop_simply/carts_controller.rb +0 -6
- data/app/controllers/nimbleshop_simply/checkout/payments_controller.rb +1 -0
- data/app/views/layouts/simply.mobile.erb +30 -0
- data/app/views/nimbleshop_simply/checkout/shipping_addresses/_billing_address.html.erb +0 -7
- data/app/views/nimbleshop_simply/checkout/shipping_addresses/_shipping_address.html.erb +1 -8
- data/app/views/nimbleshop_simply/checkout/shipping_methods/_no_shipping_method.html.erb +5 -4
- data/app/views/nimbleshop_simply/products/_product.mobile.erb +0 -0
- data/app/views/nimbleshop_simply/products/_products.mobile.erb +15 -0
- data/app/views/nimbleshop_simply/products/index.mobile.erb +15 -0
- data/app/views/nimbleshop_simply/shared/_order_summary.html.erb +1 -1
- data/app/views/nimbleshop_simply/shared/_order_summary_shipping_address.html.erb +1 -1
- data/app/views/nimbleshop_simply/shared/_order_summary_shipping_method.html.erb +1 -1
- data/app/views/nimbleshop_simply/shared/_shipping_and_tax_info.html.erb +1 -1
- data/config/initializers/add_mime_type.rb +1 -0
- data/test/integration/checkout/cart_acceptance_test.rb +23 -0
- data/test/integration/checkout/shipping_method_acceptance_test.rb +13 -0
- metadata +12 -4
@@ -1,40 +1,24 @@
|
|
1
|
-
window.
|
1
|
+
window.NimbleshopSimply = window.NimbleshopSimply || {}
|
2
2
|
|
3
|
-
class
|
3
|
+
class NimbleshopSimply.manageStates
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
@stateNameField(country).val('').parents('.control-group').hide()
|
8
|
-
@stateCodeField(country).val('').parents('.control-group').show()
|
9
|
-
else
|
10
|
-
@stateNameField(country).val('').parents('.control-group').show()
|
11
|
-
@stateCodeField(country).val('').parents('.control-group').hide()
|
12
|
-
|
13
|
-
hasRegions: ($element) ->
|
14
|
-
window.countryStateCodes[$element.val()].length > 0
|
15
|
-
|
16
|
-
stateNameField: ($element) ->
|
17
|
-
$element.parents("div.well").find("[name$='[state_name]']")
|
18
|
-
|
19
|
-
stateCodeField: ($element) ->
|
20
|
-
$element.parents("div.well").find("[name$='[state_code]']")
|
5
|
+
stateCodeField: ($country) ->
|
6
|
+
$country.parents("div.well").find("[name$='[state_code]']")
|
21
7
|
|
22
8
|
createOption: (state) ->
|
23
9
|
($ "<option />", text: state[0], value: state[1])
|
24
10
|
|
25
|
-
updateStates: ($
|
26
|
-
$stateCode = @stateCodeField($
|
27
|
-
for state in window.countryStateCodes[$
|
11
|
+
updateStates: ($country) ->
|
12
|
+
$stateCode = @stateCodeField($country).html('')
|
13
|
+
for state in window.countryStateCodes[$country.val()]
|
28
14
|
$stateCode.append @createOption(state)
|
29
15
|
|
30
16
|
handler: (evt) =>
|
31
17
|
$country = $(evt.target)
|
32
|
-
|
33
|
-
@updateStates $country
|
34
|
-
@toggleVisibility $country
|
18
|
+
@updateStates $country
|
35
19
|
false
|
36
20
|
|
37
21
|
constructor: ->
|
38
22
|
($ "select[name$='[country_code]']").bind('change', @handler)
|
39
|
-
for country in ($ "select[name$='[country_code]']")
|
40
|
-
|
23
|
+
#for country in ($ "select[name$='[country_code]']")
|
24
|
+
#$(country).triggerHandler 'change'
|
@@ -1,2 +1,2 @@
|
|
1
1
|
$ ->
|
2
|
-
new window.
|
2
|
+
new window.NimbleshopSimply.manageStates()
|
data/app/assets/javascripts/nimbleshop_simply/shipping_address_same_as_billing_address.js.coffee
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
window.NimbleshopSimply =
|
1
|
+
window.NimbleshopSimply = window.NimbleshopSimply || {}
|
2
2
|
|
3
3
|
NimbleshopSimply.toggleBillingAddress = class ToggleBillingAddress
|
4
4
|
constructor: ->
|
5
5
|
@handleToggleCheckBox()
|
6
6
|
$("#order_shipping_address_attributes_use_for_billing").on 'click', =>
|
7
|
-
|
7
|
+
@handleToggleCheckBox()
|
8
8
|
|
9
9
|
handleToggleCheckBox: ->
|
10
10
|
if $("#order_shipping_address_attributes_use_for_billing").is(':checked')
|
@@ -3,12 +3,6 @@ module NimbleshopSimply
|
|
3
3
|
|
4
4
|
respond_to :html
|
5
5
|
|
6
|
-
# this is mostly used for development purpose
|
7
|
-
def reset
|
8
|
-
reset_session
|
9
|
-
redirect_to root_url
|
10
|
-
end
|
11
|
-
|
12
6
|
def show
|
13
7
|
@line_items = current_order.blank? ? [] : current_order.line_items(include: :product).order('id')
|
14
8
|
respond_with @line_items
|
@@ -8,6 +8,7 @@ module NimbleshopSimply
|
|
8
8
|
def new
|
9
9
|
@page_sub_title = 'All payments are secure and encrypted. We never store your credit card information.'
|
10
10
|
@creditcard = Creditcard.new
|
11
|
+
@show_shipping_and_tax_info = true
|
11
12
|
render text: 'No payment method has been setup. Please setup atleast one payment method.' if PaymentMethod.count == 0
|
12
13
|
end
|
13
14
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title> <%= display_page_title %> </title>
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
7
|
+
<%= stylesheet_link_tag 'nimbleshop_simply/mobile_simply' %>
|
8
|
+
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
|
9
|
+
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
|
10
|
+
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
|
11
|
+
|
12
|
+
<%= csrf_meta_tag %>
|
13
|
+
</head>
|
14
|
+
|
15
|
+
<body>
|
16
|
+
<div data-role="page">
|
17
|
+
<div data-role="header">
|
18
|
+
<h1>nimbleShop</h1>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<%= yield %>
|
22
|
+
|
23
|
+
|
24
|
+
<div data-role="footer">
|
25
|
+
<h4>Page Footer</h4>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -49,13 +49,6 @@
|
|
49
49
|
</div>
|
50
50
|
</div>
|
51
51
|
|
52
|
-
<div class='control-group state-name'>
|
53
|
-
<%= billing_form.label :state_name, 'State/Province', class: 'control-label' %>
|
54
|
-
<div class='controls'>
|
55
|
-
<%= billing_form.text_field :state_name, class: 'input-xlarge' %>
|
56
|
-
</div>
|
57
|
-
</div>
|
58
|
-
|
59
52
|
<div class='control-group state-code'>
|
60
53
|
<%= billing_form.label :state_code, class: 'control-label' %>
|
61
54
|
<div class='controls'>
|
@@ -55,13 +55,6 @@
|
|
55
55
|
</div>
|
56
56
|
</div>
|
57
57
|
|
58
|
-
<div class='control-group'>
|
59
|
-
<%= shipping_form.label :state_name, class: 'control-label' %>
|
60
|
-
<div class='controls'>
|
61
|
-
<%= shipping_form.text_field :state_name, class: 'input-xlarge' %>
|
62
|
-
</div>
|
63
|
-
</div>
|
64
|
-
|
65
58
|
<div class='control-group'>
|
66
59
|
<%= shipping_form.label :zipcode, class: 'control-label' %>
|
67
60
|
<div class='controls'>
|
@@ -72,7 +65,7 @@
|
|
72
65
|
<div class='control-group'>
|
73
66
|
<div class='controls'>
|
74
67
|
<label class='checkbox'>
|
75
|
-
<%= shipping_form.check_box :use_for_billing %>
|
68
|
+
<%= shipping_form.check_box :use_for_billing %>
|
76
69
|
Use this address as billing address too
|
77
70
|
</label>
|
78
71
|
</div>
|
@@ -1,4 +1,5 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
<h4> No shipping method is available for the shipping address you have chosen</h4>
|
2
|
+
<br />
|
3
|
+
<p>
|
4
|
+
<%= link_to "Change shipping address", new_checkout_shipping_address_path %>
|
5
|
+
</p>
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class='span10'>
|
2
|
+
<% products.in_groups_of(3) do |group| %>
|
3
|
+
<ul class="unstyled row">
|
4
|
+
<% group.each do |product| %>
|
5
|
+
<% if product.blank? %>
|
6
|
+
|
7
|
+
<% else %>
|
8
|
+
<li class="span3">
|
9
|
+
<%= render 'nimbleshop_simply/products/product', product: product %>
|
10
|
+
</li>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div data-role="content" data-theme="d">
|
2
|
+
<ul data-role="listview">
|
3
|
+
<% @products.each do |product| %>
|
4
|
+
<li>
|
5
|
+
<%= link_to product do %>
|
6
|
+
<%= product_main_picture(product, :small_plus) %>
|
7
|
+
<%= truncate(product.name, length: 50) %>
|
8
|
+
<p class='price'>
|
9
|
+
<%= number_to_currency(product.price) %>
|
10
|
+
</p>
|
11
|
+
<% end %>
|
12
|
+
</li>
|
13
|
+
<% end %>
|
14
|
+
</ul>
|
15
|
+
</div>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<h3>
|
5
5
|
Shipping address
|
6
6
|
<small>
|
7
|
-
<%= link_to '
|
7
|
+
<%= link_to 'change', new_checkout_shipping_address_path, title: 'Edit Shipping Address', id: 'edit_shipping_address', class: 'light-link' %>
|
8
8
|
</small>
|
9
9
|
</h3>
|
10
10
|
<address class='shipping-address'>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<h3>
|
5
5
|
Shipping method
|
6
6
|
<small>
|
7
|
-
<%= link_to '
|
7
|
+
<%= link_to 'change', new_checkout_shipping_method_path, id: 'edit_shipping_method', title: 'edit shipping method', class: 'light-link' %>
|
8
8
|
</small>
|
9
9
|
</h3>
|
10
10
|
<address class='shipping-method'>
|
@@ -0,0 +1 @@
|
|
1
|
+
Mime::Type.register_alias "text/html", :mobile
|
@@ -111,3 +111,26 @@ class CartWithOrderExpiredAcceptanceTest < ActionDispatch::IntegrationTest
|
|
111
111
|
assert page.has_content?('powered by')
|
112
112
|
end
|
113
113
|
end
|
114
|
+
|
115
|
+
class CartWithOrderAlreadyAuthorizedAcceptanceTest < ActionDispatch::IntegrationTest
|
116
|
+
include ::ShippingMethodTestHelper
|
117
|
+
include ::CheckoutTestHelper
|
118
|
+
|
119
|
+
setup do
|
120
|
+
create(:product, name: 'Bracelet Set', price: 25)
|
121
|
+
create(:product, name: 'Necklace Set', price: 14)
|
122
|
+
create(:country_shipping_method)
|
123
|
+
end
|
124
|
+
|
125
|
+
test 'on cart page' do
|
126
|
+
visit root_path
|
127
|
+
add_item_to_cart('Bracelet Set')
|
128
|
+
assert_equal 1, Order.last.line_items.size
|
129
|
+
old_order_id = Order.last.id
|
130
|
+
Order.last.update_column(:payment_status, 'authorized')
|
131
|
+
add_item_to_cart('Bracelet Set')
|
132
|
+
assert_equal 1, Order.last.line_items.size
|
133
|
+
refute old_order_id == Order.last.id
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
@@ -27,6 +27,19 @@ class ShippingMethodAcceptanceTest < ActionDispatch::IntegrationTest
|
|
27
27
|
assert page.has_content?('Please select a shipping method')
|
28
28
|
end
|
29
29
|
|
30
|
+
test 'no shipping method available message' do
|
31
|
+
visit root_path
|
32
|
+
add_item_to_cart('Bracelet Set')
|
33
|
+
click_link 'Checkout'
|
34
|
+
|
35
|
+
enter_valid_email_address
|
36
|
+
enter_valid_shipping_address
|
37
|
+
ShippingMethod.delete_all
|
38
|
+
click_button 'Submit'
|
39
|
+
|
40
|
+
assert page.has_content?('No shipping method is available for the shipping address you have chosen')
|
41
|
+
end
|
42
|
+
|
30
43
|
test "ability to change shipping method" do
|
31
44
|
visit root_path
|
32
45
|
add_item_to_cart('Bracelet Set')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nimbleshop_simply
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-08-
|
13
|
+
date: 2012-08-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: jquery-rails
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- app/assets/images/nimbleshop_simply/twitter.png
|
61
61
|
- app/assets/javascripts/nimbleshop_simply/enable_fancybox.js.coffee
|
62
62
|
- app/assets/javascripts/nimbleshop_simply/load_states.js.coffee
|
63
|
+
- app/assets/javascripts/nimbleshop_simply/mobile.simply.js
|
63
64
|
- app/assets/javascripts/nimbleshop_simply/order.js.coffee
|
64
65
|
- app/assets/javascripts/nimbleshop_simply/remove_item_from_cart.js.coffee
|
65
66
|
- app/assets/javascripts/nimbleshop_simply/shipping_address_same_as_billing_address.js.coffee
|
@@ -68,6 +69,8 @@ files:
|
|
68
69
|
- app/assets/stylesheets/nimbleshop_simply/cart.css.scss
|
69
70
|
- app/assets/stylesheets/nimbleshop_simply/cart_button.css.scss
|
70
71
|
- app/assets/stylesheets/nimbleshop_simply/custom.css.scss
|
72
|
+
- app/assets/stylesheets/nimbleshop_simply/mobile.simply.css
|
73
|
+
- app/assets/stylesheets/nimbleshop_simply/mobile_simply.css
|
71
74
|
- app/assets/stylesheets/nimbleshop_simply/override_bootstrap.css
|
72
75
|
- app/assets/stylesheets/nimbleshop_simply/simply.css
|
73
76
|
- app/assets/stylesheets/nimbleshop_simply/themed_bootstrap_and_overrides.css.less
|
@@ -88,6 +91,7 @@ files:
|
|
88
91
|
- app/views/layouts/_twitter.html.erb
|
89
92
|
- app/views/layouts/nimbleshop_simply/mailer.text.erb
|
90
93
|
- app/views/layouts/simply.html.erb
|
94
|
+
- app/views/layouts/simply.mobile.erb
|
91
95
|
- app/views/nimbleshop_simply/carts/_empty_cart.html.erb
|
92
96
|
- app/views/nimbleshop_simply/carts/_line_item.html.erb
|
93
97
|
- app/views/nimbleshop_simply/carts/show.html.erb
|
@@ -117,15 +121,19 @@ files:
|
|
117
121
|
- app/views/nimbleshop_simply/products/_breadcrumb.html.erb
|
118
122
|
- app/views/nimbleshop_simply/products/_link_group.html.erb
|
119
123
|
- app/views/nimbleshop_simply/products/_product.html.erb
|
124
|
+
- app/views/nimbleshop_simply/products/_product.mobile.erb
|
120
125
|
- app/views/nimbleshop_simply/products/_products.html.erb
|
126
|
+
- app/views/nimbleshop_simply/products/_products.mobile.erb
|
121
127
|
- app/views/nimbleshop_simply/products/_sidebar.html.erb
|
122
128
|
- app/views/nimbleshop_simply/products/index.html.erb
|
129
|
+
- app/views/nimbleshop_simply/products/index.mobile.erb
|
123
130
|
- app/views/nimbleshop_simply/products/show.html.erb
|
124
131
|
- app/views/nimbleshop_simply/shared/_order_summary.html.erb
|
125
132
|
- app/views/nimbleshop_simply/shared/_order_summary_line_items.html.erb
|
126
133
|
- app/views/nimbleshop_simply/shared/_order_summary_shipping_address.html.erb
|
127
134
|
- app/views/nimbleshop_simply/shared/_order_summary_shipping_method.html.erb
|
128
135
|
- app/views/nimbleshop_simply/shared/_shipping_and_tax_info.html.erb
|
136
|
+
- config/initializers/add_mime_type.rb
|
129
137
|
- config/routes.rb
|
130
138
|
- lib/nimbleshop_simply/engine.rb
|
131
139
|
- lib/nimbleshop_simply.rb
|
@@ -154,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
162
|
version: '0'
|
155
163
|
segments:
|
156
164
|
- 0
|
157
|
-
hash:
|
165
|
+
hash: 1098292971187762910
|
158
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
167
|
none: false
|
160
168
|
requirements:
|
@@ -163,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
171
|
version: '0'
|
164
172
|
segments:
|
165
173
|
- 0
|
166
|
-
hash:
|
174
|
+
hash: 1098292971187762910
|
167
175
|
requirements: []
|
168
176
|
rubyforge_project:
|
169
177
|
rubygems_version: 1.8.24
|