shoppe 0.0.7 → 0.0.8

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.
Files changed (75) hide show
  1. data/app/assets/images/shoppe/chosen-sprite.png +0 -0
  2. data/app/assets/images/shoppe/chosen-sprite@2x.png +0 -0
  3. data/app/assets/images/shoppe/icons/bag.svg +1 -0
  4. data/app/assets/images/shoppe/icons/balance.svg +1 -0
  5. data/app/assets/images/shoppe/icons/box.svg +1 -0
  6. data/app/assets/images/shoppe/icons/building.svg +1 -0
  7. data/app/assets/images/shoppe/icons/chart.svg +1 -0
  8. data/app/assets/images/shoppe/icons/chat.svg +1 -0
  9. data/app/assets/images/shoppe/icons/checkbox.svg +1 -0
  10. data/app/assets/images/shoppe/icons/checkbox2.svg +1 -0
  11. data/app/assets/images/shoppe/icons/cloud.svg +1 -0
  12. data/app/assets/images/shoppe/icons/cone.svg +1 -0
  13. data/app/assets/images/shoppe/icons/credit_card.svg +1 -0
  14. data/app/assets/images/shoppe/icons/currency.svg +1 -0
  15. data/app/assets/images/shoppe/icons/flowchart.svg +1 -0
  16. data/app/assets/images/shoppe/icons/gift.svg +1 -0
  17. data/app/assets/images/shoppe/icons/globe.svg +1 -0
  18. data/app/assets/images/shoppe/icons/id.svg +1 -0
  19. data/app/assets/images/shoppe/icons/id2.svg +1 -0
  20. data/app/assets/images/shoppe/icons/locked.svg +1 -0
  21. data/app/assets/images/shoppe/icons/report.svg +1 -0
  22. data/app/assets/images/shoppe/icons/search.svg +1 -0
  23. data/app/assets/images/shoppe/icons/support.svg +1 -0
  24. data/app/assets/images/shoppe/icons/tags.svg +1 -0
  25. data/app/assets/images/shoppe/icons/toolbox.svg +1 -0
  26. data/app/assets/images/shoppe/icons/unlocked.svg +1 -0
  27. data/app/assets/images/shoppe/icons/wallet.svg +1 -0
  28. data/app/assets/images/shoppe/move.svg +1 -0
  29. data/app/assets/javascripts/shoppe/application.coffee +32 -1
  30. data/app/assets/javascripts/shoppe/chosen.jquery.js +1166 -0
  31. data/app/assets/javascripts/shoppe/jquery_ui.js +6 -0
  32. data/app/assets/stylesheets/shoppe/application.scss +95 -20
  33. data/app/assets/stylesheets/shoppe/chosen.css +430 -0
  34. data/app/assets/stylesheets/shoppe/elements.scss +6 -7
  35. data/app/controllers/shoppe/delivery_service_prices_controller.rb +1 -1
  36. data/app/controllers/shoppe/products_controller.rb +1 -1
  37. data/app/helpers/shoppe/shoppe_helper.rb +2 -0
  38. data/app/models/shoppe/delivery_service_price.rb +1 -0
  39. data/app/models/shoppe/order.rb +18 -1
  40. data/app/models/shoppe/order_item.rb +11 -5
  41. data/app/models/shoppe/product.rb +19 -4
  42. data/app/models/shoppe/product/product_attributes.rb +15 -0
  43. data/app/models/shoppe/product_attribute.rb +51 -0
  44. data/app/views/shoppe/delivery_service_prices/_form.html.haml +23 -19
  45. data/app/views/shoppe/delivery_service_prices/edit.html.haml +1 -1
  46. data/app/views/shoppe/delivery_service_prices/index.html.haml +1 -1
  47. data/app/views/shoppe/delivery_service_prices/new.html.haml +1 -1
  48. data/app/views/shoppe/delivery_services/_form.html.haml +27 -25
  49. data/app/views/shoppe/delivery_services/edit.html.haml +1 -1
  50. data/app/views/shoppe/delivery_services/index.html.haml +12 -8
  51. data/app/views/shoppe/delivery_services/new.html.haml +1 -1
  52. data/app/views/shoppe/orders/index.html.haml +16 -12
  53. data/app/views/shoppe/orders/show.html.haml +28 -25
  54. data/app/views/shoppe/product_categories/_form.html.haml +7 -6
  55. data/app/views/shoppe/product_categories/edit.html.haml +1 -1
  56. data/app/views/shoppe/product_categories/index.html.haml +8 -4
  57. data/app/views/shoppe/product_categories/new.html.haml +1 -1
  58. data/app/views/shoppe/products/_form.html.haml +88 -45
  59. data/app/views/shoppe/products/edit.html.haml +1 -1
  60. data/app/views/shoppe/products/index.html.haml +14 -13
  61. data/app/views/shoppe/products/new.html.haml +1 -1
  62. data/app/views/shoppe/users/_form.html.haml +17 -15
  63. data/app/views/shoppe/users/edit.html.haml +1 -1
  64. data/app/views/shoppe/users/index.html.haml +1 -1
  65. data/app/views/shoppe/users/new.html.haml +1 -1
  66. data/db/migrate/20131012123829_create_shoppe_product_attributes.rb +11 -0
  67. data/db/migrate/20131012163301_add_public_boolean_to_product_attributes.rb +5 -0
  68. data/db/migrate/20131013123937_add_cost_prices_to_various_objects.rb +8 -0
  69. data/db/migrate/20131013131658_add_stock_control_boolean_to_products.rb +5 -0
  70. data/db/seeds.rb +78 -30
  71. data/lib/shoppe/version.rb +1 -1
  72. data/test/dummy/db/development.sqlite3 +0 -0
  73. data/test/dummy/db/schema.rb +22 -6
  74. data/test/dummy/log/development.log +29 -0
  75. metadata +42 -5
@@ -1,5 +1,5 @@
1
1
  - @page_title = "Delivery Services"
2
2
  = content_for :header do
3
3
  %p.buttons= link_to "Back to delivery services", :delivery_services, :class => 'button'
4
- %h2 New Delivery Service
4
+ %h2.delivery_services Delivery Services
5
5
  = render 'form'
@@ -2,7 +2,7 @@
2
2
 
3
3
  = content_for :header do
4
4
  %p.buttons= link_to "Search Orders", '#', :class => 'button', :rel => 'searchOrders'
5
- %h2
5
+ %h2.orders
6
6
  Orders
7
7
  %span= page_entries_info @orders
8
8
 
@@ -45,16 +45,20 @@
45
45
  %th Total
46
46
  %th Paid?
47
47
  %tbody
48
- - for order in @orders
49
- %tr
50
- %td= link_to order.number, order
51
- %td= order.customer_name
52
- %td= status_tag order.status
53
- %td
54
- %ul
55
- - for item in order.order_items
56
- %li #{item.quantity} x #{item.product.title}
57
- %td= number_to_currency order.total
58
- %td= boolean_tag order.paid?
48
+ - if @orders.empty?
49
+ %tr.empty
50
+ %td{:colspan => 6} No orders to display.
51
+ - else
52
+ - for order in @orders
53
+ %tr
54
+ %td= link_to order.number, order
55
+ %td= order.customer_name
56
+ %td= status_tag order.status
57
+ %td
58
+ %ul
59
+ - for item in order.order_items
60
+ %li #{item.quantity} x #{item.product.title}
61
+ %td= number_to_currency order.total
62
+ %td= boolean_tag order.paid?
59
63
 
60
64
  = paginate @orders
@@ -2,7 +2,7 @@
2
2
 
3
3
  = content_for :header do
4
4
  %p.buttons= link_to "Back to orders", :orders, :class => 'button'
5
- %h2 Order ##{@order.number}
5
+ %h2.orders Order <b>##{@order.number}</b>
6
6
 
7
7
  #order
8
8
  .details
@@ -31,7 +31,6 @@
31
31
  %dt Build Time
32
32
  %dd= distance_of_time_in_words(@order.created_at, @order.received_at)
33
33
 
34
-
35
34
  - if !@order.paid?
36
35
  = form_tag [:pay, @order] do
37
36
  %p.ship
@@ -45,7 +44,7 @@
45
44
  = submit_tag "Ship", :class => 'button green'
46
45
 
47
46
  - if @order.paid? && !(@order.accepted? || @order.rejected?)
48
- %p.acceptreject
47
+ %p.ship
49
48
  = link_to 'Accept order', [:accept, @order], :method => :post, :class => 'button green'
50
49
  = link_to "Reject order", [:reject, @order], :method => :post, :class => 'button purple'
51
50
 
@@ -86,32 +85,36 @@
86
85
  %table.data
87
86
  %thead
88
87
  %tr
89
- %th Qty
88
+ %th.qty Qty
90
89
  %th Item
91
90
  %th SKU
92
- %th Price
93
- %th= Shoppe.config[:tax_name]
94
- %th Sub-Total
91
+ %th.money Cost
92
+ %th.money Price
93
+ %th.money= Shoppe.config[:tax_name]
94
+ %th.money Sub-Total
95
95
  %tbody
96
96
  - for item in @order.order_items
97
97
  %tr
98
- %td= item.quantity
99
- %td= link_to item.product.title, [:edit, item.product]
100
- %td= item.product.sku
101
- %td= number_to_currency item.sub_total
102
- %td= number_to_currency item.tax_amount
103
- %td= number_to_currency item.total
98
+ %td.qty= item.quantity
99
+ %td.product= link_to item.product.title, [:edit, item.product]
100
+ %td.sku= item.product.sku
101
+ %td.money= number_to_currency item.total_cost
102
+ %td.money= number_to_currency item.sub_total
103
+ %td.money= number_to_currency item.tax_amount
104
+ %td.money= number_to_currency item.total
105
+ - if @order.delivery_service
106
+ %td.qty
107
+ %td.product= link_to @order.delivery_service.name, [:edit, @order.delivery_service]
108
+ %td.sku
109
+ %td.money= number_to_currency @order.delivery_cost_price
110
+ %td.money= number_to_currency @order.delivery_price
111
+ %td.money= number_to_currency @order.delivery_tax_amount
112
+ %td.money= number_to_currency @order.delivery_price + @order.delivery_tax_amount
104
113
  %tfoot
105
114
  %tr
106
- %td.right.bold{:colspan => 5}= link_to @order.delivery_service.name, [:edit, @order.delivery_service]
107
- %td= number_to_currency @order.delivery_price
108
- %tr
109
- %td.right.bold{:colspan => 5} Total (excluding #{Shoppe.config[:tax_name]})
110
- %td= number_to_currency @order.total_before_tax
111
- %tr
112
- %td.right.bold{:colspan => 5}= Shoppe.config[:tax_name]
113
- %td= number_to_currency @order.tax
114
- %tr
115
- %td.right.bold{:colspan => 5} Total
116
- %td= number_to_currency @order.total
117
-
115
+ %td.qty= @order.total_items
116
+ %td{:colspan => 2}
117
+ %td.money= number_to_currency @order.total_cost
118
+ %td.money= number_to_currency @order.total_before_tax
119
+ %td.money= number_to_currency @order.tax
120
+ %td.money= number_to_currency @order.total
@@ -1,12 +1,13 @@
1
1
  = form_for @product_category do |f|
2
2
  = f.error_messages
3
3
  = field_set_tag 'Category Details' do
4
- %dl
5
- %dt= f.label :name
6
- %dd= f.text_field :name
7
- %dl
8
- %dt= f.label :permalink
9
- %dd= f.text_field :permalink
4
+ .splitContainer
5
+ %dl.half
6
+ %dt= f.label :name
7
+ %dd= f.text_field :name
8
+ %dl.half
9
+ %dt= f.label :permalink
10
+ %dd= f.text_field :permalink
10
11
  %dl
11
12
  %dt= f.label :description
12
13
  %dd= f.text_area :description
@@ -1,6 +1,6 @@
1
1
  - @page_title = "Products"
2
2
  = content_for :header do
3
3
  %p.buttons= link_to "Back to categories list", :product_categories, :class => 'button'
4
- %h2 Edit Product Category ##{@product_category.id}
4
+ %h2.products Product Categories
5
5
  = render 'form'
6
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  = content_for :header do
4
4
  %p.buttons=link_to "New category", :new_product_category, :class => 'button green'
5
- %h2 Product Categories
5
+ %h2.products Product Categories
6
6
 
7
7
  .table
8
8
  %table.data
@@ -10,6 +10,10 @@
10
10
  %tr
11
11
  %th Name
12
12
  %tbody
13
- - for cat in @product_categories
14
- %tr
15
- %td= link_to cat.name, [:edit, cat]
13
+ - if @product_categories.empty?
14
+ %tr.empty
15
+ %td No categories to display.
16
+ - else
17
+ - for cat in @product_categories
18
+ %tr
19
+ %td= link_to cat.name, [:edit, cat]
@@ -1,5 +1,5 @@
1
1
  - @page_title = "Products"
2
2
  = content_for :header do
3
3
  %p.buttons= link_to "Back to categories list", :product_categories, :class => 'button'
4
- %h2 New Product Category
4
+ %h2.products Product Categories
5
5
  = render 'form'
@@ -1,19 +1,20 @@
1
1
  = form_for @product, :html => {:multipart => true} do |f|
2
2
  = f.error_messages
3
- = field_set_tag "Category" do
4
- %dl
5
- %dt= f.label :product_category_id
6
- %dd= f.collection_select :product_category_id, Shoppe::ProductCategory.ordered, :id, :name, :include_blank => true
7
3
  = field_set_tag "Product Information" do
8
4
  %dl
9
- %dt= f.label :title
10
- %dd= f.text_field :title
11
- %dl
12
- %dt= f.label :permalink
13
- %dd= f.text_field :permalink
14
- %dl
15
- %dt= f.label :sku, 'SKU'
16
- %dd= f.text_field :sku
5
+ %dt= f.label :product_category_id
6
+ %dd= f.collection_select :product_category_id, Shoppe::ProductCategory.ordered, :id, :name, {:include_blank => true}, {:class => 'chosen'}
7
+
8
+ .splitContainer
9
+ %dl.third
10
+ %dt= f.label :title
11
+ %dd= f.text_field :title
12
+ %dl.third
13
+ %dt= f.label :permalink
14
+ %dd= f.text_field :permalink
15
+ %dl.third
16
+ %dt= f.label :sku, 'SKU'
17
+ %dd= f.text_field :sku
17
18
  %dl
18
19
  %dt= f.label :description
19
20
  %dd= f.text_area :description
@@ -23,46 +24,88 @@
23
24
  %dl
24
25
  %dt= f.label :in_the_box, "What's in the box?"
25
26
  %dd= f.text_area :in_the_box
26
- = field_set_tag "Attachments" do
27
+
28
+ = field_set_tag "Attributes" do
29
+ .margin
30
+ %table.productAttributes
31
+ %thead
32
+ %tr
33
+ %td Name
34
+ %td Value
35
+ %td.searchable Searchable?
36
+ %td.searchable Public?
37
+ %td.remove Remove
38
+ %td
39
+ %tbody
40
+ %tr.template{:style => 'display:none;'}
41
+ %td= text_field_tag 'product[product_attributes_array][][key]', '', :placeholder => 'Name'
42
+ %td= text_field_tag 'product[product_attributes_array][][value]', '', :placeholder => 'Value'
43
+ %td.searchable= check_box_tag 'product[product_attributes_array][][searchable]', '1'
44
+ %td.searchable= check_box_tag 'product[product_attributes_array][][public]', '1'
45
+ %td.remove= link_to "Remove", '#', :class => 'button button-mini purple'
46
+ %td.handle
47
+ - for attribute in @product.product_attributes
48
+ %tr
49
+ %td= text_field_tag 'product[product_attributes_array][][key]', attribute.key, :placeholder => 'Name'
50
+ %td= text_field_tag 'product[product_attributes_array][][value]', attribute.value, :placeholder => 'Value'
51
+ %td.searchable= check_box_tag 'product[product_attributes_array][][searchable]', '1', attribute.searchable?
52
+ %td.searchable= check_box_tag 'product[product_attributes_array][][public]', '1', attribute.public?
53
+ %td.remove= link_to "Remove", '#', :class => 'button button-mini purple'
54
+ %td.handle
55
+ %p.addAttribute= link_to "Add attribute", '#', :data => {:behavior => 'addAttributeToAttributesTable'}, :class => 'button button-mini green'
27
56
 
28
- %dl
29
- %dt= f.label :default_image_file, "Default Image"
30
- %dd
31
- = attachment_preview @product.default_image
32
- %p= f.file_field :default_image_file
33
- %dl
34
- %dt= f.label :data_sheet_file, "Datasheet"
35
- %dd
36
- = attachment_preview @product.data_sheet
37
- %p= f.file_field :data_sheet_file
57
+ = field_set_tag "Attachments" do
58
+ .splitContainer
59
+ %dl.half
60
+ %dt= f.label :default_image_file, "Default Image"
61
+ %dd
62
+ = attachment_preview @product.default_image
63
+ %p= f.file_field :default_image_file
64
+ %dl.half
65
+ %dt= f.label :data_sheet_file, "Datasheet"
66
+ %dd
67
+ = attachment_preview @product.data_sheet
68
+ %p= f.file_field :data_sheet_file
38
69
 
39
70
  = field_set_tag "Pricing" do
40
- %dl
41
- %dt= f.label :price
42
- %dd= f.text_field :price
43
- %dl
44
- %dt= f.label :tax_rate
45
- %dd= f.text_field :tax_rate
71
+ .splitContainer
72
+ %dl.third
73
+ %dt= f.label :price
74
+ %dd= f.text_field :price
75
+ %dl.third
76
+ %dt= f.label :cost_price
77
+ %dd= f.text_field :cost_price
78
+ %dl.third
79
+ %dt= f.label :tax_rate
80
+ %dd= f.text_field :tax_rate
46
81
 
47
82
  = field_set_tag "Website Properties" do
48
- %dl
49
- %dt= f.label :active, "On sale?"
50
- %dd
51
- = f.check_box :active
52
- = f.label :active, "If checked, this product will be displayed within the public store"
53
- %dl
54
- %dt= f.label :featured, "Featured?"
55
- %dd
56
- = f.check_box :featured
57
- = f.label :featured, "If checked, this product will appear on your homepage"
83
+ .splitContainer
84
+
85
+ %dl.half
86
+ %dt= f.label :active, "On sale?"
87
+ %dd.checkbox
88
+ = f.check_box :active
89
+ = f.label :active, "If checked, this product will be displayed within the public store"
90
+ %dl.half
91
+ %dt= f.label :featured, "Featured?"
92
+ %dd.checkbox
93
+ = f.check_box :featured
94
+ = f.label :featured, "If checked, this product will appear on your homepage"
58
95
 
59
96
  = field_set_tag "Stock Control" do
60
- %dl
61
- %dt= f.label :weight
62
- %dd= f.text_field :weight
63
- %dl
64
- %dt= f.label :stock
65
- %dd= f.text_field :stock
97
+ .splitContainer
98
+ %dl.third
99
+ %dt= f.label :stock_control
100
+ %dd.checkbox
101
+ = f.check_box :stock_control
102
+ = f.label :stock_control, "Enable stock control for this product?"
103
+ %dl.third
104
+ %dt= f.label :stock, "Current stock"
105
+ %dd= f.text_field :stock
106
+ %dl.third
107
+ %dt= f.label :weight
108
+ %dd= f.text_field :weight
66
109
 
67
110
  %p.submit
68
111
  - unless @product.new_record?
@@ -1,5 +1,5 @@
1
1
  - @page_title = "Products"
2
2
  = content_for :header do
3
3
  %p.buttons= link_to "Back to products list", :products, :class => 'button'
4
- %h2 Edit Product ##{@product.id}
4
+ %h2.products Products
5
5
  = render 'form'
@@ -1,11 +1,8 @@
1
1
  - @page_title = "Products"
2
2
 
3
3
  = content_for :header do
4
- %p.buttons
5
- = link_to "New product", :new_product, :class => 'button green'
6
- = link_to "New category", :new_product_category, :class => 'button green'
7
-
8
- %h2 Products
4
+ %p.buttons= link_to "New product", :new_product, :class => 'button green'
5
+ %h2.products Products
9
6
 
10
7
  .table
11
8
  %table.data
@@ -16,12 +13,16 @@
16
13
  %th Price
17
14
  %th Stock
18
15
  %tbody
19
- - for category, products in @products
20
- %tr
21
- %th{:colspan => 4}= category.name
22
- - for product in products
16
+ - if @products.empty?
17
+ %tr.empty
18
+ %td{:colspan => 4} No products to display.
19
+ - else
20
+ - for category, products in @products
23
21
  %tr
24
- %td= product.sku
25
- %td= link_to product.title, [:edit, product]
26
- %td= number_to_currency product.price
27
- %td= product.stock
22
+ %th{:colspan => 4}= category.name
23
+ - for product in products
24
+ %tr
25
+ %td= product.sku
26
+ %td= link_to product.title, [:edit, product]
27
+ %td= number_to_currency product.price
28
+ %td= product.stock
@@ -1,5 +1,5 @@
1
1
  - @page_title = "Products"
2
2
  = content_for :header do
3
3
  %p.buttons= link_to "back to products list", :products, :class => 'button'
4
- %h2 New Product
4
+ %h2.products Products
5
5
  = render 'form'
@@ -1,22 +1,24 @@
1
1
  = form_for @user do |f|
2
2
  = f.error_messages
3
3
  = field_set_tag "User Details" do
4
- %dl
5
- %dt= f.label :first_name
6
- %dd= f.text_field :first_name
7
- %dl
8
- %dt= f.label :last_name
9
- %dd= f.text_field :last_name
4
+ .splitContainer
5
+ %dl.half
6
+ %dt= f.label :first_name
7
+ %dd= f.text_field :first_name
8
+ %dl.half
9
+ %dt= f.label :last_name
10
+ %dd= f.text_field :last_name
10
11
  = field_set_tag "Login" do
11
- %dl
12
- %dt= f.label :email_address
13
- %dd= f.text_field :email_address
14
- %dl
15
- %dt= f.label :password
16
- %dd= f.password_field :password
17
- %dl
18
- %dt= f.label :password_confirmation, "...and again"
19
- %dd= f.password_field :password_confirmation
12
+ .splitContainer
13
+ %dl.third
14
+ %dt= f.label :email_address
15
+ %dd= f.text_field :email_address
16
+ %dl.third
17
+ %dt= f.label :password
18
+ %dd= f.password_field :password
19
+ %dl.third
20
+ %dt= f.label :password_confirmation, "...and again"
21
+ %dd= f.password_field :password_confirmation
20
22
 
21
23
 
22
24
  %p.submit
@@ -1,5 +1,5 @@
1
1
  - @page_title = "Users"
2
2
  = content_for :header do
3
3
  %p.buttons= link_to "Back to users", :users, :class => 'button'
4
- %h2 Edit User #{@user.id}
4
+ %h2.users Users
5
5
  = render 'form'