spree_bootstrap_frontend 1.0.1
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.
- checksums.yaml +15 -0
- data/.gitignore +14 -0
- data/.rspec +1 -0
- data/Gemfile +7 -0
- data/LICENSE +23 -0
- data/README.md +109 -0
- data/Rakefile +15 -0
- data/app/assets/images/store/spree-header.jpg +0 -0
- data/app/assets/images/store/spree.png +0 -0
- data/app/assets/javascripts/spree/backend/spree_bootstrap_frontend.js +1 -0
- data/app/assets/javascripts/spree/frontend/spree_bootstrap_frontend.js +1 -0
- data/app/assets/stylesheets/spree/backend/spree_bootstrap_frontend.css +1 -0
- data/app/assets/stylesheets/spree/frontend/spree_bootstrap_frontend.css.scss +45 -0
- data/app/assets/stylesheets/spree/frontend/spree_frontend.css.scss +5 -0
- data/app/helpers/spree/base_helper_decorator.rb +57 -0
- data/app/helpers/spree/checkout_helper_decorator.rb +30 -0
- data/app/views/spree/address/_form.html.erb +75 -0
- data/app/views/spree/checkout/_address.html.erb +41 -0
- data/app/views/spree/checkout/_confirm.html.erb +13 -0
- data/app/views/spree/checkout/_delivery.html.erb +104 -0
- data/app/views/spree/checkout/_payment.html.erb +35 -0
- data/app/views/spree/checkout/_summary.html.erb +59 -0
- data/app/views/spree/checkout/edit.html.erb +38 -0
- data/app/views/spree/checkout/payment/_gateway.html.erb +32 -0
- data/app/views/spree/checkout/registration.html.erb +29 -0
- data/app/views/spree/layouts/spree_application.html.erb +40 -0
- data/app/views/spree/orders/_form.html.erb +30 -0
- data/app/views/spree/orders/_line_item.html.erb +36 -0
- data/app/views/spree/orders/edit.html.erb +45 -0
- data/app/views/spree/products/_cart_form.html.erb +62 -0
- data/app/views/spree/products/_promotions.html.erb +19 -0
- data/app/views/spree/products/_properties.html.erb +15 -0
- data/app/views/spree/products/_taxons.html.erb +14 -0
- data/app/views/spree/products/_thumbnails.html.erb +19 -0
- data/app/views/spree/products/show.html.erb +51 -0
- data/app/views/spree/shared/_error_messages.html.erb +12 -0
- data/app/views/spree/shared/_filters.html.erb +28 -0
- data/app/views/spree/shared/_footer.html.erb +10 -0
- data/app/views/spree/shared/_head.html.erb +15 -0
- data/app/views/spree/shared/_header.html.erb +13 -0
- data/app/views/spree/shared/_login.html.erb +19 -0
- data/app/views/spree/shared/_login_bar.html.erb +6 -0
- data/app/views/spree/shared/_main_nav_bar.html.erb +10 -0
- data/app/views/spree/shared/_nav_bar.html.erb +8 -0
- data/app/views/spree/shared/_order_details.html.erb +134 -0
- data/app/views/spree/shared/_products.html.erb +39 -0
- data/app/views/spree/shared/_search.html.erb +13 -0
- data/app/views/spree/shared/_sidebar.html.erb +3 -0
- data/app/views/spree/shared/_taxonomies.html.erb +6 -0
- data/app/views/spree/shared/_user_form.html.erb +12 -0
- data/app/views/spree/user_passwords/edit.html.erb +22 -0
- data/app/views/spree/user_passwords/new.html.erb +21 -0
- data/app/views/spree/user_registrations/new.html.erb +22 -0
- data/app/views/spree/user_sessions/new.html.erb +20 -0
- data/app/views/spree/users/edit.html.erb +10 -0
- data/app/views/spree/users/show.html.erb +43 -0
- data/bin/rails +7 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +3 -0
- data/lib/generators/spree_bootstrap_frontend/install/install_generator.rb +33 -0
- data/lib/spree_bootstrap_frontend.rb +3 -0
- data/lib/spree_bootstrap_frontend/engine.rb +24 -0
- data/lib/spree_bootstrap_frontend/factories.rb +6 -0
- data/spec/spec_helper.rb +82 -0
- data/spree_bootstrap_frontend.gemspec +33 -0
- metadata +289 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDM0NmQyYTRmNDIyOTZmYWI1YzhmMjQ0YTk3MGVmMjkwMGFhNDgyYg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NTAwZTExYjdhNjU1N2NkYTU1NjcwOWYzOGY3YTAwZWYzYzUyNTU4YQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZDJiYzMxNTFlYmM0ZjE5ZGFmZGU0NTY2NDM5ZjkwOGJlOTRlNzg5YzRjZmI4
|
10
|
+
NDcwMThiMzc1ZTY5NTUxM2Y4YzU5NjU5ZWRkMWVkZWJhZWYwNTU1MTlkYzkz
|
11
|
+
MzQ2NTIyMzZhN2M1YjVkYzFkZWYwZTg0MjUzZjFhYjc3MGY2OTE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZjFiZmYzNDJkMGFmZTVmNjZkODMxMGFjZjk3OGQ2OTI0MDJkYTFmMjM3MWFk
|
14
|
+
Mjk3ZDkwYjYzYWRkYTA1MmNjMDE1MTQ4YmY0YjA5ODFhZWJiOWYwOGVmODhk
|
15
|
+
N2I5NTNkZDA3ODI3YmZkYzg3NjgxYmE1MDFjMGQ0MzEzOTBhNWI=
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) 2013,
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
8
|
+
list of conditions and the following disclaimer.
|
9
|
+
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice, this
|
11
|
+
list of conditions and the following disclaimer in the documentation and/or
|
12
|
+
other materials provided with the distribution.
|
13
|
+
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
15
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
16
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
17
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
18
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
19
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
20
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
21
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
22
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
23
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
### Switches out Spree’s entire frontend for a bootstrap 3 powered frontend.
|
2
|
+
|
3
|
+
This attempts to stay as closely to the original spree frontend markup as possible, only changing layout class names and adding a few DOM elements where required. Helper decorators have been kept to a bare minimum. It utilises the SCSS port of bootstrap 3 to keep inline with existing spree practices. It also includes support for `spree_auth_devise`.
|
4
|
+
|
5
|
+
Ideally my goal is for this to replace spree’s current frontend. Or at least becoming a viable drop-in alternative. It has several large advantages:
|
6
|
+
|
7
|
+
- Fully responsive - Mobile, tablet and desktop. With custom grids for each, collapsing elements, and full retina display support. Current spree only goes half way.
|
8
|
+
- Just 40 lines of custom SCSS, replacing 1328 lines of undocumented spree CSS. Plus most of these lines only add some visual style to the header and footer and can be removed.
|
9
|
+
- The entire frontend can be easily customized: colours, grid, spacing, etc, by just overriding [variables from bootstrap]() - giving a custom store design in minutes.
|
10
|
+
- Bootstrap has some of the most [robust documentation](http://getbootstrap.com/css) of any framework, and a hugely active community. As this port uses only default bootstrap it means that entire spree frontend layout is documented by default.
|
11
|
+
- Sites like [bootswatch](http://bootswatch.com) allow for one-file bootstrap drop-in spree themes.
|
12
|
+
- Lots of [spree community will for bootstrap](https://groups.google.com/forum/#!searchin/spree-user/bootstrap/spree-user/B17492QdnGA/AF9vEzRzf4cJ).
|
13
|
+
- Though this uses ‘full bootstrap’ for simplicity, you can remove the unused SCSS components you don’t require for minimal file sizes.
|
14
|
+
- Bootstrap is one of the largest most active open source projects out there - maintaining an entire framework just for spree makes little sense. Forget about cross browser bugs. Woo!
|
15
|
+
|
16
|
+

|
17
|
+
|
18
|
+
Installation
|
19
|
+
-------
|
20
|
+
|
21
|
+
**WARNING: The master branch is currently built against spree edge!**
|
22
|
+
|
23
|
+
Add the following to your gemfile
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
gem 'spree_bootstrap_frontend', github: '200Creative/spree_bootstrap_frontend'
|
27
|
+
```
|
28
|
+
|
29
|
+
And run
|
30
|
+
|
31
|
+
```bash
|
32
|
+
bundle install
|
33
|
+
```
|
34
|
+
|
35
|
+
Done.
|
36
|
+
|
37
|
+
If you are running a stable branch of spree check if there is a compatible branch of spree_bootstrap_frontend and use that. For example:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
gem 'spree_bootstrap_frontend', github: '200Creative/spree_bootstrap_frontend', branch: '2-2-stable'
|
41
|
+
```
|
42
|
+
|
43
|
+
Compatibility
|
44
|
+
-------
|
45
|
+
|
46
|
+
**WARNING: The master branch is currently built against spree edge!**
|
47
|
+
|
48
|
+
I’m targeting switching to a stable branch when `2-2-stable` is released, but as of now it's on `2.2.0.beta`. Stay tuned.
|
49
|
+
Currenly only tested against rails 4.0.X.
|
50
|
+
|
51
|
+
Customizing
|
52
|
+
-------
|
53
|
+
|
54
|
+
Copy the `spree_bootstrap_frontend.css.scss` file from `assets/stylesheets/store` into your application and edit as required.
|
55
|
+
|
56
|
+
To style your spree store just override the bootstrap 3 variables. The full list of bootstrap variables can be found [here](http://getbootstrap.com/customize/#less-variables). You can override these by simply redefining the variable before the `@import` directive.
|
57
|
+
For example:
|
58
|
+
|
59
|
+
```scss
|
60
|
+
$navbar-default-bg: #312312;
|
61
|
+
$light-orange: #ff8c00;
|
62
|
+
$navbar-default-color: $light-orange;
|
63
|
+
|
64
|
+
@import "bootstrap";
|
65
|
+
```
|
66
|
+
|
67
|
+
This uses the [bootstrap-sass](https://github.com/thomas-mcdonald/bootstrap-sass) gem. So check there for full cutomization instructions.
|
68
|
+
|
69
|
+
It’s quite powerful, here are some examples created in ~10 minutes with a few extra SCSS variables:
|
70
|
+
|
71
|
+

|
72
|
+
|
73
|
+
Contributing
|
74
|
+
-------
|
75
|
+
|
76
|
+
Please fork and make a pull request.
|
77
|
+
|
78
|
+
**Tests, tests, tests.** Although care has been taken to try and keep HTML changes to a minimum, this plugin currently breaks tests.
|
79
|
+
To get it to a stage that it can be maintained moving forwards getting all tests passing is the highest priority.
|
80
|
+
|
81
|
+
**I’m looking for help maintaining this, so anyone who would like to become a core contributor please email me.** My email is in the gemspec.
|
82
|
+
|
83
|
+
Raise bugs in github’s [issues tracker](https://github.com/200Creative/spree_bootstrap_frontend/issues).
|
84
|
+
|
85
|
+
Further discussion can be had in the [spree google group](https://groups.google.com/forum/#!forum/spree-user).
|
86
|
+
|
87
|
+
|
88
|
+
Running tests
|
89
|
+
-------
|
90
|
+
|
91
|
+
Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.
|
92
|
+
|
93
|
+
```bash
|
94
|
+
bundle
|
95
|
+
bundle exec rake test_app
|
96
|
+
bundle exec rspec spec
|
97
|
+
```
|
98
|
+
|
99
|
+
When testing your applications integration with this extension you may use it's factories.
|
100
|
+
Simply add this require statement to your spec_helper:
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
require 'spree_bootstrap_frontend/factories'
|
104
|
+
```
|
105
|
+
|
106
|
+
Licence
|
107
|
+
-------
|
108
|
+
|
109
|
+
Copyright Alex James ([200creative.com](http://200creative.com)) and released under the BSD Licence.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'spree/testing_support/extension_rake'
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new
|
8
|
+
|
9
|
+
task :default => [:spec]
|
10
|
+
|
11
|
+
desc 'Generates a dummy app for testing'
|
12
|
+
task :test_app do
|
13
|
+
ENV['LIB_NAME'] = 'spree_bootstrap_frontend'
|
14
|
+
Rake::Task['extension:test_app'].invoke
|
15
|
+
end
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
// Placeholder for dummy application
|
@@ -0,0 +1 @@
|
|
1
|
+
// Placeholder for dummy application
|
@@ -0,0 +1 @@
|
|
1
|
+
/* Placeholder for dummy application */
|
@@ -0,0 +1,45 @@
|
|
1
|
+
@import "bootstrap";
|
2
|
+
|
3
|
+
// -- Spree Custom Header and Footer ---------------------
|
4
|
+
#spree-header {
|
5
|
+
background: #1c5c92 asset-url('store/spree-header.jpg') center center;
|
6
|
+
background-size: cover;
|
7
|
+
margin-bottom: $line-height-computed;
|
8
|
+
#header {
|
9
|
+
background: rgba(9, 22, 33, 0.4);
|
10
|
+
padding: $line-height-computed 0;
|
11
|
+
}
|
12
|
+
#logo {
|
13
|
+
margin-bottom: 10px;
|
14
|
+
}
|
15
|
+
.nav a {
|
16
|
+
color: #fff;
|
17
|
+
&:hover {
|
18
|
+
background:rgba(9, 22, 33, 0.4);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
.navbar {
|
22
|
+
border: 0;
|
23
|
+
margin-bottom: 0;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
#spree-footer {
|
27
|
+
background: $gray-dark;
|
28
|
+
padding-top: $padding-base-horizontal;
|
29
|
+
margin-top: $line-height-computed;
|
30
|
+
color: #fff;
|
31
|
+
}
|
32
|
+
|
33
|
+
// -- Spree Layout Custom Rules -------------------------
|
34
|
+
.alert-error { //This is a hack, TODO FIXME
|
35
|
+
.alert-danger{};
|
36
|
+
}
|
37
|
+
.product-body {
|
38
|
+
height: 170px;
|
39
|
+
}
|
40
|
+
.progress-steps {
|
41
|
+
margin-top: $line-height-computed;
|
42
|
+
}
|
43
|
+
h1 {
|
44
|
+
margin-bottom: 30px;
|
45
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
Spree::BaseHelper.module_eval do
|
2
|
+
def link_to_cart(text = nil)
|
3
|
+
return "" if current_spree_page?(spree.cart_path)
|
4
|
+
|
5
|
+
text = text ? h(text) : Spree.t('cart')
|
6
|
+
css_class = nil
|
7
|
+
|
8
|
+
if current_order.nil? or current_order.item_count.zero?
|
9
|
+
text = "<span class='glyphicon glyphicon-shopping-cart'></span> #{text}: (#{Spree.t('empty')})".html_safe
|
10
|
+
css_class = 'empty'
|
11
|
+
else
|
12
|
+
text = "<span class='glyphicon glyphicon-shopping-cart'></span> #{text}: (#{current_order.item_count}) <span class='amount'>#{current_order.display_total.to_html}</span>".html_safe
|
13
|
+
css_class = 'full'
|
14
|
+
end
|
15
|
+
|
16
|
+
link_to text, spree.cart_path, :class => "cart-info #{css_class}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def flash_messages(opts = {})
|
20
|
+
opts[:ignore_types] = [:commerce_tracking].concat(Array(opts[:ignore_types]) || [])
|
21
|
+
|
22
|
+
flash.each do |msg_type, text|
|
23
|
+
unless opts[:ignore_types].include?(msg_type)
|
24
|
+
concat(content_tag :div, text, class: "alert alert-#{msg_type}")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
|
30
|
+
def taxons_tree(root_taxon, current_taxon, max_level = 1)
|
31
|
+
return '' if max_level < 1 || root_taxon.children.empty?
|
32
|
+
content_tag :ul, class: 'list-group' do
|
33
|
+
root_taxon.children.map do |taxon|
|
34
|
+
css_class = (current_taxon && current_taxon.self_and_ancestors.include?(taxon)) ? 'list-group-item current' : 'list-group-item'
|
35
|
+
content_tag :li, class: css_class do
|
36
|
+
link_to(taxon.name, seo_url(taxon)) +
|
37
|
+
taxons_tree(taxon, current_taxon, max_level - 1)
|
38
|
+
end
|
39
|
+
end.join("\n").html_safe
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def breadcrumbs(taxon, separator=" ")
|
44
|
+
return "" if current_page?("/") || taxon.nil?
|
45
|
+
separator = raw(separator)
|
46
|
+
crumbs = [content_tag(:li, link_to(Spree.t(:home), spree.root_path) + separator)]
|
47
|
+
if taxon
|
48
|
+
crumbs << content_tag(:li, link_to(Spree.t(:products), products_path) + separator)
|
49
|
+
crumbs << taxon.ancestors.collect { |ancestor| content_tag(:li, link_to(ancestor.name , seo_url(ancestor)) + separator) } unless taxon.ancestors.empty?
|
50
|
+
crumbs << content_tag(:li, content_tag(:span, link_to(taxon.name , seo_url(taxon))))
|
51
|
+
else
|
52
|
+
crumbs << content_tag(:li, content_tag(:span, Spree.t(:products)))
|
53
|
+
end
|
54
|
+
crumb_list = content_tag(:ol, raw(crumbs.flatten.map{|li| li.mb_chars}.join), class: 'breadcrumb')
|
55
|
+
content_tag(:nav, crumb_list, id: 'breadcrumbs', class: 'col-md-12')
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Spree::CheckoutHelper.module_eval do
|
2
|
+
def checkout_progress
|
3
|
+
states = checkout_states
|
4
|
+
items = states.map do |state|
|
5
|
+
text = Spree.t("order_state.#{state}").titleize
|
6
|
+
|
7
|
+
css_classes = []
|
8
|
+
current_index = states.index(@order.state)
|
9
|
+
state_index = states.index(state)
|
10
|
+
|
11
|
+
if state_index < current_index
|
12
|
+
css_classes << 'completed'
|
13
|
+
text = link_to text, checkout_state_path(state)
|
14
|
+
end
|
15
|
+
|
16
|
+
css_classes << 'next' if state_index == current_index + 1
|
17
|
+
css_classes << 'active' if state == @order.state
|
18
|
+
css_classes << 'first' if state_index == 0
|
19
|
+
css_classes << 'last' if state_index == states.length - 1
|
20
|
+
# No more joined classes. IE6 is not a target browser.
|
21
|
+
# Hack: Stops <a> being wrapped round previous items twice.
|
22
|
+
if state_index < current_index
|
23
|
+
content_tag('li', text, class: css_classes.join(' '))
|
24
|
+
else
|
25
|
+
content_tag('li', content_tag('a', text), class: css_classes.join(' '))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
content_tag('ul', raw(items.join("\n")), class: 'progress-steps nav nav-pills nav-justified', id: "checkout-step-#{@order.state}")
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
<% address_id = address_type.chars.first %>
|
2
|
+
<div class="inner" data-hook=<%="#{address_type}_inner" %>>
|
3
|
+
<p class="field" id=<%="#{address_id}firstname" %>>
|
4
|
+
<%= form.label :firstname, Spree.t(:first_name) %><span class="required">*</span><br />
|
5
|
+
<%= form.text_field :firstname, :class => 'form-control required' %>
|
6
|
+
</p>
|
7
|
+
<p class="field" id=<%="#{address_id}lastname" %>>
|
8
|
+
<%= form.label :lastname, Spree.t(:last_name) %><span class="required">*</span><br />
|
9
|
+
<%= form.text_field :lastname, :class => 'form-control required' %>
|
10
|
+
</p>
|
11
|
+
<% if Spree::Config[:company] %>
|
12
|
+
<p class="field" id=<%="#{address_id}company" %>>
|
13
|
+
<%= form.label :company, Spree.t(:company) %><br />
|
14
|
+
<%= form.text_field :company, :class => 'form-control' %>
|
15
|
+
</p>
|
16
|
+
<% end %>
|
17
|
+
<p class="field" id=<%="#{address_id}address1" %>>
|
18
|
+
<%= form.label :address1, Spree.t(:street_address) %><span class="required">*</span><br />
|
19
|
+
<%= form.text_field :address1, :class => 'form-control required' %>
|
20
|
+
</p>
|
21
|
+
<p class="field" id=<%="#{address_id}address2" %>>
|
22
|
+
<%= form.label :address2, Spree.t(:street_address_2) %><br />
|
23
|
+
<%= form.text_field :address2, :class => 'form-control' %>
|
24
|
+
</p>
|
25
|
+
<p class="field" id=<%="#{address_id}city" %>>
|
26
|
+
<%= form.label :city, Spree.t(:city) %><span class="required">*</span><br />
|
27
|
+
<%= form.text_field :city, :class => 'form-control required' %>
|
28
|
+
</p>
|
29
|
+
<p class="field" id=<%="#{address_id}country" %>>
|
30
|
+
<%= form.label :country_id, Spree.t(:country) %><span class="required">*</span><br />
|
31
|
+
<span id=<%="#{address_id}country-selection" %>>
|
32
|
+
<%= form.collection_select :country_id, available_countries, :id, :name, {}, {:class => 'form-control required'} %>
|
33
|
+
</span>
|
34
|
+
</p>
|
35
|
+
|
36
|
+
<% if Spree::Config[:address_requires_state] %>
|
37
|
+
<p class="field" id=<%="#{address_id}state" %>>
|
38
|
+
<% have_states = !address.country.states.empty? %>
|
39
|
+
<%= form.label :state, Spree.t(:state) %><span class='required' id=<%="#{address_id}state-required"%>>*</span><br/>
|
40
|
+
|
41
|
+
<% state_elements = [
|
42
|
+
form.collection_select(:state_id, address.country.states,
|
43
|
+
:id, :name,
|
44
|
+
{:include_blank => true},
|
45
|
+
{:class => have_states ? 'form-control required' : 'form-control hidden',
|
46
|
+
:disabled => !have_states}) +
|
47
|
+
form.text_field(:state_name,
|
48
|
+
:class => !have_states ? 'form-control required' : 'form-control hidden',
|
49
|
+
:disabled => have_states)
|
50
|
+
].join.gsub('"', "'").gsub("\n", "")
|
51
|
+
%>
|
52
|
+
<%= javascript_tag do -%>
|
53
|
+
$('#<%="#{address_id}state" %>').append("<%== state_elements %>");
|
54
|
+
<% end %>
|
55
|
+
</p>
|
56
|
+
<noscript>
|
57
|
+
<%= form.text_field :state_name, :class => 'form-control required' %>
|
58
|
+
</noscript>
|
59
|
+
<% end %>
|
60
|
+
|
61
|
+
<p class="field" id=<%="#{address_id}zipcode" %>>
|
62
|
+
<%= form.label :zipcode, Spree.t(:zip) %><span class="required">*</span><br />
|
63
|
+
<%= form.text_field :zipcode, :class => 'form-control required' %>
|
64
|
+
</p>
|
65
|
+
<p class="field" id=<%="#{address_id}phone" %>>
|
66
|
+
<%= form.label :phone, Spree.t(:phone) %><span class="required">*</span><br />
|
67
|
+
<%= form.phone_field :phone, :class => 'form-control required' %>
|
68
|
+
</p>
|
69
|
+
<% if Spree::Config[:alternative_shipping_phone] %>
|
70
|
+
<p class="field" id=<%="#{address_id}altphone" %>>
|
71
|
+
<%= form.label :alternative_phone, Spree.t(:alternative_phone) %><br />
|
72
|
+
<%= form.phone_field :alternative_phone, :class => 'form-control' %>
|
73
|
+
</p>
|
74
|
+
<% end %>
|
75
|
+
</div>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="col-sm-6" data-hook="billing_fieldset_wrapper">
|
3
|
+
<div class="panel panel-default" id="billing" data-hook>
|
4
|
+
<%= form.fields_for :bill_address do |bill_form| %>
|
5
|
+
<div class="panel-heading">
|
6
|
+
<h3 class="panel-title"><%= Spree.t(:billing_address) %></h3>
|
7
|
+
</div>
|
8
|
+
<div class="panel-body">
|
9
|
+
<%= render :partial => 'spree/address/form', :locals => { :form => bill_form, :address_type => 'billing', :address => @order.bill_address } %>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="col-sm-6" data-hook="shipping_fieldset_wrapper">
|
16
|
+
<div class="panel panel-default" id="shipping" data-hook>
|
17
|
+
<%= form.fields_for :ship_address do |ship_form| %>
|
18
|
+
<div class="panel-heading">
|
19
|
+
<h3 class="panel-title"><%= Spree.t(:shipping_address) %></h3>
|
20
|
+
</div>
|
21
|
+
<div class="panel-body">
|
22
|
+
<p class="field checkbox" data-hook="use_billing">
|
23
|
+
<%= check_box_tag 'order[use_billing]', '1', @order.shipping_eq_billing_address? %>
|
24
|
+
<%= label_tag :order_use_billing, Spree.t(:use_billing_address), :id => 'use_billing' %>
|
25
|
+
</p>
|
26
|
+
<%= render :partial => 'spree/address/form', :locals => { :form => ship_form, :address_type => 'shipping', :address => @order.ship_address } %>
|
27
|
+
</div>
|
28
|
+
<% end %>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<div class="well text-right form-buttons" data-hook="buttons">
|
34
|
+
<%= submit_tag Spree.t(:save_and_continue), :class => 'btn btn-lg btn-success' %>
|
35
|
+
|
36
|
+
<span data-hook="save_user_address">
|
37
|
+
|
38
|
+
<%= check_box_tag 'save_user_address', '1', try_spree_current_user.respond_to?(:persist_order_address) %>
|
39
|
+
<%= label_tag :save_user_address, Spree.t(:save_my_address) %>
|
40
|
+
</span>
|
41
|
+
</div>
|