comable_backend 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/Rakefile +16 -4
  4. data/app/assets/javascripts/comable/admin/application.coffee +88 -0
  5. data/app/assets/stylesheets/comable/admin/application.scss +590 -0
  6. data/app/controllers/comable/admin/application_controller.rb +28 -0
  7. data/app/controllers/comable/admin/categories_controller.rb +14 -0
  8. data/app/controllers/comable/admin/customers_controller.rb +36 -0
  9. data/app/controllers/comable/admin/dashboard_controller.rb +20 -0
  10. data/app/controllers/comable/admin/orders_controller.rb +14 -0
  11. data/app/controllers/comable/admin/payment_methods_controller.rb +52 -0
  12. data/app/controllers/comable/admin/products_controller.rb +50 -1
  13. data/app/controllers/comable/admin/shipment_methods_controller.rb +11 -27
  14. data/app/controllers/comable/admin/stocks_controller.rb +69 -0
  15. data/app/controllers/comable/admin/store_controller.rb +12 -29
  16. data/app/views/comable/admin/categories/index.slim +94 -0
  17. data/app/views/comable/admin/customers/edit.slim +94 -0
  18. data/app/views/comable/admin/customers/index.slim +68 -0
  19. data/app/views/comable/admin/customers/show.slim +93 -0
  20. data/app/views/comable/admin/dashboard/_widget.slim +13 -0
  21. data/app/views/comable/admin/dashboard/show.slim +63 -0
  22. data/app/views/comable/admin/orders/index.slim +79 -0
  23. data/app/views/comable/admin/orders/show.slim +116 -0
  24. data/app/views/comable/admin/payment_methods/_form.slim +46 -0
  25. data/app/views/comable/admin/payment_methods/edit.slim +28 -0
  26. data/app/views/comable/admin/payment_methods/index.slim +53 -0
  27. data/app/views/comable/admin/payment_methods/new.slim +17 -0
  28. data/app/views/comable/admin/products/_form.slim +130 -0
  29. data/app/views/comable/admin/products/edit.slim +40 -0
  30. data/app/views/comable/admin/products/index.slim +75 -5
  31. data/app/views/comable/admin/products/new.slim +17 -0
  32. data/app/views/comable/admin/shipment_methods/_form.slim +35 -19
  33. data/app/views/comable/admin/shipment_methods/edit.slim +26 -5
  34. data/app/views/comable/admin/shipment_methods/index.slim +46 -13
  35. data/app/views/comable/admin/shipment_methods/new.slim +15 -3
  36. data/app/views/comable/admin/stocks/_form.slim +40 -0
  37. data/app/views/comable/admin/stocks/edit.slim +46 -0
  38. data/app/views/comable/admin/stocks/index.slim +81 -0
  39. data/app/views/comable/admin/stocks/new.slim +17 -0
  40. data/app/views/comable/admin/store/_form.slim +43 -31
  41. data/app/views/comable/admin/store/edit.slim +11 -3
  42. data/app/views/kaminari/comable_backend/_first_page.html.slim +2 -0
  43. data/app/views/kaminari/comable_backend/_gap.html.slim +2 -0
  44. data/app/views/kaminari/comable_backend/_last_page.html.slim +2 -0
  45. data/app/views/kaminari/comable_backend/_next_page.html.slim +2 -0
  46. data/app/views/kaminari/comable_backend/_page.html.slim +3 -0
  47. data/app/views/kaminari/comable_backend/_paginator.html.slim +15 -0
  48. data/app/views/kaminari/comable_backend/_prev_page.html.slim +2 -0
  49. data/app/views/layouts/comable/admin/application.slim +103 -2
  50. data/config/routes.rb +14 -2
  51. data/lib/comable/backend/engine.rb +22 -0
  52. metadata +240 -9
  53. data/app/assets/javascripts/comable/admin/application.js +0 -13
  54. data/app/assets/stylesheets/comable/admin/application.css +0 -15
  55. data/app/views/comable/admin/shipment_methods/show.slim +0 -22
  56. data/app/views/comable/admin/store/new.slim +0 -3
  57. data/app/views/comable/admin/store/show.slim +0 -24
@@ -1,7 +1,28 @@
1
- h1 Editing shipment_method
1
+ #comable-shipment-method
2
+ ol.breadcrumb
3
+ li
4
+ = link_to Comable.t('admin.nav.dashboard'), comable.admin_root_path
5
+ li
6
+ = link_to Comable.t('admin.nav.shipment_method'), comable.admin_shipment_methods_path
7
+ li.active
8
+ = @shipment_method.name
2
9
 
3
- = render 'form'
10
+ h1.page-header
11
+ = @shipment_method.name
4
12
 
5
- = link_to 'Show', comable.admin_shipment_method_path(@shipment_method)
6
- | |
7
- = link_to 'Back', comable.admin_shipment_methods_path
13
+ .row
14
+ section.col-sm-8
15
+ = render 'form'
16
+ hr
17
+ .panel.panel-danger
18
+ .panel-heading type="button" data-toggle="collapse" data-target="#comable-danger" aria-expanded="false" aria-controls="comable-danger"
19
+ strong
20
+ span.fa.fa-angle-down>
21
+ = Comable.t('admin.actions.destroy')
22
+ #comable-danger.collapse
23
+ .panel-body
24
+ p
25
+ = Comable.t('admin.confirmation_to_remove_product')
26
+ = link_to Comable.t('admin.actions.destroy'), comable.admin_shipment_method_path(@shipment_method), method: :delete, class: 'btn btn-danger'
27
+
28
+ nav.col-sm-4
@@ -1,17 +1,50 @@
1
- h1 Listing shipment_methods
1
+ #comable-shipment-method
2
+ ol.breadcrumb
3
+ li
4
+ = link_to Comable.t('admin.nav.dashboard'), comable.admin_root_path
5
+ li.active
6
+ = Comable.t('admin.nav.shipment_method')
2
7
 
3
- table
4
- thead
5
- tr
6
- th colspan="3"
8
+ h1.page-header
9
+ = Comable.t('admin.nav.shipment_method')
10
+ small<
11
+ = @shipment_methods.total_count
12
+ = Comable.t('admin.results')
7
13
 
8
- tbody
9
- - @shipment_methods.each do |shipment_method|
10
- tr
11
- td = link_to 'Show', comable.admin_shipment_method_path(shipment_method)
12
- td = link_to 'Edit', comable.edit_admin_shipment_method_path(shipment_method)
13
- td = link_to 'Destroy', comable.admin_shipment_method_path(shipment_method), method: :delete, data: { confirm: 'Are you sure?' }
14
+ .row
15
+ section.col-sm-8
16
+ - if @shipment_methods.empty?
17
+ = Comable.t('admin.not_found')
18
+ - else
19
+ .panel.panel-inverse
20
+ .panel-heading
21
+ .panel-title
22
+ = Comable.t('admin.index')
23
+ table.table.table-striped
24
+ thead
25
+ th
26
+ = @shipment_methods.klass.human_attribute_name(:name)
27
+ th
28
+ = @shipment_methods.klass.human_attribute_name(:fee)
29
+ th
30
+ = @shipment_methods.klass.human_attribute_name(:traking_url)
31
+ tbody
32
+ - @shipment_methods.each do |shipment_method|
33
+ tr
34
+ td
35
+ = link_to shipment_method.name, comable.admin_shipment_method_path(shipment_method)
36
+ - unless shipment_method.activate_flag
37
+ span.fa.fa-eye-slash.text-muted<
38
+ td
39
+ = number_to_currency shipment_method.fee
40
+ td
41
+ = truncate shipment_method.traking_url
14
42
 
15
- br
43
+ .text-center
44
+ = paginate @shipment_methods, theme: :comable_backend
16
45
 
17
- = link_to 'New Shipment method', comable.new_admin_shipment_method_path
46
+ nav.col-sm-4
47
+ #comable-affix
48
+ .panel
49
+ .list-group
50
+ = link_to Comable.t('admin.actions.new'), comable.new_admin_shipment_method_path, class: 'list-group-item'
@@ -1,5 +1,17 @@
1
- h1 New shipment_method
1
+ #comable-shipment-method
2
+ ol.breadcrumb
3
+ li
4
+ = link_to Comable.t('admin.nav.dashboard'), comable.admin_root_path
5
+ li
6
+ = link_to Comable.t('admin.nav.shipment_method'), comable.admin_shipment_methods_path
7
+ li.active
8
+ = Comable.t('admin.actions.new')
2
9
 
3
- = render 'form'
10
+ h1.page-header
11
+ = Comable.t('admin.actions.new')
4
12
 
5
- = link_to 'Back', comable.admin_shipment_methods_path
13
+ .row
14
+ section.col-sm-8
15
+ = render 'form'
16
+
17
+ nav.col-sm-4
@@ -0,0 +1,40 @@
1
+ - url = comable.admin_product_stocks_path(@product) if @stock.new_record?
2
+ - url ||= comable.admin_product_stock_path(@product, @stock)
3
+ = form_for @stock, url: url do |f|
4
+ .panel.panel-inverse
5
+ .panel-heading
6
+ .panel-title
7
+ = Comable.t('admin.general')
8
+ .panel-body
9
+ .form-horizontal
10
+ .form-group
11
+ .col-sm-3.control-label
12
+ = f.label :code
13
+ .col-sm-6
14
+ = f.text_field :code
15
+
16
+ .form-group
17
+ .col-sm-3.control-label
18
+ = f.label :quantity
19
+ .col-sm-6
20
+ = f.text_field :quantity
21
+
22
+ - if @product.sku?
23
+ - if @product.sku_h?
24
+ .form-group
25
+ .col-sm-3.control-label
26
+ = f.label :sku_h_choice_name, @product.sku_h_item_name
27
+ .col-sm-6
28
+ = f.text_field :sku_h_choice_name
29
+
30
+ - if @product.sku_v?
31
+ .form-group
32
+ .col-sm-3.control-label
33
+ = f.label :sku_v_choice_name, @product.sku_v_item_name
34
+ .col-sm-6
35
+ = f.text_field :sku_v_choice_name
36
+
37
+ .panel-footer
38
+ = link_to Comable.t('admin.actions.cancel'), comable.admin_product_stocks_path(@product), class: 'btn btn-default'
39
+ .pull-right
40
+ = f.submit
@@ -0,0 +1,46 @@
1
+ #comable-product
2
+ ol.breadcrumb
3
+ li
4
+ = link_to Comable.t('admin.nav.dashboard'), comable.admin_root_path
5
+ li
6
+ = link_to Comable.t('admin.nav.product'), comable.admin_products_path
7
+ li
8
+ = link_to @product.name, comable.admin_product_path(@product)
9
+ li
10
+ = link_to Comable.t('admin.nav.products.stock'), comable.admin_product_stocks_path(@product)
11
+ li.active
12
+ = @stock.name_with_sku
13
+
14
+ h1.page-header
15
+ = @stock.name_with_sku
16
+ small< = @stock.code
17
+
18
+ .row
19
+ section.col-sm-8
20
+ = render 'form'
21
+ hr
22
+ .panel.panel-danger
23
+ .panel-heading type="button" data-toggle="collapse" data-target="#comable-danger" aria-expanded="false" aria-controls="comable-danger"
24
+ strong
25
+ span.fa.fa-angle-down>
26
+ = Comable.t('admin.actions.destroy')
27
+ #comable-danger.collapse
28
+ .panel-body
29
+ p
30
+ = Comable.t('admin.confirmation_to_remove_stock')
31
+ = link_to Comable.t('admin.actions.destroy'), comable.admin_product_stock_path(@product, @stock), method: :delete, class: 'btn btn-danger'
32
+
33
+ nav.col-sm-4
34
+ #comable-affix data-spy="affix"
35
+ .panel
36
+ .list-group
37
+ = link_to Comable.t('admin.nav.products.detail'), comable.admin_product_path(@product), class: 'list-group-item'
38
+ = link_to Comable.t('admin.nav.products.stock'), comable.admin_product_stocks_path(@product), class: 'list-group-item disabled'
39
+
40
+ .panel
41
+ .list-group
42
+ - if @product.sku?
43
+ = link_to Comable.t('admin.actions.new'), comable.new_admin_product_stock_path, class: 'list-group-item'
44
+ = link_to comable.product_path(@product), class: 'list-group-item' do
45
+ span.fa.fa-external-link>
46
+ = Comable.t('admin.check_this_product_in_frontend')
@@ -0,0 +1,81 @@
1
+ #comable-stock
2
+ ol.breadcrumb
3
+ li
4
+ = link_to Comable.t('admin.nav.dashboard'), comable.admin_root_path
5
+ li
6
+ = link_to Comable.t('admin.nav.product'), comable.admin_products_path
7
+ li
8
+ = link_to @product.name, comable.admin_product_path(@product)
9
+ li.active
10
+ = Comable.t('admin.nav.products.stock')
11
+
12
+ h1.page-header
13
+ = Comable.t('admin.nav.products.stock')
14
+ small<
15
+ = @stocks.total_count
16
+ = Comable.t('admin.results')
17
+
18
+ .row
19
+ section.col-sm-8
20
+ .panel.panel-inverse
21
+ .panel-heading
22
+ .panel-title
23
+ = Comable.t('admin.index')
24
+ - if @stocks.empty?
25
+ .panel-body
26
+ = Comable.t('admin.not_found')
27
+ - else
28
+ table.table.table-striped
29
+ thead
30
+ th
31
+ = sort_link [:comable, @q], :code, product_id: @product.id
32
+ th
33
+ = sort_link [:comable, @q], :quantity, product_id: @product.id
34
+ - if @product.sku?
35
+ - if @product.sku_h?
36
+ th
37
+ = sort_link [:comable, @q], :sku_h_choice_name, @product.sku_h_item_name, product_id: @product.id
38
+ - if @product.sku_v?
39
+ th
40
+ = sort_link [:comable, @q], :sku_v_choice_name, @product.sku_v_item_name, product_id: @product.id
41
+ tbody
42
+ - @stocks.each do |stock|
43
+ tr
44
+ td
45
+ = link_to stock.code, comable.admin_product_stock_path(@product, stock)
46
+ td
47
+ strong class="#{(stock.quantity <= 0) ? 'text-danger' : (stock.quantity <= 10) ? 'text-warning' : 'text-success'}"
48
+ = number_with_delimiter stock.quantity
49
+ - if @product.sku?
50
+ - if @product.sku_h?
51
+ td
52
+ = stock.sku_h_choice_name
53
+ - if @product.sku_v?
54
+ td
55
+ = stock.sku_v_choice_name
56
+
57
+ .text-center
58
+ = paginate @stocks, theme: :comable_backend
59
+
60
+ nav.col-sm-4
61
+ #comable-affix
62
+ .panel
63
+ .list-group
64
+ = link_to Comable.t('admin.nav.products.detail'), comable.admin_product_path(@product), class: 'list-group-item'
65
+ = link_to Comable.t('admin.nav.products.stock'), comable.admin_product_stocks_path(@product), class: 'list-group-item disabled'
66
+
67
+ .panel
68
+ .list-group
69
+ = link_to Comable.t('admin.actions.new'), comable.new_admin_product_stock_path(@product), class: 'list-group-item'
70
+
71
+ .panel
72
+ .panel-body
73
+ = search_form_for @q, url: comable.new_admin_product_stock_path(@product) do |f|
74
+ .form-horizontal
75
+ .form-group
76
+ .col-sm-3.control-label
77
+ = f.label :code
78
+ .col-sm-9
79
+ = f.text_field :code_cont
80
+ .text-right
81
+ = f.submit Comable.t('admin.search'), class: 'btn btn-default'
@@ -0,0 +1,17 @@
1
+ #comable-product
2
+ ol.breadcrumb
3
+ li
4
+ = link_to Comable.t('admin.nav.dashboard'), comable.admin_root_path
5
+ li.active
6
+ = link_to Comable.t('admin.nav.product'), comable.admin_products_path
7
+ li.active
8
+ = Comable.t('admin.actions.new')
9
+
10
+ h1.page-header
11
+ = Comable.t('admin.actions.new')
12
+
13
+ .row
14
+ section.col-sm-8
15
+ = render 'form'
16
+
17
+ nav.col-sm-4
@@ -1,38 +1,50 @@
1
- = form_for(@store, url: comable.admin_store_path(@store)) do |f|
2
- - if @store.errors.any?
3
- #error_explanation
4
- h2
5
- = pluralize(@store.errors.count, "error")
6
- | prohibited this store from being saved:
1
+ - if @store.errors.any?
2
+ #error_explanation
3
+ h2
4
+ = pluralize(@store.errors.count, "error")
5
+ | prohibited this store from being saved:
6
+ ul
7
+ - @store.errors.full_messages.each do |message|
8
+ li = message
7
9
 
8
- ul
9
- - @store.errors.full_messages.each do |message|
10
- li = message
10
+ = form_for @store, url: comable.admin_store_path, method: :patch do |f|
11
+ .panel.panel-inverse
12
+ .panel-heading
13
+ .panel-title
14
+ = Comable.t('admin.nav.stores.edit')
11
15
 
12
- .name
13
- = f.label :name do
14
- span = @store.class.human_attribute_name(:name)
15
- span = f.text_field :name
16
+ .panel-body
17
+ .form-horizontal
18
+ .form-group
19
+ .col-sm-3.control-label
20
+ = f.label :name
21
+ .col-sm-6
22
+ = f.text_field :name, placeholder: f.object.class.default_name
16
23
 
17
- .meta_keyword
18
- = f.label :meta_keyword do
19
- span = @store.class.human_attribute_name(:meta_keyword)
20
- span = f.text_field :meta_keyword
24
+ .form-group
25
+ .col-sm-3.control-label
26
+ = f.label :meta_keywords
27
+ .col-sm-6
28
+ = f.text_field :meta_keywords
21
29
 
22
- .meta_description
23
- = f.label :meta_description do
24
- span = @store.class.human_attribute_name(:meta_description)
25
- span = f.text_field :meta_description
30
+ .form-group
31
+ .col-sm-3.control-label
32
+ = f.label :meta_description
33
+ .col-sm-6
34
+ = f.text_field :meta_description
26
35
 
27
- .email_sender
28
- = f.label :email_sender do
29
- span = @store.class.human_attribute_name(:email_sender)
30
- span = f.email_field :email_sender
36
+ .form-group
37
+ .col-sm-3.control-label
38
+ = f.label :email_sender
39
+ .col-sm-6
40
+ = f.email_field :email_sender
31
41
 
32
- .email_activate_flag
33
- = f.label :email_activate_flag do
34
- span = f.check_box :email_activate_flag
35
- span = @store.class.human_attribute_name(:email_activate_flag)
42
+ .form-group
43
+ .col-sm-offset-3.col-sm-6
44
+ .checkbox
45
+ = f.label :email_activate_flag do
46
+ = f.check_box :email_activate_flag
47
+ = f.object.class.human_attribute_name(:email_activate_flag)
36
48
 
37
- .actions
38
- = f.submit
49
+ .panel-footer.text-right
50
+ = f.submit Comable.t('admin.actions.update')
@@ -1,5 +1,13 @@
1
- h1 Editing store
1
+ #comable-store
2
+ ol.breadcrumb
3
+ li
4
+ = link_to Comable.t('admin.nav.dashboard'), comable.admin_root_path
5
+ li.active
6
+ = Comable.t('admin.nav.store')
2
7
 
3
- = render 'form'
8
+ h1.page-header
9
+ = Comable.t('admin.nav.store')
4
10
 
5
- = link_to 'Show', comable.admin_store_path(@store)
11
+ .row
12
+ section.col-sm-8
13
+ = render 'form'
@@ -0,0 +1,2 @@
1
+ li
2
+ = link_to raw(t 'views.pagination.first'), url, rel: 'first', remote: remote
@@ -0,0 +1,2 @@
1
+ li.disabled
2
+ = link_to raw(t 'views.pagination.truncate'), '#'
@@ -0,0 +1,2 @@
1
+ li
2
+ = link_to raw(t 'views.pagination.last'), url, rel: 'last', remote: remote
@@ -0,0 +1,2 @@
1
+ li
2
+ = 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,15 @@
1
+ = paginator.render do
2
+ ul.pagination
3
+ - unless current_page.first?
4
+ == first_page_tag
5
+ == prev_page_tag
6
+
7
+ - each_page do |page|
8
+ - if page.left_outer? || page.right_outer? || page.inside_window?
9
+ == page_tag page
10
+ - elsif !page.was_truncated?
11
+ == gap_tag
12
+
13
+ - unless current_page.last?
14
+ == next_page_tag
15
+ == last_page_tag