refinerycms-products 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/app/controllers/addresses_controller.rb +22 -0
  2. data/app/controllers/admin/carts_controller.rb +7 -0
  3. data/app/controllers/admin/categories_controller.rb +50 -0
  4. data/app/controllers/admin/customers_controller.rb +12 -0
  5. data/app/controllers/admin/line_items_controller.rb +7 -0
  6. data/app/controllers/admin/products_controller.rb +23 -0
  7. data/app/controllers/carts_controller.rb +110 -0
  8. data/app/controllers/categories_controller.rb +32 -0
  9. data/app/controllers/customers_controller.rb +33 -0
  10. data/app/controllers/line_items_controller.rb +8 -0
  11. data/app/controllers/products_controller.rb +61 -0
  12. data/app/controllers/profiles_controller.rb +37 -0
  13. data/app/helpers/address_helper.rb +20 -0
  14. data/app/helpers/products_helper.rb +34 -0
  15. data/app/models/address.rb +18 -0
  16. data/app/models/cart.rb +54 -0
  17. data/app/models/category.rb +28 -0
  18. data/app/models/customer.rb +32 -0
  19. data/app/models/line_item.rb +28 -0
  20. data/app/models/product.rb +46 -0
  21. data/app/views/addresses/edit.html.erb +42 -0
  22. data/app/views/admin/carts/_actions.html.erb +28 -0
  23. data/app/views/admin/carts/_cart.html.erb +18 -0
  24. data/app/views/admin/carts/_carts.html.erb +2 -0
  25. data/app/views/admin/carts/_form.html.erb +24 -0
  26. data/app/views/admin/carts/_records.html.erb +18 -0
  27. data/app/views/admin/carts/_sortable_list.html.erb +7 -0
  28. data/app/views/admin/carts/edit.html.erb +1 -0
  29. data/app/views/admin/carts/index.html.erb +10 -0
  30. data/app/views/admin/carts/new.html.erb +1 -0
  31. data/app/views/admin/categories/_actions.html.erb +28 -0
  32. data/app/views/admin/categories/_categories.html.erb +2 -0
  33. data/app/views/admin/categories/_category.html.erb +25 -0
  34. data/app/views/admin/categories/_form.html.erb +49 -0
  35. data/app/views/admin/categories/_records.html.erb +18 -0
  36. data/app/views/admin/categories/_sortable_list.html.erb +10 -0
  37. data/app/views/admin/categories/edit.html.erb +1 -0
  38. data/app/views/admin/categories/index.html.erb +12 -0
  39. data/app/views/admin/categories/new.html.erb +1 -0
  40. data/app/views/admin/customers/_actions.html.erb +28 -0
  41. data/app/views/admin/customers/_customer.html.erb +18 -0
  42. data/app/views/admin/customers/_customers.html.erb +2 -0
  43. data/app/views/admin/customers/_form.html.erb +40 -0
  44. data/app/views/admin/customers/_records.html.erb +18 -0
  45. data/app/views/admin/customers/_sortable_list.html.erb +7 -0
  46. data/app/views/admin/customers/edit.html.erb +1 -0
  47. data/app/views/admin/customers/index.html.erb +10 -0
  48. data/app/views/admin/customers/new.html.erb +1 -0
  49. data/app/views/admin/customers/show.html.erb +60 -0
  50. data/app/views/admin/line_items/_actions.html.erb +28 -0
  51. data/app/views/admin/line_items/_form.html.erb +29 -0
  52. data/app/views/admin/line_items/_line_item.html.erb +18 -0
  53. data/app/views/admin/line_items/_line_items.html.erb +2 -0
  54. data/app/views/admin/line_items/_records.html.erb +18 -0
  55. data/app/views/admin/line_items/_sortable_list.html.erb +7 -0
  56. data/app/views/admin/line_items/edit.html.erb +1 -0
  57. data/app/views/admin/line_items/index.html.erb +10 -0
  58. data/app/views/admin/line_items/new.html.erb +1 -0
  59. data/app/views/admin/products/_actions.html.erb +43 -0
  60. data/app/views/admin/products/_form.html.erb +120 -0
  61. data/app/views/admin/products/_product.html.erb +24 -0
  62. data/app/views/admin/products/_products.html.erb +2 -0
  63. data/app/views/admin/products/_records.html.erb +18 -0
  64. data/app/views/admin/products/_sortable_list.html.erb +13 -0
  65. data/app/views/admin/products/edit.html.erb +1 -0
  66. data/app/views/admin/products/index.html.erb +12 -0
  67. data/app/views/admin/products/new.html.erb +1 -0
  68. data/app/views/carts/show.html.erb +56 -0
  69. data/app/views/categories/index.html.erb +11 -0
  70. data/app/views/categories/show.html.erb +33 -0
  71. data/app/views/customers/index.html.erb +11 -0
  72. data/app/views/customers/show.html.erb +52 -0
  73. data/app/views/line_items/index.html.erb +11 -0
  74. data/app/views/line_items/show.html.erb +39 -0
  75. data/app/views/products/index.html.erb +33 -0
  76. data/app/views/products/show.html.erb +65 -0
  77. data/app/views/profiles/_order_history.html.erb +24 -0
  78. data/app/views/profiles/_show_address.html.erb +4 -0
  79. data/app/views/profiles/account_details.html.erb +32 -0
  80. data/app/views/profiles/address_details.html.erb +10 -0
  81. data/app/views/profiles/index.html.erb +75 -0
  82. data/app/views/profiles/order_history.html.erb +1 -0
  83. data/app/views/profiles/order_history_details.html.erb +39 -0
  84. data/config/locales/en.yml +97 -0
  85. data/config/locales/fr.yml +25 -0
  86. data/config/locales/lolcat.yml +25 -0
  87. data/config/locales/nb.yml +21 -0
  88. data/config/locales/nl.yml +21 -0
  89. data/config/routes.rb +58 -0
  90. data/lib/generators/refinerycms_products_generator.rb +6 -0
  91. data/lib/refinerycms-carts.rb +32 -0
  92. data/lib/refinerycms-categories.rb +30 -0
  93. data/lib/refinerycms-customers.rb +34 -0
  94. data/lib/refinerycms-line_items.rb +30 -0
  95. data/lib/refinerycms-products.rb +65 -0
  96. data/lib/tasks/products.rake +13 -0
  97. metadata +160 -0
@@ -0,0 +1,10 @@
1
+ <section id='records'>
2
+ <%= render :partial => 'records' %>
3
+ </section>
4
+ <aside id='actions'>
5
+ <%= render :partial => 'actions' %>
6
+ </aside>
7
+ <%= render :partial => '/shared/admin/make_sortable',
8
+ :locals => {
9
+ :tree => false
10
+ } if !searching? and Admin::LineItemsController.sortable? and LineItem.count > 1 %>
@@ -0,0 +1 @@
1
+ <%= render :partial => "form" %>
@@ -0,0 +1,43 @@
1
+
2
+ <% if Admin::ProductsController.searchable? %>
3
+ <ul class='search_list'>
4
+ <li class='not_a_link'>
5
+ <%= render :partial => "/shared/admin/search",
6
+ :locals => {
7
+ :url => admin_products_path
8
+ } %>
9
+ </li>
10
+ </ul>
11
+ <% end %>
12
+
13
+ <ul class='collapsible_menu'>
14
+ <li class='not_a_link'>
15
+ <%= link_to 'Categories', '#' %>
16
+ </li>
17
+ <% Category.all.each do |category| %>
18
+ <li>
19
+ <%= link_to category.name, admin_category_products_path(category) %>
20
+ </li>
21
+ <% end %>
22
+ </ul>
23
+
24
+ <ul>
25
+ <li>
26
+ <%= link_to t('.create_new'), new_admin_product_path,
27
+ :class => "add_icon" %>
28
+ </li>
29
+ <% if !searching? and Admin::ProductsController.sortable? and Product.count > 1 %>
30
+ <li class='not_a_link'>
31
+ <%= link_to t('.reorder', :what => "Products"),
32
+ admin_products_path,
33
+ :id => "reorder_action",
34
+ :class => "reorder_icon" %>
35
+
36
+ <%= link_to t('.reorder_done', :what => "Products"),
37
+ admin_products_path,
38
+ :id => "reorder_action_done",
39
+ :style => "display: none;",
40
+ :class => "reorder_icon" %>
41
+ </li>
42
+ <% end %>
43
+ </ul>
@@ -0,0 +1,120 @@
1
+ <%= form_for [:admin, @product] do |f| -%>
2
+ <%= render :partial => "/shared/admin/error_messages", :locals => {
3
+ :object => @product,
4
+ :include_object_name => true
5
+ } %>
6
+
7
+ <div class='field'>
8
+ <%= f.label :name -%>
9
+ <%= f.text_field :name, :class => 'larger widest' -%>
10
+ </div>
11
+
12
+ <div class='field'>
13
+ <%= f.label :description -%>
14
+ <%= f.text_field :description, :class => 'larger widest' -%>
15
+ </div>
16
+
17
+ <div class='field'>
18
+ <%= f.label :tag_list -%>
19
+ <%= f.text_field :tag_list -%>
20
+ </div>
21
+
22
+ <div class='field'>
23
+ <div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
24
+ <ul id='page_parts'>
25
+ <% [:summary].each_with_index do |part, part_index| %>
26
+ <li class='ui-state-default<%= ' ui-state-active' if part_index == 0 %>'>
27
+ <%= link_to part.to_s.titleize, "##{part}" %>
28
+ </li>
29
+ <% end %>
30
+ </ul>
31
+
32
+ <div id='page_part_editors'>
33
+ <% [:summary].each do |part| %>
34
+ <div class='page_part' id='<%= part %>'>
35
+ <%= f.text_area part, :rows => 20, :class => 'wymeditor widest' -%>
36
+ </div>
37
+ <% end %>
38
+ </div>
39
+ </div>
40
+ </div>
41
+
42
+ <div class='field'>
43
+ <%= f.label :price -%>
44
+ <%= f.text_field :price -%>
45
+ </div>
46
+
47
+ <div class='field'>
48
+ <%= f.label :stock_code -%>
49
+ <%= f.text_field :stock_code -%>
50
+ </div>
51
+
52
+ <div class='field'>
53
+ <%= f.label :image -%>
54
+ <%= render :partial => "/shared/admin/image_picker", :locals => {
55
+ :f => f,
56
+ :field => :image_id,
57
+ :image => @product.image,
58
+ :toggle_image_display => false
59
+ } %>
60
+ </div>
61
+
62
+ <div class="field">
63
+ <%= f.label :categories %>
64
+ <% for category in Category.find(:all) %>
65
+ <% if category.children.present? %>
66
+ <div>
67
+ <% if @product.categories.include?(category) %>
68
+ <%= check_box_tag "product[category_ids][]", category.id, @product.categories.include?(category) %>
69
+ <% else %>
70
+ <img src="/images/arrow.png" height="13px" width="13px" style="margin:3px; vertical-align:bottom;">
71
+ <% end %>
72
+ <%= raw category.name %>
73
+ </div>
74
+ <% category.children.each do |child_category| %>
75
+ <div style="margin-left:18px;">
76
+ <%= check_box_tag "product[category_ids][]", child_category.id, @product.categories.include?(child_category) %>
77
+ <%= child_category.name %>
78
+ </div>
79
+ <% end %>
80
+ <% else %>
81
+ <% unless category.parent.present? %>
82
+ <div>
83
+ <%= check_box_tag "product[category_ids][]", category.id, @product.categories.include?(category) %>
84
+ <%= category.name %>
85
+ </div>
86
+ <% end %>
87
+ <% end %>
88
+ <% end %>
89
+ </div>
90
+
91
+ <div class='field'>
92
+ <%= f.label :best_seller -%>
93
+ <%= f.check_box :best_seller -%>
94
+ </div>
95
+
96
+ <div class='field'>
97
+ <%= f.label :new_product -%>
98
+ <%= f.check_box :new_product -%>
99
+ </div>
100
+
101
+ <div class='field'>
102
+ <%= f.label :featured -%>
103
+ <%= f.check_box :featured -%>
104
+ </div>
105
+
106
+ <%= render :partial => "/shared/admin/form_actions",
107
+ :locals => {
108
+ :f => f,
109
+ :continue_editing => false,
110
+ :delete_title => t('delete', :scope => 'admin.products.product'),
111
+ :delete_confirmation => t('message', :scope => 'shared.admin.delete', :title => @product.name)
112
+ } %>
113
+ <% end -%>
114
+ <% content_for :javascripts do %>
115
+ <script>
116
+ $(document).ready(function(){
117
+ page_options.init(false, '', '');
118
+ });
119
+ </script>
120
+ <% end %>
@@ -0,0 +1,24 @@
1
+ <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(product) -%>">
2
+ <span class='title'>
3
+ <%= product.name %>
4
+ <span class="preview">
5
+ <br>
6
+ <%= fields_for "products[]", product do |f| %>
7
+ <b>Price:</b> <%= f.text_field :price, :size => 5%>
8
+ <% end %>
9
+
10
+ </span>
11
+ </span>
12
+ <span class='actions'>
13
+ <%= link_to refinery_icon_tag("application_go.png"), product_path(product),
14
+ :title => t('.view_live_html'),
15
+ :target => "_blank" %>
16
+ <%= link_to refinery_icon_tag("application_edit.png"), edit_admin_product_path(product),
17
+ :title => t('.edit') %>
18
+ <%= link_to refinery_icon_tag("delete.png"), admin_product_path(product),
19
+ :class => "cancel confirm-delete",
20
+ :title => t('.delete'),
21
+ :confirm => t('message', :scope => 'shared.admin.delete', :title => product.name),
22
+ :method => :delete %>
23
+ </span>
24
+ </li>
@@ -0,0 +1,2 @@
1
+ <%= will_paginate @products %>
2
+ <%= render :partial => "sortable_list" %>
@@ -0,0 +1,18 @@
1
+ <% if searching? %>
2
+ <h2><%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
3
+ <% end %>
4
+ <% if @products.any? %>
5
+ <div class='pagination_container'>
6
+ <%= render :partial => 'products' %>
7
+ </div>
8
+ <% else %>
9
+ <p>
10
+ <% unless searching? %>
11
+ <strong>
12
+ <%= t('.no_items_yet') %>
13
+ </strong>
14
+ <% else %>
15
+ <%= t('no_results', :scope => 'shared.admin.search') %>
16
+ <% end %>
17
+ </p>
18
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <ul id='sortable_list'>
2
+ <!-- <%#= form_tag([:admin, @product], :method => 'post') do %> -->
3
+ <%= form_tag(update_prices_admin_products_path, {:method => :put}) do %>
4
+ <%= render :partial => 'product', :collection => @products %>
5
+ <%= submit_tag "Edit Prices" %>
6
+ <% end %>
7
+ </ul>
8
+
9
+
10
+ <%= render :partial => "/shared/admin/sortable_list",
11
+ :locals => {
12
+ :continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true
13
+ } %>
@@ -0,0 +1 @@
1
+ <%= render :partial => "form" %>
@@ -0,0 +1,12 @@
1
+ <section id='records'>
2
+ <%= render :partial => 'records' %>
3
+ </section>
4
+ <!-- <aside id='actions'> -->
5
+ <nav id='actions' class='multilist'>
6
+ <%= render :partial => 'actions' %>
7
+ </nav>
8
+ <!-- </aside> -->
9
+ <%= render :partial => '/shared/admin/make_sortable',
10
+ :locals => {
11
+ :tree => false
12
+ } if !searching? and Admin::ProductsController.sortable? and Product.count > 1 %>
@@ -0,0 +1 @@
1
+ <%= render :partial => "form" %>
@@ -0,0 +1,56 @@
1
+ <% content_for :body_content_left do %>
2
+
3
+ <% cart = @current_cart %>
4
+
5
+ <%= form_tag(customer_signed_in? ? (defined?(OrdersController) ? delivery_address_path : "#") : "#" ) do %>
6
+
7
+ <% if cart.line_items.present? %>
8
+ <table>
9
+ <th>Product</th>
10
+ <th class="price">Unit Price</th>
11
+ <th>Qty</th>
12
+ <th>Modify Quantity / Delete</th>
13
+ <th class="price">Full Price</th>
14
+
15
+ <% cart.line_items.each do |cart_item| %>
16
+ <tr>
17
+ <td><%= product_or_variant_name(cart_item) %></td>
18
+ <td><%= product_or_variant_price(cart_item) %></td>
19
+ <td><%= cart_item.quantity %></td>
20
+ <td><%= link_to image_tag("/images/plus.png", :size => "20x20"), variant_exists?(cart_item) ? increment_cart_path(cart_item.product, :quantity => 1, :variant => {:id => cart_item.variant}) : increment_cart_path(cart_item.product) %>
21
+ <%= link_to image_tag("/images/minus.png", :size => "20x20"), variant_exists?(cart_item) ? increment_cart_path(cart_item.product, :quantity => -1, :variant => {:id => cart_item.variant}) : increment_cart_path(cart_item.product, :quantity => -1) unless cart_item.quantity == 1 %>
22
+ <%= link_to "Delete", destroy_line_item_path(cart_item), :confirm => 'Are you sure?' %>
23
+ </td>
24
+ <td><%= variant_exists?(cart_item) ? rands(cart_item.variant.price * cart_item.quantity) : rands(cart_item.product.price * cart_item.quantity) %></td>
25
+ </tr>
26
+ <% end %>
27
+
28
+ <tr>
29
+ <td colspan="4">TOTAL</td>
30
+ <td><%= rands(cart.grand_total) %></td>
31
+ </tr>
32
+ </table>
33
+
34
+ <% if defined?(OrdersController) %>
35
+ <div class="orderButton"><%= submit_tag 'Checkout', :id => customer_signed_in? ? "" : "checkout" %></div>
36
+ <% end %>
37
+ <% else %>
38
+ <p>Your cart is currently empty.</p>
39
+ <% end %>
40
+
41
+
42
+ <% end %>
43
+
44
+ <script type="text/javascript">
45
+ if (typeof jQuery != 'undefined') {
46
+ $(document).ready(function() {
47
+ $('a.single').click(function(e) {
48
+ e.preventDefault();
49
+ });
50
+ });
51
+ }
52
+ </script>
53
+
54
+ <% end %>
55
+
56
+ <%= render :partial => "/shared/content_page" %>
@@ -0,0 +1,11 @@
1
+ <% content_for :body_content_left do %>
2
+ <ul id="categories">
3
+ <% @categories.each do |category| %>
4
+ <li>
5
+ <%= link_to category.name, category_path(category) %>
6
+ </li>
7
+ <% end %>
8
+ </ul>
9
+ <% end %>
10
+
11
+ <%= render :partial => "/shared/content_page" %>
@@ -0,0 +1,33 @@
1
+ <% content_for :body_content_title do %>
2
+ <%= @category.name %>
3
+ <% end %>
4
+
5
+ <% content_for :body_content_left do %>
6
+ <section>
7
+ <h1>Name</h1>
8
+ <p>
9
+ <%=raw @category.name %>
10
+ </p>
11
+ </section>
12
+ <section>
13
+ <h1>Parent</h1>
14
+ <p>
15
+ <%=raw @category.parent %>
16
+ </p>
17
+ </section>
18
+ <% end %>
19
+
20
+ <% content_for :body_content_right do %>
21
+ <aside>
22
+ <h2><%= t('.other') %></h2>
23
+ <ul id="categories">
24
+ <% @categories.each do |category| %>
25
+ <li>
26
+ <%= link_to category.name, category_path(category) %>
27
+ </li>
28
+ <% end %>
29
+ </ul>
30
+ </aside>
31
+ <% end %>
32
+
33
+ <%= render :partial => "/shared/content_page" %>
@@ -0,0 +1,11 @@
1
+ <% content_for :body_content_left do %>
2
+ <ul id="customers">
3
+ <% @customers.each do |customer| %>
4
+ <li>
5
+ <%= link_to customer.name, customer_path(customer) %>
6
+ </li>
7
+ <% end %>
8
+ </ul>
9
+ <% end %>
10
+
11
+ <%= render :partial => "/shared/content_page" %>
@@ -0,0 +1,52 @@
1
+ <% content_for :body_content_title do %>
2
+ <%= @customer.name %>
3
+ <% end %>
4
+
5
+ <% content_for :body_content_left do %>
6
+ <section>
7
+ <h1>Name</h1>
8
+ <p>
9
+ <%=raw @customer.name %>
10
+ </p>
11
+ </section>
12
+ <section>
13
+ <h1>Surname</h1>
14
+ <p>
15
+ <%=raw @customer.surname %>
16
+ </p>
17
+ </section>
18
+ <section>
19
+ <h1>Contact Number</h1>
20
+ <p>
21
+ <%=raw @customer.contact_number %>
22
+ </p>
23
+ </section>
24
+
25
+ <section>
26
+ <h1>Email</h1>
27
+ <p>
28
+ <%=raw @customer.email %>
29
+ </p>
30
+ </section>
31
+ <section>
32
+ <h1>Encrypted Password</h1>
33
+ <p>
34
+ <%=raw @customer.encrypted_password %>
35
+ </p>
36
+ </section>
37
+ <% end %>
38
+
39
+ <% content_for :body_content_right do %>
40
+ <aside>
41
+ <h2><%= t('.other') %></h2>
42
+ <ul id="customers">
43
+ <% @customers.each do |customer| %>
44
+ <li>
45
+ <%= link_to customer.name, customer_path(customer) %>
46
+ </li>
47
+ <% end %>
48
+ </ul>
49
+ </aside>
50
+ <% end %>
51
+
52
+ <%= render :partial => "/shared/content_page" %>
@@ -0,0 +1,11 @@
1
+ <% content_for :body_content_left do %>
2
+ <ul id="line_items">
3
+ <% @line_items.each do |line_item| %>
4
+ <li>
5
+ <%= link_to line_item, line_item_path(line_item) %>
6
+ </li>
7
+ <% end %>
8
+ </ul>
9
+ <% end %>
10
+
11
+ <%= render :partial => "/shared/content_page" %>
@@ -0,0 +1,39 @@
1
+ <% content_for :body_content_title do %>
2
+ <%= @line_item.title %>
3
+ <% end %>
4
+
5
+ <% content_for :body_content_left do %>
6
+ <section>
7
+ <h1>Cart</h1>
8
+ <p>
9
+ <%=raw @line_item.cart %>
10
+ </p>
11
+ </section>
12
+ <section>
13
+ <h1>Product</h1>
14
+ <p>
15
+ <%=raw @line_item.product %>
16
+ </p>
17
+ </section>
18
+ <section>
19
+ <h1>Quantity</h1>
20
+ <p>
21
+ <%=raw @line_item.quantity %>
22
+ </p>
23
+ </section>
24
+ <% end %>
25
+
26
+ <% content_for :body_content_right do %>
27
+ <aside>
28
+ <h2><%= t('.other') %></h2>
29
+ <ul id="line_items">
30
+ <% @line_items.each do |line_item| %>
31
+ <li>
32
+ <%= link_to line_item.title, line_item_path(line_item) %>
33
+ </li>
34
+ <% end %>
35
+ </ul>
36
+ </aside>
37
+ <% end %>
38
+
39
+ <%= render :partial => "/shared/content_page" %>
@@ -0,0 +1,33 @@
1
+ <% content_for :body_content_title do %>
2
+ Catalogue - <%= @page_title %>
3
+ <% end %>
4
+
5
+ <% content_for :body_content_left do %>
6
+
7
+
8
+ <% if @products.blank? %>
9
+ <p><i>Sorry, we can't find any products. Either we're out of stock, or there are no products belonging to the category that you selected.</i></p>
10
+ <% else %>
11
+
12
+ <%= content_tag('p', raw(@category.description)) if @category.present? %>
13
+
14
+ <% @products.each do |product| %>
15
+ <div class="pod quarter product omega">
16
+ <div class="corner"><img src="/images/corner.png" /></div>
17
+ <%= link_to(image_fu(product.image, "200x200#c", :id => "variant_id"), product_path(product)) %>
18
+ <hr>
19
+ <div class="productname"><%= raw product.name %></div>
20
+ <p><i><%= raw product.description %></i></p>
21
+ <div class="add_to_cart">
22
+
23
+ <p><%= link_to "Details", product_path(product) %></p>
24
+
25
+ </div>
26
+ </div>
27
+ <% end %>
28
+
29
+ <% end %>
30
+ <% end %>
31
+
32
+ <%= render :partial => "/shared/content_page" %>
33
+
@@ -0,0 +1,65 @@
1
+ <% content_for :body_content_title do %>
2
+ <%= @product.name %>
3
+ <% end %>
4
+
5
+ <% content_for :body_content_left do %>
6
+ <div class="pod threequarter product_wider alpha">
7
+ <div class="corner"><img src="/images/corner.png" /></div>
8
+ <div class="image"><%= image_fu(@product.image, "400x400#c", :id => "variant_id") %></div>
9
+ <hr>
10
+ <div class="productname"><%= raw @product.name %></div>
11
+ <p><i><%= raw @product.summary %></i></p>
12
+ <div class="price">Price: <%= raw rands(@product.price) %></div>
13
+ <div class="add_to_cart">
14
+ <%= form_tag(add_to_cart_path(@product)) do |f| %>
15
+ <% if defined?(Variant) && @product.variants.present? %>
16
+ <%= collection_select(:variant, :id, @product.variants.order(:name), :id, :name, {}, {:class => "variant"}) -%>
17
+ <% end %>
18
+ <p><%= image_submit_tag("/images/cart.png") %></p>
19
+ <% end %>
20
+ </div>
21
+ </div>
22
+
23
+ <% if @tagged_products.present? %>
24
+ <h2>Customers who bought this also bought...</h2>
25
+ <% @tagged_products.each do |product| %>
26
+ <% unless product.id == @product.id %>
27
+ <div class="pod quarter product omega">
28
+ <div class="corner"><img src="/images/corner.png" /></div>
29
+ <%= link_to(image_fu(product.image, "200x200#c", :id => "variant_id"), product_path(product)) %>
30
+ <hr>
31
+ <div class="productname"><%= raw product.name %></div>
32
+ <p><i><%= raw product.description %></i></p>
33
+ <div class="add_to_cart">
34
+ <p><%= link_to "Details", product_path(product) %></p>
35
+ </div>
36
+ </div>
37
+ <% end %>
38
+ <% end %>
39
+ <% end %>
40
+ <% end %>
41
+
42
+
43
+ <%= render :partial => "/shared/content_page" %>
44
+
45
+ <script type="text/javascript">
46
+ $(document).ready(function() {
47
+ $('.variant').change(function() {
48
+ change_variant();
49
+ });
50
+
51
+ change_variant();
52
+
53
+ function change_variant() {
54
+ var currentId = $('.variant').val();
55
+
56
+ $.get('/get_variant_image/'+currentId, function(data) {
57
+ $('img#variant_id').attr('src', data);
58
+ });
59
+
60
+ $.get('/get_variant_price/'+currentId, function(data) {
61
+ $('.price').html('Price: '+data);
62
+ });
63
+ }
64
+ });
65
+ </script>
@@ -0,0 +1,24 @@
1
+ <% if @orders.present? then %>
2
+ <div >
3
+ <h2 class="category">Order History</h2>
4
+
5
+ <table>
6
+ <tr>
7
+ <th>Order Number</th>
8
+ <th>Status</th>
9
+ <th>Date</th>
10
+ <th>Total Price</th>
11
+ </tr>
12
+ <% @orders.each do |order| %>
13
+ <tr class="<%= cycle('odd', 'even') %>">
14
+ <td><%= link_to order.order_number, order_history_details_path(order.order_number) %></td>
15
+ <td><%= order.order_status %></td>
16
+ <td><%= order.created_at.strftime("%m/%d/%Y") if order.created_at.present? %></td>
17
+ <td><%= order.grand_total if order.grand_total.present? %></td>
18
+ </tr>
19
+ <% end %>
20
+ </table>
21
+ </div>
22
+ <% end %>
23
+
24
+ <%= link_to "Back", profiles_path %>
@@ -0,0 +1,4 @@
1
+ <div class="show_address rounded-corners">
2
+ <%= raw(address_html(address)) %>
3
+ <p><%= link_to(url_text, url) %></p>
4
+ </div>
@@ -0,0 +1,32 @@
1
+ <h2 class="category">Customer Details</h2>
2
+
3
+ <div class='newform'>
4
+ <%= form_for(@current_customer) do |f| %>
5
+
6
+ <%= f.label :name %>
7
+ <div class='input'>
8
+ <%= f.text_field :name, :disabled => true %>
9
+ </div>
10
+
11
+ <%= f.label :surname %>
12
+ <div class='input'>
13
+ <%= f.text_field :surname, :disabled => true %>
14
+ </div>
15
+
16
+ <%= f.label :contact_number %>
17
+ <div class='input'>
18
+ <%= f.text_field :contact_number, :disabled => true %>
19
+ </div>
20
+
21
+ <%= f.label :email %>
22
+ <div class='input'>
23
+ <%= f.email_field :email, :disabled => true %>
24
+ </div>
25
+ <% end %>
26
+
27
+
28
+ <div class="clear"></div>
29
+ <br />
30
+ <%= link_to "Back", profiles_path %> | <%= link_to "Edit Details", edit_customer_registration_path %>
31
+
32
+ </div>
@@ -0,0 +1,10 @@
1
+ <h2 class="category">Addresses</h2>
2
+
3
+ <% if @delivery_addresses.present? %>
4
+ <% @delivery_addresses.each do |address| %>
5
+ <%= render :partial => 'show_address', :locals => {:address => address, :url_text => 'Edit this address', :url => edit_address_path(address)} %>
6
+ <% end %>
7
+ <% else %>
8
+ <p>Sorry, we have no record of any addresses on your account.</p>
9
+ <% end %>
10
+ <div class="clear"></div>