spree_suppliers 0.1.0 → 0.60.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. data/README +46 -0
  2. data/Rakefile +137 -0
  3. data/app/controllers/admin/pickup_locations_controller.rb +52 -0
  4. data/app/controllers/admin/pickups_controller.rb +84 -0
  5. data/app/controllers/admin/shipping_options_controller.rb +32 -0
  6. data/app/controllers/admin/supplier_taxons_controller.rb +65 -0
  7. data/app/controllers/admin/suppliers_controller.rb +203 -0
  8. data/app/controllers/admin/vendor_overview_controller.rb +18 -0
  9. data/app/controllers/dash/base_controller.rb +10 -0
  10. data/app/controllers/dash/overview_controller.rb +6 -0
  11. data/app/controllers/dash/pickup_locations_controller.rb +27 -0
  12. data/app/controllers/dash/pickups_controller.rb +40 -0
  13. data/app/controllers/dash/products_controller.rb +15 -0
  14. data/app/controllers/messages_controller.rb +17 -0
  15. data/app/controllers/suppliers_controller.rb +19 -0
  16. data/app/controllers/user_sessions_decorator.rb +39 -0
  17. data/app/helpers/admin/suppliers_helper.rb +21 -0
  18. data/app/helpers/cities_helper.rb +2 -0
  19. data/app/helpers/dragonfly_helper.rb +16 -0
  20. data/app/helpers/messages_helper.rb +2 -0
  21. data/app/helpers/suppliers_helper.rb +16 -0
  22. data/app/mailers/supplier_mailer.rb +11 -0
  23. data/app/models/ability_decorator.rb +19 -0
  24. data/app/models/delivery.rb +6 -0
  25. data/app/models/hour.rb +4 -0
  26. data/app/models/item.rb +5 -0
  27. data/app/models/message.rb +3 -0
  28. data/app/models/pickup.rb +10 -0
  29. data/app/models/pickup_date.rb +3 -0
  30. data/app/models/pickup_location.rb +7 -0
  31. data/app/models/supplier.rb +33 -0
  32. data/app/models/supplier_invoice.rb +5 -0
  33. data/app/views/admin/orders/index.html.erb +107 -0
  34. data/app/views/admin/orders/show.html.erb +35 -0
  35. data/app/views/admin/orders/user.html.erb +19 -0
  36. data/app/views/admin/pickup_locations/_pickup_location.html.erb +10 -0
  37. data/app/views/admin/pickup_locations/edit.html.erb +44 -0
  38. data/app/views/admin/pickup_locations/new.html.erb +48 -0
  39. data/app/views/admin/pickup_locations/show.html.erb +1 -0
  40. data/app/views/admin/pickups/_pickup.erb +0 -0
  41. data/app/views/admin/pickups/index.html.erb +44 -0
  42. data/app/views/admin/pickups/new.html.erb +33 -0
  43. data/app/views/admin/pickups/show.html.erb +42 -0
  44. data/app/views/admin/products/_suppliers_form.html.erb +5 -0
  45. data/app/views/admin/shared/_order_tabs_decide.html.erb +5 -0
  46. data/app/views/admin/shared/_vendor_order_tabs.html.erb +39 -0
  47. data/app/views/admin/shipping_options/edit.html.erb +38 -0
  48. data/app/views/admin/supplier_taxons/_form.html.erb +23 -0
  49. data/app/views/admin/supplier_taxons/_taxon_table.html.erb +23 -0
  50. data/app/views/admin/supplier_taxons/available.js.erb +33 -0
  51. data/app/views/admin/supplier_taxons/edit.html.erb +11 -0
  52. data/app/views/admin/supplier_taxons/remove.html.erb +1 -0
  53. data/app/views/admin/supplier_taxons/select.js.erb +2 -0
  54. data/app/views/admin/supplier_taxons/selected.html.erb +51 -0
  55. data/app/views/admin/suppliers/_edit_form.html.erb +75 -0
  56. data/app/views/admin/suppliers/_edit_hours_form.html.erb +18 -0
  57. data/app/views/admin/suppliers/_form.html.erb +72 -0
  58. data/app/views/admin/suppliers/_hours_form.html.erb +11 -0
  59. data/app/views/admin/suppliers/_image_form.html.erb +40 -0
  60. data/app/views/admin/suppliers/_supplier.html.erb +37 -0
  61. data/app/views/admin/suppliers/_supplier_tabs.html.erb +18 -0
  62. data/app/views/admin/suppliers/_suppliers_table.html.erb +25 -0
  63. data/app/views/admin/suppliers/_upload_image.html.erb +14 -0
  64. data/app/views/admin/suppliers/available.js.erb +34 -0
  65. data/app/views/admin/suppliers/edit.html.erb +20 -0
  66. data/app/views/admin/suppliers/index.html.erb +102 -0
  67. data/app/views/admin/suppliers/line_items.html.erb +20 -0
  68. data/app/views/admin/suppliers/new.html.erb +22 -0
  69. data/app/views/admin/suppliers/remove.html.erb +1 -0
  70. data/app/views/admin/suppliers/select.html.erb +1 -0
  71. data/app/views/admin/suppliers/selected.html.erb +40 -0
  72. data/app/views/admin/suppliers/show.html.erb +2 -0
  73. data/app/views/admin/users/_form.html.erb +40 -0
  74. data/app/views/admin/vendor_overview/index.html.erb +1 -0
  75. data/app/views/checkout/_delivery.html.erb +5 -0
  76. data/app/views/dash/overview/index.html.erb +58 -0
  77. data/app/views/dash/pickup_locations/_pickup_location.html.erb +3 -0
  78. data/app/views/dash/pickup_locations/new.html.erb +47 -0
  79. data/app/views/dash/pickups/_pickup.erb +3 -0
  80. data/app/views/dash/pickups/new.html.erb +24 -0
  81. data/app/views/dash/products/new.html.erb +38 -0
  82. data/app/views/layouts/admin.html.erb +81 -0
  83. data/app/views/messages/_message_form.html.erb +17 -0
  84. data/app/views/messages/create.html.erb +2 -0
  85. data/app/views/messages/destroy.html.erb +2 -0
  86. data/app/views/messages/new.html.erb +2 -0
  87. data/app/views/shared/_deliveries.html.erb +113 -0
  88. data/app/views/shared/_hours.html.erb +21 -0
  89. data/app/views/shared/_products_vendor.html.erb +49 -0
  90. data/app/views/shared/_supplier_invoices.html.erb +67 -0
  91. data/app/views/supplier_mailer/invoice_email.html.erb +72 -0
  92. data/app/views/suppliers/_supplier.html.erb +7 -0
  93. data/app/views/suppliers/_supplier_list.erb +20 -0
  94. data/app/views/suppliers/index.html.erb +17 -0
  95. data/app/views/suppliers/show.html.erb +106 -0
  96. data/app/views/suppliers/supplier_list.erb +14 -0
  97. data/config/initializers/dragonfly.rb +8 -0
  98. data/config/initializers/supplier_invoice_mailer.rb +10 -0
  99. data/config/locales/en-US.yml +13 -0
  100. data/config/routes.rb +48 -0
  101. data/db/migrate/20091209201716_supplier_setup.rb +36 -0
  102. data/db/migrate/20110922213437_create_messages.rb +18 -0
  103. data/db/migrate/20110928203155_create_hours.rb +21 -0
  104. data/db/migrate/20111006185052_create_pickups.rb +17 -0
  105. data/db/migrate/20111010191125_add_location_to_addresses.rb +9 -0
  106. data/db/migrate/20111010214313_create_pickup_dates.rb +14 -0
  107. data/db/migrate/20111011180211_add_supplier_id_to_user.rb +9 -0
  108. data/db/migrate/20111012211422_create_pickup_locations.rb +21 -0
  109. data/db/migrate/20111013155257_create_supplier_invoices.rb +16 -0
  110. data/db/migrate/20111013161225_create_items.rb +18 -0
  111. data/db/migrate/20111018133543_add_attributes_to_products.rb +17 -0
  112. data/db/migrate/20111028190454_add_attributes_to_assets.rb +11 -0
  113. data/db/migrate/20111029230805_create_suppliers_taxons.rb +16 -0
  114. data/db/migrate/20111101165933_create_deliveries.rb +17 -0
  115. data/db/migrate/20111108213108_create_shipping_methods_suppliers.rb +16 -0
  116. data/db/seeds.rb +14 -0
  117. data/lib/spree_suppliers.rb +411 -0
  118. data/lib/spree_suppliers_hooks.rb +40 -0
  119. data/lib/tasks/spree_suppliers.rake +27 -0
  120. data/public/javascripts/jquery-ui.js +312 -0
  121. data/public/javascripts/jquery-ui.multidatespicker.js +398 -0
  122. data/public/javascripts/jquery.ui.datepicker.js +1791 -0
  123. data/public/stylesheets/suppliers.css +676 -0
  124. data/spec/controllers/cities_controller_spec.rb +157 -0
  125. data/spec/controllers/shipping_options_controller_spec.rb +12 -0
  126. data/spec/helpers/cities_helper_spec.rb +15 -0
  127. data/spec/models/city_spec.rb +5 -0
  128. data/spec/models/comment_spec.rb +64 -0
  129. data/spec/models/item_spec.rb +5 -0
  130. data/spec/models/message_spec.rb +5 -0
  131. data/spec/models/pickup_date_spec.rb +5 -0
  132. data/spec/models/pickup_location_spec.rb +5 -0
  133. data/spec/models/pickup_spec.rb +5 -0
  134. data/spec/models/rating_spec.rb +24 -0
  135. data/spec/models/supplier_invoice_spec.rb +5 -0
  136. data/spec/models/supplier_spec.rb +11 -0
  137. data/spec/requests/cities_spec.rb +11 -0
  138. data/spec/routing/cities_routing_spec.rb +35 -0
  139. data/spec/spec.opts +6 -0
  140. data/spec/spec_helper.rb +37 -0
  141. data/spec/views/cities/edit.html.erb_spec.rb +22 -0
  142. data/spec/views/cities/index.html.erb_spec.rb +28 -0
  143. data/spec/views/cities/new.html.erb_spec.rb +22 -0
  144. data/spec/views/cities/show.html.erb_spec.rb +21 -0
  145. data/spec/views/shipping_options/edit.html.erb_spec.rb +5 -0
  146. data/spree_suppliers.gemspec +24 -0
  147. metadata +181 -14
@@ -0,0 +1,113 @@
1
+ <div class="deliveries">
2
+
3
+ <% form_tag do %>
4
+
5
+ <div class="shipping_methods">
6
+ <div id="methods">
7
+ <p class="field radios">
8
+ <% @order.rate_hash.each do |shipping_method| %>
9
+ <label>
10
+ <%= radio_button(:order, :shipping_method_id, shipping_method[:id]) %>
11
+ <%= shipping_method[:name] %> <%= number_to_currency shipping_method[:cost] %>
12
+ </label><br />
13
+ <% end %>
14
+ </p>
15
+ </div>
16
+ <% if Spree::Config[:shipping_instructions] && @order.rate_hash.present? %>
17
+ <p id="minstrs">
18
+ <%= form.label :special_instructions, t("shipping_instructions") %><br />
19
+ <%= form.text_area :special_instructions, :cols => 40, :rows => 7 %>
20
+ </p>
21
+ <% end %>
22
+ </div>
23
+
24
+
25
+ <% @suppliers.each do |s| %>
26
+ <div class="delivery">
27
+ <% supplier = Supplier.find_by_id(s) %>
28
+ <% supplier_products = @order.line_items.select{|p| p.product.supplier_id == supplier.id} %>
29
+
30
+ <h3><%= supplier.title %></h3>
31
+
32
+ <% if !supplier.shipping_methods.empty? %>
33
+ <%= label_tag(:pickup, "Ship") %>
34
+ <%= radio_button_tag("deliveries[#{s}]", 0, true, :class => "radio_ship") %>
35
+ <% end %>
36
+
37
+ <% if !supplier.pickups.empty? %>
38
+ <%= label_tag(:pickup, "Pickup") %>
39
+ <% if !supplier.shipping_methods.empty? %>
40
+ <%= radio_button_tag("deliveries[#{s}]", 1, false, :class => "radio_pickup") %>
41
+ <% else %>
42
+ <%= radio_button_tag("deliveries[#{s}]", 1, true, :class => "radio_pickup") %>
43
+ <% end %>
44
+
45
+ <% end %>
46
+
47
+ <% if !supplier.pickups.empty? %>
48
+ <div class="pickup_locations" id="pickup_locations[<%= s %>]">
49
+ <h3>Choose your pickup location:</h3>
50
+ <%= select_tag "pickups[#{supplier.id}]", options_from_collection_for_select(supplier.pickups, "id", "name") %>
51
+ </div>
52
+ <% end %>
53
+ <% if !supplier.shipping_methods.empty? %>
54
+ <div class="shipping_method" id="shipping_method[<%= s %>]">
55
+ <h3>Choose your shipping method:</h3>
56
+ <%= select_tag "shipping_method[#{supplier.id}]", options_from_collection_for_select(supplier.shipping_methods, "id", "name") %>
57
+ </div>
58
+ <% end %>
59
+
60
+
61
+ <div class="supplier_products">
62
+ <table class="index">
63
+ <tr>
64
+ <th>Product Name</th>
65
+ <th>Product price (ea)</th>
66
+ <th>Quantity</th>
67
+ <th>Quantified price</th>
68
+ </tr>
69
+ <% supplier_products.each do |s| %>
70
+ <tr class="products">
71
+ <td width="130px"><%= s.product.name %></td>
72
+ <td width="50px"><%= number_to_currency(s.variant.price) %></td>
73
+ <td width="50px"><%= q = s.quantity %></td>
74
+ <td width="150px"><%= number_to_currency(s.variant.price * q) %></td>
75
+ </tr>
76
+ <% end %>
77
+ </table>
78
+ </div>
79
+
80
+ </div>
81
+ <% end %>
82
+
83
+ <div class="form-buttons">
84
+ <input type="submit" class="continue button primary" value="<%=t("save_and_continue") %>"/>
85
+ </div>
86
+ <% end %>
87
+ </div>
88
+
89
+ <script>
90
+ $(document).ready(function(){
91
+ $(".radio_pickup").each(function() {
92
+ if ($(this).attr("checked") == "checked") {
93
+ $(this).parent().children(".pickup_locations").last().show();
94
+ $(this).parent().children(".shipping_method").last().hide();
95
+ } else {
96
+ $(this).parent().children(".pickup_locations").last().hide();
97
+ $(this).parent().children(".shipping_method").last().show();
98
+ }
99
+ $(this).click(function() {
100
+ $(this).parent().children(".pickup_locations").last().show();
101
+ $(this).parent().children(".shipping_method").last().hide();
102
+ });
103
+ });
104
+ $(".radio_ship").each(function() {
105
+ $(this).click(function() {
106
+ $(this).parent().children(".pickup_locations").last().hide();
107
+ $(this).parent().children(".shipping_method").last().show();
108
+ });
109
+ });
110
+ });
111
+ </script>
112
+
113
+
@@ -0,0 +1,21 @@
1
+ <h2>Hours</h2>
2
+ <table id="shop_hours">
3
+ <tr>
4
+ <th>Sunday:</th>
5
+ <th>Monday:</th>
6
+ <th>Tuesday:</th>
7
+ <th>Wednesday:</th>
8
+ <th>Thursday:</th>
9
+ <th>Friday:</th>
10
+ <th>Saturday:</th>
11
+ </tr>
12
+ <tr>
13
+ <td><%= supplier.hours.first.sunday %></td>
14
+ <td><%= supplier.hours.first.monday %></td>
15
+ <td><%= supplier.hours.first.tuesday %></td>
16
+ <td><%= supplier.hours.first.wednesday %></td>
17
+ <td><%= supplier.hours.first.thursday %></td>
18
+ <td><%= supplier.hours.first.friday %></td>
19
+ <td><%= supplier.hours.first.saturday %></td>
20
+ </tr>
21
+ </table>
@@ -0,0 +1,49 @@
1
+ <%
2
+ paginated_products = @searcher.products if params.key?(:keywords)
3
+ paginated_products ||= products
4
+ %>
5
+ <% if products.empty? %>
6
+ <%= t(:no_products_found) %>
7
+ <% elsif params.key?(:keywords) %>
8
+ <h3><%= t(:search_results, :keywords => h(params[:keywords])) %></h3>
9
+ <% end %>
10
+
11
+ <% if products.any? %>
12
+ <div class="vendor-products">
13
+ <% c = 1 %>
14
+ <% p = products.count %>
15
+ <% products.each do |product| %>
16
+ <% if c == 1 %>
17
+ <ul>
18
+ <% elsif (c-1)% 4 == 0 %>
19
+ </ul><ul>
20
+ <% end %>
21
+
22
+ <% if Spree::Config[:show_zero_stock_products] || product.has_stock? %>
23
+ <li id="product_<%= product.id %>">
24
+ <%= hook :products_list_item, {:product => product} do %>
25
+ <%= link_to small_image(product), product_path(product) %>
26
+ <%= link_to raw(product.name + "<span class='vendor'>#{product.supplier.title}</span> <span class='price selling'>#{product_price(product)}</span>"), product_path(product), :class => 'info' %>
27
+ <% end %>
28
+ </li>
29
+ <% end %>
30
+ <% if c == p %>
31
+ </ul><!-- END OF ITERATION -->
32
+ <% end %>
33
+ <% c += 1 %>
34
+ <% end %>
35
+ </div><!-- END div.vendor-products -->
36
+ <% end %>
37
+
38
+ <hr class="space" />
39
+
40
+ <% if paginated_products.respond_to?(:total_pages)
41
+ params.delete(:search)
42
+ params.delete(:taxon)
43
+
44
+ %><%= will_paginate(paginated_products,
45
+ :previous_label => "&#171; #{t('previous')}",
46
+ :next_label => "#{t('next')} &#187;") %>
47
+ <% end %>
48
+
49
+ <hr class="space" />
@@ -0,0 +1,67 @@
1
+
2
+ <% @invoices.each do |invoice| %>
3
+
4
+ <div class="supplier_invoice">
5
+ <h3><%= invoice.supplier.title %></h3>
6
+ <table class="index">
7
+ <tr>
8
+ <th>Product Name</th>
9
+ <th>Product price</th>
10
+ <th>Quantity</th>
11
+ <th>Totals</th>
12
+ </tr>
13
+
14
+ <% invoice.items.each do |item| %>
15
+ <tr bgcolor="#F9FFB9">
16
+ <td width="600px"><%= item.product.name %> <%= "(" + variant_options(item.line_item.variant) + ")" unless item.line_item.variant.option_values.empty? %></td>
17
+ <td width="150px"><%= number_to_currency(item.line_item.variant.price) %></td>
18
+ <td width="75px"><%= item.quantity %></td>
19
+ <td><%= number_to_currency(item.line_item.variant.price * item.quantity) %></td>
20
+ </tr>
21
+ <% end %>
22
+ <tr>
23
+ <td>Order-total</td>
24
+ <td></td>
25
+ <td></td>
26
+ <td><%= number_to_currency(invoice.invoice_total) %></td>
27
+ </tr>
28
+ <tr>
29
+ <td>-(fee)</td>
30
+ <td></td>
31
+ <td></td>
32
+ <td><%= number_to_currency(invoice.invoice_total * @fee) %></td>
33
+ </tr>
34
+ <tr bgcolor="#CCFFB3">
35
+ <td>Sub-total</td>
36
+ <td></td>
37
+ <td></td>
38
+ <td><%= number_to_currency(invoice.invoice_total * (1 - @fee)) %></td>
39
+ </tr>
40
+
41
+ <tr bgcolor="#b2f2ff">
42
+ <td>Delivery type:</td>
43
+ <% @delivery = Delivery.find(:all, :conditions => { :order_id => @order.id, :supplier_id => invoice.supplier_id}) %>
44
+ <% if @delivery.first.pick_up == true %>
45
+ <td bgcolor="#e5b2ff">Pickup</td>
46
+ <td><%= Pickup.find_by_id(@delivery.first.pickup_id).name %></td>
47
+ <td>
48
+ <%= Pickup.find_by_id(@delivery.first.pickup_id).pickup_location.address1 %>,
49
+ <%= Pickup.find_by_id(@delivery.first.pickup_id).pickup_location.address2 %> -
50
+ <%= Pickup.find_by_id(@delivery.first.pickup_id).pickup_location.city %>,
51
+ <%= State.find_by_id(Pickup.find_by_id(@delivery.first.pickup_id).pickup_location.state_id).abbr %>
52
+ <%= Pickup.find_by_id(@delivery.first.pickup_id).pickup_location.zipcode %>
53
+ </td>
54
+ <% else %>
55
+ <td bgcolor="#ffbfb2">Shipping</td>
56
+ <td><%= @delivery.first.shipping_method.name %></td>
57
+ <td></td>
58
+ <% end %>
59
+ </tr>
60
+
61
+ </table>
62
+ </div>
63
+ <% end %>
64
+
65
+
66
+
67
+
@@ -0,0 +1,72 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
+ </head>
6
+ <body>
7
+ <h1>Hello <%= @invoice.supplier.name %>, You just sold some stuff!</h1>
8
+ <div class="supplier_invoice">
9
+ <h3><%= @invoice.supplier.title %></h3>
10
+ <table class="index">
11
+ <tr>
12
+ <th>Product Name</th>
13
+ <th>Product price</th>
14
+ <th>Quantity</th>
15
+ <th>Totals</th>
16
+ </tr>
17
+
18
+ <% @invoice.items.each do |item| %>
19
+ <tr bgcolor="#F9FFB9">
20
+ <td width="600px"><%= item.product.name %> <%= "(" + variant_options(item.line_item.variant) + ")" unless item.line_item.variant.option_values.empty? %></td>
21
+ <td width="150px"><%= number_to_currency(item.line_item.variant.price) %></td>
22
+ <td width="75px"><%= item.quantity %></td>
23
+ <td><%= number_to_currency(item.line_item.variant.price * item.quantity) %></td>
24
+ </tr>
25
+ <% end %>
26
+ <tr>
27
+ <td>Order-total</td>
28
+ <td></td>
29
+ <td></td>
30
+ <td><%= number_to_currency(@invoice.invoice_total) %></td>
31
+ </tr>
32
+ <tr>
33
+ <td>-(Freshfully fee)</td>
34
+ <td></td>
35
+ <td></td>
36
+ <td><%= number_to_currency(@invoice.invoice_total * @fee) %></td>
37
+ </tr>
38
+ <tr bgcolor="#CCFFB3">
39
+ <td>Sub-total</td>
40
+ <td></td>
41
+ <td></td>
42
+ <td><%= number_to_currency(@invoice.invoice_total * (1 - @fee)) %></td>
43
+ </tr>
44
+
45
+ <tr bgcolor="#b2f2ff">
46
+ <td>Delivery type:</td>
47
+ <% if @delivery.first.pick_up == true %>
48
+ <td bgcolor="#e5b2ff">Pickup</td>
49
+ <td><%= Pickup.find_by_id(@delivery.first.pickup_id).name %></td>
50
+ <td>
51
+ <%= Pickup.find_by_id(@delivery.first.pickup_id).pickup_location.address1 %>,
52
+ <%= Pickup.find_by_id(@delivery.first.pickup_id).pickup_location.address2 %> -
53
+ <%= Pickup.find_by_id(@delivery.first.pickup_id).pickup_location.city %>,
54
+ <%= State.find_by_id(Pickup.find_by_id(@delivery.first.pickup_id).pickup_location.state_id).abbr %>
55
+ <%= Pickup.find_by_id(@delivery.first.pickup_id).pickup_location.zipcode %>
56
+ </td>
57
+ <% else %>
58
+ <td bgcolor="#ffbfb2">Shipping</td>
59
+ <td><%= @delivery.first.shipping_method.name %></td>
60
+ <td></td>
61
+ <% end %>
62
+ </tr>
63
+
64
+ </table>
65
+ </div>
66
+
67
+ <p>If you have any questions, please contact Freshfully.com</p>
68
+ <p>Have a great day!</p>
69
+
70
+
71
+ </body>
72
+ </html>
@@ -0,0 +1,7 @@
1
+ <div class="yui3-u-1-3">
2
+ <div class="vendor">
3
+ <% @products.each do |product|
4
+ <%= link_to product.name, product_path(product) %>
5
+ <% end %>
6
+ </div>
7
+ </div>
@@ -0,0 +1,20 @@
1
+ <li class="suppliers">
2
+ <div class="vendor-image">
3
+ <%= link_to sized_image(supplier.images.first, '75x75#'), supplier_path(supplier) %>
4
+ </div>
5
+
6
+ <div class="article-content">
7
+ <% if supplier.title %>
8
+ <h4><%= link_to supplier.title, supplier_path(supplier) %> </h4>
9
+ <% else %>
10
+ <h4><%= link_to supplier.name, supplier_path(supplier) %> </h4>
11
+ <% end %>
12
+
13
+ <% if supplier.phone %><span class="phone"><%= supplier.phone %></span><% end %>
14
+ <p class="supplier_about">
15
+ <%= supplier.notes%> <br />
16
+ <%= supplier.address1 %><br />
17
+ <% if supplier.town %><%= supplier.town %>, <% end %><%= supplier.state.abbr %> <% if supplier.zip_code %> <%= supplier.zip_code %> <% end %>
18
+ </p>
19
+ </div>
20
+ </li>
@@ -0,0 +1,17 @@
1
+ <div class="search-sidebar">
2
+ <%= form_for @search do |f| %>
3
+ <p>
4
+ <%= f.label :search_vendors %>
5
+ <%= f.text_field :name_or_title_or_zip_code_contains %>
6
+ </p>
7
+ <p class = "button"><%= f.submit "Search" %></p>
8
+ <% end %>
9
+ </div><!-- END div.search-sidebar -->
10
+
11
+ <div class="search-list">
12
+
13
+ <%= render :partial => "suppliers/supplier_list", :collection => @suppliers, :as => :supplier %>
14
+
15
+ </div><!-- END div.search-list -->
16
+
17
+ <div class="clear"></div><!-- END div.clear -->
@@ -0,0 +1,106 @@
1
+ <div id="vendor_sidebar">
2
+ <div class="vendor-logo">
3
+ <% @supplier.images.each do |image| %>
4
+ <% if image.logo == true %>
5
+ <img src="<%= image.attachment.url %>" <% if image.alt %>alt="<%= image.alt %>"<% end %> width="100%"/>
6
+ <% end %>
7
+ <% end %>
8
+ </div><!-- END div.vendor-logo -->
9
+ <div class="polaroid drop_light">
10
+ <div class="polaroid_image">
11
+ <%= sized_image(@supplier.images.first, '275x220#') %>
12
+ <!--%= image_tag 'default_vendor.jpg'%-->
13
+ </div>
14
+
15
+ </div>
16
+ <h2>Vendor Location</h2>
17
+ <% if user_signed_in? %>
18
+ <% if !current_user.bill_address.nil? %>
19
+ <%= gmaps({"direction" => {"data" => { "from" => current_user.user_address, "to" => @supplier.gmaps4rails_address }, "options" => {"display_panel" => true, "panel_id" => "instructions"}}}) %>
20
+ <button id="get_directions">Get Directions</button>
21
+ <% end %>
22
+ <div style="display: none" class="directions" id="instructions" >
23
+ </div>
24
+ <% else %>
25
+ <%= gmaps({
26
+ "map_options" => {"auto_adjust" => true, "auto_zoom" => false, "zoom" => 15},
27
+ "markers" => {"data" => @json }
28
+ }) %>
29
+ <% end %>
30
+ <%#= render "messages/message_form" %>
31
+
32
+ </div>
33
+
34
+ <div id="left_content">
35
+ <div class="breadcrumb">
36
+ <ul>
37
+ <li><%= link_to 'Home', '/' %></li>
38
+ <li>&#187; </li>
39
+ <li><%= link_to 'Vendors', suppliers_path %></li>
40
+ <li>&#187; </li>
41
+ <li><%= @supplier.title %></li>
42
+ </ul>
43
+ <div class="social">
44
+ <script type="text/javascript" src="https://apis.google.com/js/plusone.js">
45
+ </script>
46
+ <g:plusone size="medium" ></g:plusone>
47
+ <div class="fb-like" data-href="<%= request.url %>" data-send="true" data-layout="button_count" data-width="100" data-show-faces="false"></div>
48
+ </div><!-- END div.social -->
49
+
50
+ </div>
51
+
52
+ <h2><%= @supplier.title %></h2>
53
+
54
+ <div id="vendor-notes">
55
+ <%= @supplier.notes %>
56
+
57
+ </div>
58
+
59
+ <div class="vendor-info">
60
+ <h2>Info:</h2>
61
+ <ul>
62
+ <% if @supplier.phone%>
63
+ <li>Phone: <%= @supplier.phone %></li>
64
+ <% end %>
65
+ <% if @supplier.website %>
66
+ <li>Website: <%= link_to @supplier.website, @supplier.website %></li>
67
+ <% end %>
68
+ <li><%= @supplier.address1 %></li>
69
+ <li><%= @supplier.address2 %></li>
70
+ <% if @supplier.town %><li><%= @supplier.town %>, <% end %><%= @supplier.state.name %></li>
71
+ <% if @supplier.zip_code %><li><%= @supplier.zip_code %><% end %>
72
+ </ul>
73
+ </div><!-- END div.vendor-info -->
74
+
75
+ <% if @supplier.name %>
76
+ <div class="vendor-proprietor">
77
+ <h2>Owner/Proprietor Info:</h2>
78
+ <h4>Owner/Proprietor:</h4>
79
+ <%= @supplier.name %>
80
+
81
+ <% if @supplier.description2 %>
82
+ <h4>Bio:</h4>
83
+ <%= @supplier.description2 %>
84
+ <% end %>
85
+ </div>
86
+ <% end %>
87
+
88
+ <div class="shop-hours">
89
+ <%= render :partial => "shared/hours", :locals => {:supplier => @supplier} %>
90
+ </div><!-- END div.shop-hours -->
91
+
92
+ <div class="vendor-products">
93
+ <h2 class="products">Products</h2>
94
+ <%= render "shared/products_vendor", :products => @products, :taxon => @taxon %>
95
+ </div><!-- END div.vendor-products -->
96
+ </div>
97
+
98
+
99
+ <script>
100
+ $("button").click(function () {
101
+ $("div.directions").toggle();
102
+ });
103
+ </script>
104
+
105
+
106
+
@@ -0,0 +1,14 @@
1
+ <li>
2
+ <div class="vendor-image">
3
+ <%= link_to sized_image(supplier.images.first, '75x75#'), supplier_path(supplier) %>
4
+ </div>
5
+
6
+ <div class="article-content">
7
+ <h3><%= link_to supplier.title, supplier_path(supplier) %> </h3>
8
+ <span class="city-state"><%= supplier.city.name %>, <%= supplier.state.name %></span>TEST 2
9
+ <p class="supplier_about">
10
+ <%= supplier.notes%> <br />
11
+ <%= supplier.address1 %> - <%= supplier.city.name %>, <%= supplier.state.name %><br />
12
+ <span class="phone"><%= supplier.phone %></span></p>
13
+ </div>
14
+ </li>
@@ -0,0 +1,8 @@
1
+ require 'dragonfly/rails/images'
2
+
3
+ app = Dragonfly[:images]
4
+ app.configure do |c|
5
+ c.allow_fetch_file = true
6
+ end
7
+ app.configure_with(:imagemagick)
8
+ app.configure_with(:rails)
@@ -0,0 +1,10 @@
1
+ ActionMailer::Base.smtp_settings = {
2
+ :address => "smtp.gmail.com",
3
+ :port => 587,
4
+ :domain => "gmail.com",
5
+ :user_name => "email@gmail.com",
6
+ :password => "password",
7
+ :authentication => "plain",
8
+ :enable_starttls_auto => true
9
+ }
10
+
@@ -0,0 +1,13 @@
1
+ ---
2
+ en:
3
+ suppliers: "Vendors"
4
+ pickups: "Pickups"
5
+ supplier_name: "Vendor Name"
6
+ new_supplier: "New Vendor"
7
+ available_suppliers: "Available Vendors"
8
+ editing_supplier: "Editing Vendor"
9
+ fax: "Fax"
10
+ notes: "Description"
11
+ suppliers_description: "Manage Vendors"
12
+ count_on_hand: "Count On Hand"
13
+ upload: "Upload"
data/config/routes.rb ADDED
@@ -0,0 +1,48 @@
1
+ Rails.application.routes.draw do
2
+ resources :suppliers
3
+ resources :messages
4
+ resources :deliveries
5
+
6
+ namespace :admin do
7
+
8
+ resources :suppliers do
9
+ get 'feature'
10
+ resources :taxons, :controller => "supplier_taxons" do
11
+ member do
12
+ get :select
13
+ delete :remove
14
+ end
15
+ collection do
16
+ post :available
17
+ post :batch_select
18
+ get :selected
19
+ post :update_taxons
20
+ end
21
+ end
22
+ end
23
+ match "upload_image" => "suppliers#upload_image"
24
+ match "destroy_image" => "suppliers#destroy_image"
25
+ match "make_logo" => "suppliers#make_logo"
26
+ match "feature_image" => "suppliers#feature_image"
27
+
28
+ resources :overview
29
+ resources :pickups
30
+ resources :pickup_locations
31
+ resources :shipping_options
32
+
33
+ resources :products do
34
+ resources :suppliers, :member => {:select => :post, :remove => :post}, :collection => {:available => :post, :selected => :get}
35
+ member do
36
+ get :publish
37
+ get :unpublish
38
+ end
39
+ end
40
+
41
+ resources :orders do
42
+ resources :suppliers, :collection => {:line_items => :get}
43
+ end
44
+
45
+ resources :vendor_overview
46
+ end
47
+
48
+ end
@@ -0,0 +1,36 @@
1
+ class SupplierSetup < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :suppliers do |t|
4
+ t.string :name
5
+ t.string :title
6
+ t.string :description2
7
+ t.string :address1
8
+ t.string :address2
9
+ t.string :town
10
+ t.string :state_id
11
+ t.string :zip_code
12
+ t.string :phone
13
+ t.string :fax
14
+ t.string :email
15
+ t.string :website
16
+ t.string :twitter
17
+ t.string :facebook
18
+ t.text :notes
19
+ t.text :products_sold
20
+ t.float :latitude
21
+ t.float :longitude
22
+ t.boolean :gmaps
23
+ t.boolean :featured
24
+ t.string :slug
25
+ t.integer :user_id
26
+
27
+ t.timestamps
28
+ end
29
+ add_column :products, :supplier_id, :integer
30
+ end
31
+
32
+ def self.down
33
+ drop_table :suppliers
34
+ remove_column :products, :supplier_id
35
+ end
36
+ end
@@ -0,0 +1,18 @@
1
+ class CreateMessages < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :messages do |t|
4
+ t.integer :supplier_id
5
+ t.string :title
6
+ t.string :text
7
+ t.integer :user_id
8
+ t.boolean :opened
9
+ t.string :author
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+
15
+ def self.down
16
+ drop_table :messages
17
+ end
18
+ end
@@ -0,0 +1,21 @@
1
+ class CreateHours < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :hours do |t|
4
+ t.string :monday
5
+ t.string :tuesday
6
+ t.string :wednesday
7
+ t.string :thursday
8
+ t.string :friday
9
+ t.string :saturday
10
+ t.string :sunday
11
+ t.integer :supplier_id
12
+ t.integer :pickup_location_id
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+
18
+ def self.down
19
+ drop_table :cities
20
+ end
21
+ end