comable_frontend 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/Rakefile +16 -4
- data/app/assets/javascripts/comable/frontend/application.coffee +5 -0
- data/app/assets/stylesheets/comable/frontend/application.scss +434 -0
- data/app/assets/stylesheets/comable/frontend/products.scss +0 -0
- data/app/assets/stylesheets/comable/products.scss +0 -0
- data/app/controllers/comable/application_controller.rb +2 -0
- data/app/controllers/comable/carts_controller.rb +32 -17
- data/app/controllers/comable/customers_controller.rb +5 -5
- data/app/controllers/comable/orders_controller.rb +31 -71
- data/app/controllers/comable/products_controller.rb +15 -1
- data/app/controllers/concerns/comable/payment_action.rb +3 -13
- data/app/controllers/concerns/comable/shipment_action.rb +2 -12
- data/app/controllers/concerns/comable/signin_action.rb +55 -0
- data/app/views/comable/carts/show.slim +65 -20
- data/app/views/comable/customers/_address.slim +7 -7
- data/app/views/comable/customers/addresses.slim +31 -29
- data/app/views/comable/customers/show.slim +60 -2
- data/app/views/comable/orders/confirm.slim +73 -30
- data/app/views/comable/orders/create.slim +6 -4
- data/app/views/comable/orders/delivery.slim +23 -14
- data/app/views/comable/orders/orderer.slim +38 -20
- data/app/views/comable/orders/payment.slim +12 -11
- data/app/views/comable/orders/shipment.slim +12 -10
- data/app/views/comable/orders/signin.slim +22 -0
- data/app/views/comable/products/index.slim +30 -10
- data/app/views/comable/products/show.slim +89 -21
- data/app/views/comable/shared/_address.slim +13 -20
- data/app/views/comable/shared/_address_form.slim +33 -15
- data/app/views/comable/shared/_footer.slim +2 -0
- data/app/views/comable/shared/_header.slim +74 -0
- data/app/views/comable/shared/_header_for_checkout.slim +18 -0
- data/app/views/kaminari/comable_frontend/_gap.html.slim +2 -0
- data/app/views/kaminari/comable_frontend/_next_page.html.slim +7 -0
- data/app/views/kaminari/comable_frontend/_page.html.slim +3 -0
- data/app/views/kaminari/comable_frontend/_paginator.html.slim +11 -0
- data/app/views/kaminari/comable_frontend/_prev_page.html.slim +7 -0
- data/app/views/layouts/comable/application.slim +23 -14
- data/config/routes.rb +9 -12
- data/lib/comable/frontend/engine.rb +8 -0
- metadata +151 -7
- data/app/controllers/concerns/comable/permitted_attributes.rb +0 -15
- data/app/views/comable/orders/new.slim +0 -4
@@ -1,11 +1,13 @@
|
|
1
|
-
|
1
|
+
#comable-order
|
2
|
+
.comable-shipment
|
3
|
+
h1
|
4
|
+
= @order.class.human_state_name(:shipment)
|
2
5
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
= f.submit
|
6
|
+
= form_for @order, as: :order, url: update_order_path, method: :put do |f|
|
7
|
+
ul
|
8
|
+
- Comable::ShipmentMethod.activated.each.with_index do |shipment_method, index|
|
9
|
+
li
|
10
|
+
- checked_flag = @order.shipment_method ? (@order.shipment_method.id == shipment_method.id) : index.zero?
|
11
|
+
= f.radio_button :shipment_method_id, shipment_method.id, checked: checked_flag
|
12
|
+
= f.label :shipment_method_id, shipment_method.name, value: shipment_method.id
|
13
|
+
= f.submit Comable.t('next_step')
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#comable-order
|
2
|
+
.comable-signin
|
3
|
+
/ TODO: Standardize
|
4
|
+
- if @order.errors.any?
|
5
|
+
.error_messages
|
6
|
+
ul
|
7
|
+
- @order.errors.full_messages.each do |full_message|
|
8
|
+
li = full_message
|
9
|
+
|
10
|
+
section.col-sm-6
|
11
|
+
= render file: 'devise/sessions/new'
|
12
|
+
|
13
|
+
section.col-sm-6
|
14
|
+
h2
|
15
|
+
= Comable.t('guest')
|
16
|
+
= form_for @order, as: :order, url: comable.guest_order_path, method: :put do |f|
|
17
|
+
.form-group
|
18
|
+
.col-sm-2.control-label
|
19
|
+
= f.label :email
|
20
|
+
.col-sm-10
|
21
|
+
= f.email_field :email, placeholder: @order.class.human_attribute_name(:email)
|
22
|
+
= f.submit Comable.t('guest_order'), class: 'btn btn-default'
|
@@ -1,11 +1,31 @@
|
|
1
|
-
|
1
|
+
#comable-product
|
2
|
+
- if @category
|
3
|
+
.row
|
4
|
+
= listed_categories @category.path, tag: :ol, class: 'breadcrumb'
|
2
5
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
=
|
10
|
-
|
11
|
-
=
|
6
|
+
.row
|
7
|
+
.category.col-sm-2
|
8
|
+
h2
|
9
|
+
= Comable.t('category')
|
10
|
+
- if @category
|
11
|
+
= listed_categories @category.path, class: 'category-path'
|
12
|
+
= listed_categories @category.children
|
13
|
+
- else
|
14
|
+
= listed_categories Comable::Category.roots
|
15
|
+
|
16
|
+
.products.col-sm-10
|
17
|
+
- @products.each_slice(3) do |products|
|
18
|
+
ul.row
|
19
|
+
- products.each do |product|
|
20
|
+
li.product.col-sm-4
|
21
|
+
= link_to comable.product_path(product), class: 'thumbnail' do
|
22
|
+
= image_tag product.image_url, width: '100%'
|
23
|
+
.name
|
24
|
+
= link_to product.name, comable.product_path(product)
|
25
|
+
.caption
|
26
|
+
= product.caption
|
27
|
+
.price
|
28
|
+
= number_to_currency product.price
|
29
|
+
|
30
|
+
.text-center
|
31
|
+
= paginate @products, theme: :comable_frontend
|
@@ -1,21 +1,89 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
#comable-product
|
2
|
+
.row
|
3
|
+
ol.breadcrumb
|
4
|
+
- if @product.categories.any?
|
5
|
+
- @product.categories.first.path.each do |category|
|
6
|
+
li = link_to category.name, comable.products_path(category_id: category.id)
|
7
|
+
li.active
|
8
|
+
= @product.name
|
9
|
+
|
10
|
+
.row
|
11
|
+
.images.col-sm-6
|
12
|
+
- if @product.images.any?
|
13
|
+
.image
|
14
|
+
= link_to @product.image_url, class: 'thumbnail' do
|
15
|
+
= image_tag @product.image_url, width: '100%'
|
16
|
+
.row
|
17
|
+
- (@product.images - [@product.images.first]).each do |image|
|
18
|
+
.image.col-sm-4
|
19
|
+
= link_to image.url, class: 'thumbnail' do
|
20
|
+
= image_tag image.url, width: '100%'
|
21
|
+
- else
|
22
|
+
.thumbnail
|
23
|
+
.image = image_tag @product.image_url, width: '100%'
|
24
|
+
|
25
|
+
.text.col-sm-6
|
26
|
+
h1.name
|
27
|
+
= @product.name
|
28
|
+
small< = @product.code
|
29
|
+
.caption
|
30
|
+
= @product.caption
|
31
|
+
.price
|
32
|
+
= number_to_currency @product.price
|
33
|
+
|
34
|
+
= form_tag comable.add_cart_path do
|
35
|
+
- if @product.sku?
|
36
|
+
.sku
|
37
|
+
= sku_table @product
|
38
|
+
|
39
|
+
- if @product.unsold?
|
40
|
+
.add_cart.form-inline.form-group
|
41
|
+
= hidden_field_tag :product_id, @product.id
|
42
|
+
= select_tag :quantity, options_for_select(1.upto(10).to_a)
|
43
|
+
= submit_tag Comable.t('add_to_cart')
|
44
|
+
- else
|
45
|
+
.sold_out
|
46
|
+
= Comable.t('soldout')
|
47
|
+
|
48
|
+
- if @product.categories.any?
|
49
|
+
.row
|
50
|
+
h2
|
51
|
+
= Comable.t('browse_related_products')
|
52
|
+
ul
|
53
|
+
- @product.categories.each do |category|
|
54
|
+
li = listed_categories category.path, class: 'category-breadcrumb'
|
55
|
+
|
56
|
+
#comable-image-dialog
|
57
|
+
coffee:
|
58
|
+
jQuery( ->
|
59
|
+
$('#comable-product .images .image a').click((event) ->
|
60
|
+
# Disable this event on smartphone
|
61
|
+
return if $(window).width() <= 768
|
62
|
+
|
63
|
+
event.preventDefault()
|
64
|
+
|
65
|
+
image = $(this).find('img')[0]
|
66
|
+
return if image.length == 0
|
67
|
+
|
68
|
+
$('body').addClass('stop-scrolling')
|
69
|
+
|
70
|
+
image_clone = $(image).clone().css(width: 'auto', height: 'auto')
|
71
|
+
|
72
|
+
$('#comable-image-dialog').html(image_clone).dialog(
|
73
|
+
modal: true,
|
74
|
+
resizable: false,
|
75
|
+
width: $(window).width(),
|
76
|
+
height: $(window).height(),
|
77
|
+
dialogClass: 'without-titlebar',
|
78
|
+
close: -> $('body').removeClass('stop-scrolling')
|
79
|
+
)
|
80
|
+
)
|
81
|
+
|
82
|
+
$('#comable-image-dialog').click( ->
|
83
|
+
$(this).dialog('close')
|
84
|
+
);
|
85
|
+
|
86
|
+
$(document).on('click', '.ui-widget-overlay', ->
|
87
|
+
$('#comable-image-dialog').dialog('close')
|
88
|
+
);
|
89
|
+
)
|
@@ -1,20 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
.city
|
15
|
-
dt = address.class.human_attribute_name(:city)
|
16
|
-
dd = address.city
|
17
|
-
.other
|
18
|
-
.phone_number
|
19
|
-
dt = address.class.human_attribute_name(:phone_number)
|
20
|
-
dd = address.phone_number
|
1
|
+
.comable-full_name
|
2
|
+
strong
|
3
|
+
= address.full_name
|
4
|
+
.comable-zip_code
|
5
|
+
= address.zip_code
|
6
|
+
.comable-address1
|
7
|
+
= address.state_name
|
8
|
+
= address.city
|
9
|
+
.comable-address2
|
10
|
+
= address.detail
|
11
|
+
.comable-phone_number
|
12
|
+
= "#{address.class.human_attribute_name(:phone_number)}: "
|
13
|
+
= address.phone_number
|
@@ -1,21 +1,39 @@
|
|
1
|
-
.name
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
.form-group.comable-name
|
2
|
+
.col-sm-2.control-label
|
3
|
+
= address.label :full_name
|
4
|
+
.col-sm-10
|
5
|
+
.row
|
6
|
+
.col-sm-6
|
7
|
+
= address.text_field :family_name, placeholder: address.object.class.human_attribute_name(:family_name)
|
8
|
+
.col-sm-6
|
9
|
+
= address.text_field :first_name, placeholder: address.object.class.human_attribute_name(:first_name)
|
6
10
|
|
7
|
-
.
|
8
|
-
.
|
11
|
+
.form-group.comable-state_name
|
12
|
+
.col-sm-2.control-label
|
9
13
|
= address.label :state_name
|
10
|
-
|
11
|
-
|
14
|
+
.col-sm-10
|
15
|
+
= address.text_field :state_name, placeholder: address.object.class.human_attribute_name(:state_name)
|
16
|
+
|
17
|
+
.form-group.comable-zip_code
|
18
|
+
.col-sm-2.control-label
|
12
19
|
= address.label :zip_code
|
13
|
-
|
14
|
-
|
20
|
+
.col-sm-10
|
21
|
+
= address.text_field :zip_code, max_length: 8, placeholder: address.object.class.human_attribute_name(:zip_code)
|
22
|
+
|
23
|
+
.form-group.comable-city
|
24
|
+
.col-sm-2.control-label
|
15
25
|
= address.label :city
|
16
|
-
|
26
|
+
.col-sm-10
|
27
|
+
= address.text_field :city, placeholder: address.object.class.human_attribute_name(:city)
|
28
|
+
|
29
|
+
.form-group.comable-detail
|
30
|
+
.col-sm-2.control-label
|
31
|
+
= address.label :detail
|
32
|
+
.col-sm-10
|
33
|
+
= address.text_field :detail, placeholder: address.object.class.human_attribute_name(:detail)
|
17
34
|
|
18
|
-
.
|
19
|
-
.
|
35
|
+
.form-group.phone_number
|
36
|
+
.col-sm-2.control-label
|
20
37
|
= address.label :phone_number
|
21
|
-
|
38
|
+
.col-sm-10
|
39
|
+
= address.text_field :phone_number, max_length: 18, placeholder: address.object.class.human_attribute_name(:phone_number)
|
@@ -0,0 +1,74 @@
|
|
1
|
+
header
|
2
|
+
nav.navbar.navbar-default role="navigation"
|
3
|
+
.comable-navbar-top
|
4
|
+
.container
|
5
|
+
/! Collect the nav links, forms, and other content for toggling
|
6
|
+
#bs-example-navbar-collapse-1.collapse.navbar-collapse
|
7
|
+
ul.nav.navbar-nav
|
8
|
+
li
|
9
|
+
p.navbar-text
|
10
|
+
| descriptions
|
11
|
+
ul.nav.navbar-nav.navbar-right
|
12
|
+
li
|
13
|
+
= link_to Comable.t('my_account'), comable.customer_path
|
14
|
+
li
|
15
|
+
- if current_customer.signed_in?
|
16
|
+
= link_to comable.destroy_customer_session_path, method: :delete do
|
17
|
+
i.glyphicon.glyphicon-log-out>
|
18
|
+
= Comable.t('sign_out')
|
19
|
+
- else
|
20
|
+
= link_to comable.new_customer_session_path do
|
21
|
+
i.glyphicon.glyphicon-log-in>
|
22
|
+
= Comable.t('sign_in')
|
23
|
+
.container
|
24
|
+
/! Brand and toggle get grouped for better mobile display
|
25
|
+
.navbar-header
|
26
|
+
button.navbar-toggle.collapsed data-target="#bs-example-navbar-collapse-1" data-toggle="collapse" type="button"
|
27
|
+
span.sr-only Toggle navigation
|
28
|
+
span.icon-bar
|
29
|
+
span.icon-bar
|
30
|
+
span.icon-bar
|
31
|
+
= link_to current_store.name, comable.root_path, class: 'navbar-brand'
|
32
|
+
/! Collect the nav links, forms, and other content for toggling
|
33
|
+
#bs-example-navbar-collapse-1.collapse.navbar-collapse
|
34
|
+
ul.nav.navbar-nav
|
35
|
+
li.dropdown.menu-large
|
36
|
+
= link_to comable.products_path, class: 'dropdown-toggle', role: 'button', 'aria-expanded' => 'false' do
|
37
|
+
= Comable.t('category')
|
38
|
+
span.caret<
|
39
|
+
ul.dropdown-menu.megamenu.row
|
40
|
+
- Comable::Category.roots.each do |category|
|
41
|
+
li.col-sm-3
|
42
|
+
ul
|
43
|
+
li.dropdown-header
|
44
|
+
= category.name
|
45
|
+
- category.children.each do |child|
|
46
|
+
li = link_to_category child, force_link: true
|
47
|
+
ul.nav.navbar-nav.navbar-right
|
48
|
+
li.dropdown
|
49
|
+
= link_to comable.cart_path, class: 'dropdown-toggle', role: 'button', 'aria-expanded' => 'false' do
|
50
|
+
i.glyphicon.glyphicon-shopping-cart>
|
51
|
+
span
|
52
|
+
= Comable.t('cart')
|
53
|
+
span<
|
54
|
+
| (#{current_customer.cart.size})
|
55
|
+
span.caret<
|
56
|
+
ul.dropdown-menu.comable-mini-cart role="menu"
|
57
|
+
- current_customer.cart.take(5).each do |cart_item|
|
58
|
+
li
|
59
|
+
= link_to comable.product_path(cart_item.product) do
|
60
|
+
.comable-image
|
61
|
+
= image_tag cart_item.product.image_url, width: '100%'
|
62
|
+
.comable-name
|
63
|
+
= cart_item.name_with_sku
|
64
|
+
.comable-quantity
|
65
|
+
= "#{cart_item.class.human_attribute_name(:quantity)}: "
|
66
|
+
= cart_item.quantity
|
67
|
+
li.comable-show-cart
|
68
|
+
= link_to Comable.t('show_cart'), comable.cart_path
|
69
|
+
= form_tag comable.products_path, method: :get, class: 'navbar-form' do
|
70
|
+
.form-group
|
71
|
+
.input-group
|
72
|
+
= text_field_tag :q, params[:q], class: 'form-control'
|
73
|
+
span.input-group-btn
|
74
|
+
= button_tag Comable.t('search'), class: 'btn btn-default', type: 'button'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
header
|
2
|
+
nav.navbar.navbar-default role="navigation"
|
3
|
+
.container
|
4
|
+
/! Brand and toggle get grouped for better mobile display
|
5
|
+
.navbar-header
|
6
|
+
= link_to current_store.name, comable.root_path, class: 'navbar-brand'
|
7
|
+
- unless devise_controller?
|
8
|
+
/! Collect the nav links, forms, and other content for toggling
|
9
|
+
.navbar-collapse
|
10
|
+
ol.nav.navbar-nav.navbar-right.comable-checkout-flow
|
11
|
+
li.signin class="#{'active' if action_name == 'signin'}"
|
12
|
+
= Comable.t('checkout_flow.sign_in')
|
13
|
+
li.addresses class="#{'active' if params[:state].in? %w( orderer delivery payment shipment )}"
|
14
|
+
= Comable.t('checkout_flow.address_and_payment')
|
15
|
+
li.confirm class="#{'active' if params[:state] == 'confirm'}"
|
16
|
+
= Comable.t('checkout_flow.confirm')
|
17
|
+
li.complete class="#{'active' if action_name == 'create'}"
|
18
|
+
= Comable.t('checkout_flow.complete')
|
@@ -3,28 +3,37 @@ html
|
|
3
3
|
head
|
4
4
|
title = current_store.name
|
5
5
|
|
6
|
-
- if current_store.
|
7
|
-
meta name="keywords" content="#{current_store.
|
6
|
+
- if current_store.meta_keywords.present?
|
7
|
+
meta name="keywords" content="#{current_store.meta_keywords}"
|
8
8
|
|
9
9
|
- if current_store.meta_description.present?
|
10
10
|
meta name="description" content="#{current_store.meta_description}"
|
11
11
|
|
12
|
-
= stylesheet_link_tag "comable/application", media: "all"
|
13
|
-
= javascript_include_tag "comable/application"
|
12
|
+
= stylesheet_link_tag "comable/frontend/application", media: "all"
|
13
|
+
= javascript_include_tag "comable/frontend/application"
|
14
14
|
= csrf_meta_tags
|
15
15
|
|
16
16
|
css:
|
17
17
|
.hidden { display: none; }
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
javascript:
|
20
|
+
jQuery(document).ready(function() {
|
21
|
+
$(".dropdown").hover(
|
22
|
+
function() { $('.dropdown-menu', this).stop().delay(500).queue(function() { $(this).show().parent().addClass('open').dequeue(); }) },
|
23
|
+
function() { $('.dropdown-menu', this).stop().hide().parent().removeClass('open'); });
|
24
|
+
});
|
22
25
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
- mini_header_flag = controller_name == 'orders' || devise_controller?
|
27
|
+
body class="#{'comable-checkout-layout' if mini_header_flag}"
|
28
|
+
- if mini_header_flag
|
29
|
+
= render 'comable/shared/header_for_checkout'
|
30
|
+
- else
|
31
|
+
= render 'comable/shared/header'
|
29
32
|
|
30
|
-
|
33
|
+
main.container
|
34
|
+
- flash.each do |name, msg|
|
35
|
+
= content_tag(:div, msg, id: "flash_#{name}")
|
36
|
+
|
37
|
+
== yield
|
38
|
+
|
39
|
+
= render 'comable/shared/footer'
|