comable-frontend 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +97 -0
  4. data/app/assets/images/comable/frontend/home-one.jpg +0 -0
  5. data/app/assets/images/comable/frontend/home-top.jpg +0 -0
  6. data/app/assets/javascripts/comable/frontend/application.coffee +5 -0
  7. data/app/assets/stylesheets/comable/frontend/application.scss +527 -0
  8. data/app/assets/stylesheets/comable/frontend/products.scss +0 -0
  9. data/app/assets/stylesheets/comable/products.scss +0 -0
  10. data/app/controllers/comable/application_controller.rb +12 -0
  11. data/app/controllers/comable/carts_controller.rb +66 -0
  12. data/app/controllers/comable/home_controller.rb +14 -0
  13. data/app/controllers/comable/orders_controller.rb +97 -0
  14. data/app/controllers/comable/pages_controller.rb +19 -0
  15. data/app/controllers/comable/products_controller.rb +25 -0
  16. data/app/controllers/comable/users_controller.rb +29 -0
  17. data/app/controllers/concerns/comable/payment_action.rb +17 -0
  18. data/app/controllers/concerns/comable/shipment_action.rb +17 -0
  19. data/app/controllers/concerns/comable/signin_action.rb +55 -0
  20. data/app/views/comable/carts/show.slim +67 -0
  21. data/app/views/comable/home/show.slim +24 -0
  22. data/app/views/comable/orders/confirm.slim +83 -0
  23. data/app/views/comable/orders/create.slim +7 -0
  24. data/app/views/comable/orders/delivery.slim +48 -0
  25. data/app/views/comable/orders/orderer.slim +64 -0
  26. data/app/views/comable/orders/payment.slim +15 -0
  27. data/app/views/comable/orders/shipment.slim +15 -0
  28. data/app/views/comable/orders/signin.slim +22 -0
  29. data/app/views/comable/pages/show.slim +7 -0
  30. data/app/views/comable/products/index.slim +20 -0
  31. data/app/views/comable/products/show.slim +89 -0
  32. data/app/views/comable/shared/_address.slim +13 -0
  33. data/app/views/comable/shared/_address_form.slim +39 -0
  34. data/app/views/comable/shared/_footer.slim +39 -0
  35. data/app/views/comable/shared/_header.slim +74 -0
  36. data/app/views/comable/shared/_header_for_checkout.slim +18 -0
  37. data/app/views/comable/shared/_products.slim +23 -0
  38. data/app/views/comable/shared/_tracker.slim +2 -0
  39. data/app/views/comable/users/_address.slim +14 -0
  40. data/app/views/comable/users/addresses.slim +54 -0
  41. data/app/views/comable/users/show.slim +60 -0
  42. data/app/views/kaminari/comable_frontend/_gap.html.slim +2 -0
  43. data/app/views/kaminari/comable_frontend/_next_page.html.slim +7 -0
  44. data/app/views/kaminari/comable_frontend/_page.html.slim +3 -0
  45. data/app/views/kaminari/comable_frontend/_paginator.html.slim +11 -0
  46. data/app/views/kaminari/comable_frontend/_prev_page.html.slim +7 -0
  47. data/app/views/layouts/comable/application.slim +35 -0
  48. data/config/routes.rb +34 -0
  49. data/lib/comable/frontend/engine.rb +29 -0
  50. data/lib/comable/frontend.rb +1 -0
  51. data/lib/tasks/comable_backend_tasks.rake +4 -0
  52. metadata +295 -0
@@ -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'
@@ -0,0 +1,7 @@
1
+ - set_meta_tags(title: @page.page_title, description: @page.meta_description, keywords: @page.meta_keywords)
2
+
3
+ section
4
+ h1
5
+ = @page.title
6
+
7
+ == @page.content
@@ -0,0 +1,20 @@
1
+ #comable-product
2
+ - if @category
3
+ .row
4
+ = listed_categories @category.path, tag: :ol, class: 'breadcrumb'
5
+
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
+ = render 'comable/shared/products'
18
+
19
+ .text-center
20
+ = paginate @products, theme: :comable_frontend
@@ -0,0 +1,89 @@
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.stocked?
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
+ .soldout
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
+ )
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,39 @@
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)
10
+
11
+ .form-group.comable-state_name
12
+ .col-sm-2.control-label
13
+ = address.label :state_name
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
19
+ = address.label :zip_code
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
25
+ = address.label :city
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)
34
+
35
+ .form-group.phone_number
36
+ .col-sm-2.control-label
37
+ = address.label :phone_number
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,39 @@
1
+ footer
2
+ .container
3
+ .row
4
+ .col-md-4
5
+ h3
6
+ = Comable.t('support')
7
+ ul.list-unstyled
8
+ li
9
+ i.glyphicon.glyphicon-earphone>
10
+ | 0123-XX-XXXX
11
+ li
12
+ i.glyphicon.glyphicon-envelope>
13
+ | comable@example.com
14
+ .col-md-4
15
+ h3
16
+ = Comable.t('pages')
17
+ ul.list-unstyled
18
+ li
19
+ = link_to Comable.t('home'), comable.root_path
20
+ li
21
+ = link_to Comable.t('products'), comable.products_path
22
+ li
23
+ = link_to Comable.t('cart'), comable.cart_path
24
+ li
25
+ = link_to Comable.t('my_account'), comable.user_path
26
+ .col-md-4
27
+ h3
28
+ = Comable.t('my_account')
29
+ ul.list-unstyled
30
+ li
31
+ = link_to Comable.t('sign_in'), comable.new_user_session_path
32
+ li
33
+ = link_to Comable.t('my_account'), comable.user_path
34
+ li
35
+ = link_to Comable.t('change_email_or_password'), comable.edit_user_path
36
+ li
37
+ = link_to Comable.t('edit_your_address_book'), comable.addresses_user_path
38
+ .credit
39
+ | Powered by #{link_to Comable.app_name, Comable.homepage}
@@ -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.user_path
14
+ li
15
+ - if current_comable_user.signed_in?
16
+ = link_to comable.destroy_user_session_path, method: :delete do
17
+ i.glyphicon.glyphicon-log-out>
18
+ = Comable.t('sign_out')
19
+ - else
20
+ = link_to comable.new_user_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_comable_user.cart.size})
55
+ span.caret<
56
+ ul.dropdown-menu.comable-mini-cart role="menu"
57
+ - current_comable_user.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')
@@ -0,0 +1,23 @@
1
+ ul.row
2
+ - @products.each do |product|
3
+ li.col-xs-6.col-sm-3
4
+ .thumbnail.text-center
5
+ = link_to comable.product_path(product) do
6
+ = image_tag product.image_url, width: '100%'
7
+ h5
8
+ = link_to product.name, comable.product_path(product)
9
+ - if product.caption.present?
10
+ p
11
+ = product.caption
12
+ strong
13
+ = number_to_currency product.price
14
+ p
15
+ = form_tag comable.add_cart_path do
16
+ - stock = product.stocks.first
17
+ - if stock && stock.stocked?
18
+ .add_cart.form-inline.form-group
19
+ = hidden_field_tag :stock_id, stock.id
20
+ = submit_tag Comable.t('add_to_cart'), class: 'btn btn-default'
21
+ - else
22
+ .soldout
23
+ = submit_tag Comable.t('soldout'), class: 'btn btn-default', disabled: true
@@ -0,0 +1,2 @@
1
+ - current_trackers.each do |tracker|
2
+ = liquidize tracker.code, tracker_id: tracker.tracker_id, order: @order || current_order
@@ -0,0 +1,14 @@
1
+ = render 'comable/shared/address', address: address
2
+
3
+ ul.buttons.list-inline
4
+ - if address != address.user.bill_address
5
+ li.use_bill_address
6
+ = form_for current_comable_user, as: :user, url: comable.addresses_user_url, method: :put do |f|
7
+ = f.hidden_field :bill_address_id, value: address.id
8
+ = f.submit Comable.t('use_as_billing_address'), class: 'btn btn-default'
9
+
10
+ - if address != address.user.ship_address
11
+ li.use_ship_address
12
+ = form_for current_comable_user, as: :user, url: comable.addresses_user_url, method: :put do |f|
13
+ = f.hidden_field :ship_address_id, value: address.id
14
+ = f.submit Comable.t('use_as_shipping_address'), class: 'btn btn-default'
@@ -0,0 +1,54 @@
1
+ .user
2
+ .addresses
3
+ h1
4
+ = Comable.t('address_book')
5
+
6
+ - if current_comable_user.errors.any?
7
+ .errors
8
+ ul
9
+ - current_comable_user.errors.full_messages.each do |full_message|
10
+ li = full_message
11
+
12
+ - if current_comable_user.addresses.empty?
13
+ .not_found
14
+ p
15
+ = Comable.t('not_found')
16
+ - else
17
+ .row
18
+ .bill_address.col-sm-6
19
+ h2
20
+ = current_comable_user.class.human_attribute_name(:bill_address)
21
+ - if current_comable_user.bill_address
22
+ = render 'address', address: current_comable_user.bill_address
23
+ - else
24
+ .not_found
25
+ p
26
+ = Comable.t('not_found')
27
+
28
+ .ship_address.col-sm-6
29
+ h2
30
+ = current_comable_user.class.human_attribute_name(:ship_address)
31
+ - if current_comable_user.ship_address
32
+ = render 'address', address: current_comable_user.ship_address
33
+ - else
34
+ .not_found
35
+ p
36
+ = Comable.t('not_found')
37
+
38
+ .row
39
+ .other_addresses
40
+ h2
41
+ = Comable.t('other_addresses')
42
+ ul.list-unstyled
43
+ - current_comable_user.other_addresses.each do |address|
44
+ li.col-sm-4
45
+ = render 'address', address: address
46
+
47
+ .new_address
48
+ h2
49
+ = Comable.t('new_address')
50
+ = form_for current_comable_user, as: :user, url: comable.addresses_user_url, method: :put do |f|
51
+ = f.fields_for :addresses, current_comable_user.addresses.build do |ff|
52
+ = render 'comable/shared/address_form', address: ff
53
+ .submit
54
+ = f.submit Comable.t('actions.create')
@@ -0,0 +1,60 @@
1
+ #comable-user
2
+ h1
3
+ = Comable.t('my_account')
4
+
5
+ .comable-name
6
+ = current_comable_user.email
7
+
8
+ .comable-member-menu
9
+ ul
10
+ li
11
+ = link_to Comable.t('change_email_or_password'), comable.edit_user_path
12
+ li
13
+ = link_to Comable.t('edit_your_address_book'), comable.addresses_user_path
14
+
15
+ .coamble-orders
16
+ h2
17
+ = Comable.t('order_history')
18
+ - @orders.each do |order|
19
+ table
20
+ thead
21
+ tr
22
+ th
23
+ = order.class.human_attribute_name(:completed_at)
24
+ th
25
+ = order.class.human_attribute_name(:total_price)
26
+ th
27
+ = order.class.human_attribute_name(:bill_address)
28
+ th
29
+ = order.class.human_attribute_name(:code)
30
+ tbody
31
+ tr
32
+ td
33
+ = l order.completed_at.to_date, format: :long
34
+ td
35
+ = number_to_currency order.total_price
36
+ td
37
+ = order.bill_address.full_name
38
+ td
39
+ = order.code
40
+ - order.order_items.each do |order_item|
41
+ tr
42
+ td colspan="4"
43
+ .comable-detail
44
+ .row
45
+ .col-sm-2.comable-image
46
+ = link_to comable.product_path(order_item.product), class: 'thumbnail' do
47
+ = image_tag order_item.product.image_url, width: '100%'
48
+ .col-sm-10
49
+ .comable-name
50
+ = link_to order_item.name_with_sku, comable.product_path(order_item.product)
51
+ .comable-repeat
52
+ = form_tag comable.add_cart_path do
53
+ - if order_item.stock.stocked?
54
+ .add_cart.form-inline.form-group
55
+ = hidden_field_tag :stock_id, order_item.stock_id
56
+ = hidden_field_tag :quantity, order_item.quantity
57
+ = submit_tag Comable.t('reorder'), class: 'btn btn-default'
58
+
59
+ .text-center
60
+ = paginate @orders, theme: :comable_frontend
@@ -0,0 +1,2 @@
1
+ li.disabled
2
+ = link_to raw(t 'views.pagination.truncate'), '#'
@@ -0,0 +1,7 @@
1
+ - if current_page.last?
2
+ li.disabled
3
+ span
4
+ = raw(t 'views.pagination.next')
5
+ - else
6
+ li
7
+ = link_to raw(t 'views.pagination.next'), url, rel: 'next', remote: remote
@@ -0,0 +1,3 @@
1
+ li class="#{'active' if page.current?}"
2
+ = link_to page, page.current? ? '#' : url,
3
+ remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil
@@ -0,0 +1,11 @@
1
+ = paginator.render do
2
+ ul.pagination
3
+ == prev_page_tag
4
+
5
+ - each_page do |page|
6
+ - if page.left_outer? || page.right_outer? || page.inside_window?
7
+ == page_tag page
8
+ - elsif !page.was_truncated?
9
+ == gap_tag
10
+
11
+ == next_page_tag
@@ -0,0 +1,7 @@
1
+ - if current_page.first?
2
+ li.disabled
3
+ span
4
+ = raw(t 'views.pagination.previous')
5
+ - else
6
+ li
7
+ = link_to raw(t 'views.pagination.previous'), url, rel: 'prev', remote: remote
@@ -0,0 +1,35 @@
1
+ doctype html
2
+ html
3
+ head
4
+ = display_meta_tags site: current_store.name, description: current_store.meta_description, keywords: current_store.meta_keywords
5
+
6
+ = stylesheet_link_tag "comable/frontend/application", media: "all"
7
+ = javascript_include_tag "comable/frontend/application"
8
+ = csrf_meta_tags
9
+
10
+ css:
11
+ .hidden { display: none; }
12
+
13
+ javascript:
14
+ jQuery(document).ready(function() {
15
+ $(".dropdown").hover(
16
+ function() { $('.dropdown-menu', this).stop().delay(500).queue(function() { $(this).show().parent().addClass('open').dequeue(); }) },
17
+ function() { $('.dropdown-menu', this).stop().hide().parent().removeClass('open'); });
18
+ });
19
+
20
+ - mini_header_flag = controller_name == 'orders' || devise_controller?
21
+ body class="#{'comable-checkout-layout' if mini_header_flag}"
22
+ = render 'comable/shared/tracker'
23
+
24
+ - if mini_header_flag
25
+ = render 'comable/shared/header_for_checkout'
26
+ - else
27
+ = render 'comable/shared/header'
28
+
29
+ main class="#{'container' if controller_name != 'home'}"
30
+ - flash.each do |name, msg|
31
+ = content_tag(:div, msg, id: "flash_#{name}")
32
+
33
+ == yield
34
+
35
+ = render 'comable/shared/footer'
data/config/routes.rb ADDED
@@ -0,0 +1,34 @@
1
+ Comable::Core::Engine.routes.draw do
2
+ root to: 'home#show'
3
+
4
+ resource :home, only: :show
5
+ resources :products
6
+
7
+ resource :cart do
8
+ collection do
9
+ # TODO: post => put
10
+ post :add
11
+ put :checkout
12
+ end
13
+ end
14
+
15
+ resource :order, only: [:create] do
16
+ collection do
17
+ get 'signin', as: :signin
18
+ put 'guest', as: :guest
19
+ get ':state', action: :edit, as: :next
20
+ put ':state', action: :update
21
+ end
22
+ end
23
+
24
+ resources :pages, only: [:show]
25
+
26
+ devise_for :user, path: :member, class_name: Comable::User.name, module: :devise
27
+
28
+ resource :user, path: :member do
29
+ member do
30
+ get :addresses
31
+ put :addresses, action: :update_addresses
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,29 @@
1
+ require 'comable/core'
2
+
3
+ require 'slim'
4
+ require 'bootstrap-sass'
5
+ require 'sass-rails'
6
+ require 'compass-rails'
7
+ require 'kaminari'
8
+
9
+ require 'jquery-rails'
10
+ require 'jquery-ui-rails'
11
+
12
+ require 'meta-tags'
13
+
14
+ module Comable
15
+ module Frontend
16
+ class Engine < ::Rails::Engine
17
+ config.generators do |g|
18
+ g.template_engine :slim
19
+ g.test_framework :rspec, fixture: true
20
+ g.fixture_replacement :factory_girl, dir: 'spec/factories'
21
+ end
22
+
23
+ # XXX: a code below to delegate comable:install:migrations to comable-core
24
+ config.paths['db/migrate'] = []
25
+
26
+ config.autoload_paths << "#{config.root}/app/controllers/concerns" if Rails::VERSION::MAJOR == 3
27
+ end
28
+ end
29
+ end
@@ -0,0 +1 @@
1
+ require 'comable/frontend/engine'
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :comable_backend do
3
+ # # Task goes here
4
+ # end