spree_zoned 0.5.31 → 0.5.32
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/stylesheets/store/spree_zoned.css +2 -0
- data/app/controllers/spree/zoned_controller.rb +9 -2
- data/app/helpers/spree/base_helper_decorator.rb +1 -1
- data/app/models/spree/order_decorator.rb +2 -1
- data/app/overrides/replace_billing.rb +1 -1
- data/app/views/spree/zoned/_billing.html.erb +93 -81
- data/config/initializers/zoned_init.rb +3 -3
- data/config/locales/{nl-NL.yml → nl.yml} +1 -1
- data/spree_zoned.gemspec +1 -1
- metadata +3 -3
@@ -2,14 +2,21 @@ module Spree
|
|
2
2
|
class ZonedController < BaseController
|
3
3
|
|
4
4
|
def availLangs(country)
|
5
|
-
Rails.configuration.availableLanguages[country] || ["English",
|
5
|
+
Rails.configuration.availableLanguages[country] || [["English", :en]]
|
6
6
|
end
|
7
7
|
|
8
8
|
def setcountry
|
9
9
|
respond_to do |format|
|
10
10
|
format.js do
|
11
|
+
if params[:order] && params[:order][:bill_address_attributes] && params[:order][:bill_address_attributes][:country_id]
|
12
|
+
i = params[:order][:bill_address_attributes][:country_id].to_i.abs
|
13
|
+
else
|
14
|
+
i = params[:id].to_i.abs
|
15
|
+
end
|
16
|
+
i = -i if (Rails.application.config.commonCountriesForSelect.map { |a| a[1] }).include? -i
|
17
|
+
i = i.to_s
|
11
18
|
session[:zoned] ||= {}
|
12
|
-
c = session[:zoned][:current_country] =
|
19
|
+
c = session[:zoned][:current_country] = i
|
13
20
|
c = c.to_i
|
14
21
|
session[:zoned][:current_language] = (availLangs(c) && availLangs(c)[0][1]) || "en"
|
15
22
|
end
|
@@ -17,88 +17,100 @@ $(document).ready(function() {
|
|
17
17
|
});
|
18
18
|
});
|
19
19
|
</script>
|
20
|
-
<
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
<p class="field" id="baddress2">
|
43
|
-
<%= bill_form.label :address2, t(:street_address_2) %><br />
|
44
|
-
<%= bill_form.text_field :address2 %>
|
45
|
-
</p>
|
20
|
+
<p class="field" id="bfirstname">
|
21
|
+
<%= bill_form.label :firstname, t(:first_name) %><span class="req">*</span><br />
|
22
|
+
<%= bill_form.text_field :firstname, :class => 'required' %>
|
23
|
+
</p>
|
24
|
+
<p class="field" id="blastname">
|
25
|
+
<%= bill_form.label :lastname, t(:last_name) %><span class="req">*</span><br />
|
26
|
+
<%= bill_form.text_field :lastname, :class => 'required' %>
|
27
|
+
</p>
|
28
|
+
<% if Spree::Config[:company] %>
|
29
|
+
<p class="field" id="bcompany">
|
30
|
+
<%= bill_form.label :company, t(:company) %><br />
|
31
|
+
<%= bill_form.text_field :company %>
|
32
|
+
</p>
|
33
|
+
<% end %>
|
34
|
+
<p class="field" id="baddress1">
|
35
|
+
<%= bill_form.label :address1, t(:street_address) %><span class="req">*</span><br />
|
36
|
+
<%= bill_form.text_field :address1, :class => 'required' %>
|
37
|
+
</p>
|
38
|
+
<p class="field" id="baddress2">
|
39
|
+
<%= bill_form.label :address2, t(:street_address_2) %><br />
|
40
|
+
<%= bill_form.text_field :address2 %>
|
41
|
+
</p>
|
46
42
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
43
|
+
<p class="field" id="bcity">
|
44
|
+
<%= bill_form.label :city, t(:city) %><span class="req">*</span><br />
|
45
|
+
<%= bill_form.text_field :city, :class => 'required' %>
|
46
|
+
</p>
|
51
47
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
48
|
+
<p class="field" id="bcountry">
|
49
|
+
<%= bill_form.label :country_id, t(:country) %><span class="req">*</span><br />
|
50
|
+
<span id="bcountry">
|
51
|
+
<%
|
52
|
+
c = session[:zoned]
|
53
|
+
c = session[:zoned][:current_country] if c
|
54
|
+
c = c.to_i.abs.to_s if c
|
55
|
+
c ||= "214"
|
56
|
+
%>
|
57
|
+
<%= bill_form.collection_select :country_id, available_countries, :id, :name,
|
58
|
+
{:selected => c},
|
59
|
+
{
|
60
|
+
:class => 'required',
|
61
|
+
:data => {
|
62
|
+
:remote => true,
|
63
|
+
:url => url_for(
|
64
|
+
:controller => "zoned",
|
65
|
+
:action => "setcountry",
|
66
|
+
),
|
67
|
+
}
|
68
|
+
}
|
69
|
+
-%>
|
70
|
+
</span>
|
71
|
+
</p>
|
58
72
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
73
|
+
<% if c.to_i == 214 && Spree::Config[:address_requires_state] %>
|
74
|
+
<p class="field" id="bstate">
|
75
|
+
<% co = Spree::Country.find(c.to_i) %>
|
76
|
+
<% have_states = !co.states.empty? %>
|
77
|
+
<%= bill_form.label :state, t(:state) %><span class="req">*</span><br />
|
78
|
+
<noscript>
|
79
|
+
<%= bill_form.text_field :state_name, :class => 'required' %>
|
80
|
+
</noscript>
|
81
|
+
<% state_elements = [
|
82
|
+
bill_form.collection_select(:state_id, co.states,
|
83
|
+
:id, :name,
|
84
|
+
{:include_blank => true},
|
85
|
+
{:class => have_states ? 'required' : 'hidden',
|
86
|
+
:disabled => !have_states}) +
|
87
|
+
bill_form.text_field(:state_name,
|
88
|
+
:class => !have_states ? 'required' : 'hidden',
|
89
|
+
:disabled => have_states)
|
90
|
+
].join.gsub('"', "'").gsub("\n", "")
|
91
|
+
%>
|
92
|
+
<%= javascript_tag do -%>
|
93
|
+
document.write("<%== state_elements %>");
|
94
|
+
<% end -%>
|
95
|
+
</p>
|
96
|
+
<% end %>
|
82
97
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
<% end %>
|
103
|
-
</fieldset>
|
104
|
-
</div>
|
98
|
+
<p class="field" id="bzipcode">
|
99
|
+
<%= bill_form.label :zipcode, t(:zip) %><span class="req">*</span><br />
|
100
|
+
<%= bill_form.text_field :zipcode, :class => 'required' %>
|
101
|
+
</p>
|
102
|
+
<p class="field" id="bphone">
|
103
|
+
<%= bill_form.label :phone, t(:phone) %><span class="req">*</span><br />
|
104
|
+
<%= bill_form.text_field :phone, :class => 'required' %>
|
105
|
+
</p>
|
106
|
+
<% if Spree::Config[:alternative_billing_phone] %>
|
107
|
+
<p class="field" id="baltphone">
|
108
|
+
<%= bill_form.label :alternative_phone, t(:alternative_phone) %><br />
|
109
|
+
<%= bill_form.text_field :alternative_phone %>
|
110
|
+
</p>
|
111
|
+
<% end %>
|
112
|
+
<p class="field checkbox" id="bterms">
|
113
|
+
<%= label_tag :order_accept, "#{t(:iaccept)}", :id => 'accept' -%>
|
114
|
+
<a id="opentos" href=""><%= t(:terms) -%></a><span class="req">*</span><br />
|
115
|
+
<%= check_box_tag "order[accept]", '1', false, :class => 'required' %>
|
116
|
+
</p>
|
@@ -28,9 +28,9 @@ ZONED_COMMON_LOCALES =
|
|
28
28
|
-74 => [:de, :en], # Germany
|
29
29
|
-13 => [:de, :en], # Austria
|
30
30
|
-195 => [:de, :en], # Switzerland
|
31
|
-
-142 => [:
|
32
|
-
-20 => [:
|
33
|
-
-117 => [:de, :en, :
|
31
|
+
-142 => [:nl, :en], # Netherlands
|
32
|
+
-20 => [:nl, :de, :en], # Belgium
|
33
|
+
-117 => [:de, :en, :nl], # Luxembourg
|
34
34
|
}
|
35
35
|
|
36
36
|
Rails.configuration.commonCountriesForSelect = ZONED_COMMON_COUNTRIES.map do |id|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Sample localization file for Dutch. Add more files in this directory for other locales.
|
2
2
|
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
3
|
---
|
4
|
-
nl
|
4
|
+
nl:
|
5
5
|
nocountrysel: "Geen land"
|
6
6
|
deletefc: "Verwijderen van dit land"
|
7
7
|
backtocountry: "Terug naar dit land"
|
data/spree_zoned.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.platform = Gem::Platform::RUBY
|
4
4
|
s.name = 'spree_zoned'
|
5
|
-
s.version = '0.5.
|
5
|
+
s.version = '0.5.32'
|
6
6
|
s.summary = 'A Spree extension to make your store zoned'
|
7
7
|
s.description = "Everything you need for a zoned Spree store: zoned pricing, zoned products, zoned product ordering, zoned locales, ...\nProbalbly essential to you if you operate outside of the US."
|
8
8
|
s.required_ruby_version = '>= 1.9.2'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_zoned
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.32
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spree_core
|
@@ -162,7 +162,7 @@ files:
|
|
162
162
|
- config/initializers/zoned_init.rb
|
163
163
|
- config/locales/de.yml
|
164
164
|
- config/locales/en.yml
|
165
|
-
- config/locales/nl
|
165
|
+
- config/locales/nl.yml
|
166
166
|
- config/routes.rb
|
167
167
|
- db/migrate/20120611133806_create_spree_zoned_products.rb
|
168
168
|
- db/migrate/20120630201058_add_cprice_to_spree_zoned_products.rb
|