solidus_auction 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +26 -0
  3. data/README.md +57 -0
  4. data/Rakefile +30 -0
  5. data/app/assets/javascripts/auctions.js +2 -0
  6. data/app/assets/javascripts/countdown.js +20 -0
  7. data/app/assets/javascripts/local-time.js +1 -0
  8. data/app/assets/javascripts/spree/backend/product_autocomplete.js +50 -0
  9. data/app/assets/javascripts/spree/backend/solidus_auction.js +7 -0
  10. data/app/assets/javascripts/spree/ends_in.js +31 -0
  11. data/app/assets/javascripts/spree/frontend/solidus_auction.js +8 -0
  12. data/app/assets/javascripts/spree/frontend/starts_in.js +32 -0
  13. data/app/assets/javascripts/spree/frontend/votes.js +83 -0
  14. data/app/assets/stylesheets/spree/backend/solidus_auction.css +16 -0
  15. data/app/assets/stylesheets/spree/frontend/solidus_auction.css +24 -0
  16. data/app/controllers/spree/admin/auction_settings_controller.rb +16 -0
  17. data/app/controllers/spree/admin/auctions_controller.rb +46 -0
  18. data/app/controllers/spree/admin/bids_controller.rb +2 -0
  19. data/app/controllers/spree/admin/resource_controller_decorator.rb +9 -0
  20. data/app/controllers/spree/auctions_controller.rb +52 -0
  21. data/app/controllers/spree/bids_controller.rb +48 -0
  22. data/app/controllers/spree/helpers/local_time_helper.rb +77 -0
  23. data/app/controllers/spree/users_controller_decorator.rb +5 -0
  24. data/app/controllers/spree/votes_controller.rb +5 -0
  25. data/app/helpers/spree/strong_params_decorator.rb +8 -0
  26. data/app/models/spree/auction.rb +291 -0
  27. data/app/models/spree/auction_ability.rb +13 -0
  28. data/app/models/spree/bid.rb +19 -0
  29. data/app/models/spree/product_decorator.rb +3 -0
  30. data/app/models/spree/user_decorator.rb +5 -0
  31. data/app/models/spree/variant_decorator.rb +3 -0
  32. data/app/overrides/add_auction_links_to_order_info.rb +6 -0
  33. data/app/overrides/add_auction_settings_tab.rb +8 -0
  34. data/app/overrides/add_auctions_tab_to_admin.rb +8 -0
  35. data/app/overrides/add_auctions_table_to_user_show.rb +6 -0
  36. data/app/overrides/add_auctions_to_main_nav.rb +6 -0
  37. data/app/overrides/add_timezone_to_admin.rb +8 -0
  38. data/app/overrides/change_line_item_delete_button.rb +6 -0
  39. data/app/overrides/change_line_item_link_to.rb +6 -0
  40. data/app/overrides/change_line_item_number_field_disabled.rb +6 -0
  41. data/app/overrides/change_order_item_description.rb +6 -0
  42. data/app/overrides/change_stock_item_name.rb +6 -0
  43. data/app/overrides/change_variant_row_show.rb +6 -0
  44. data/app/overrides/change_variant_stock_item_show.rb +6 -0
  45. data/app/validators/in_future_validator.rb +10 -0
  46. data/app/views/spree/admin/active_shipping_settings/edit.html.erb +108 -0
  47. data/app/views/spree/admin/auction_settings/edit.html.erb +45 -0
  48. data/app/views/spree/admin/auctions/_form.html.erb +189 -0
  49. data/app/views/spree/admin/auctions/edit.html.erb +18 -0
  50. data/app/views/spree/admin/auctions/index.html.erb +89 -0
  51. data/app/views/spree/admin/auctions/new.html.erb +14 -0
  52. data/app/views/spree/admin/shared/_auction_links_to_order_info.html.erb +18 -0
  53. data/app/views/spree/admin/shared/_auction_settings_button.html.erb +3 -0
  54. data/app/views/spree/admin/shared/_auctions_tab.html.erb +3 -0
  55. data/app/views/spree/admin/shared/_time_zone_field.html.erb +5 -0
  56. data/app/views/spree/auctions/_bid_form.html.erb +81 -0
  57. data/app/views/spree/auctions/_bids.html.erb +52 -0
  58. data/app/views/spree/auctions/_image.html.erb +5 -0
  59. data/app/views/spree/auctions/_promotions.html.erb +19 -0
  60. data/app/views/spree/auctions/_properties.html.erb +15 -0
  61. data/app/views/spree/auctions/_taxons.html.erb +14 -0
  62. data/app/views/spree/auctions/_thumbnails.html.erb +19 -0
  63. data/app/views/spree/auctions/index.html.erb +3 -0
  64. data/app/views/spree/auctions/show.html.erb +58 -0
  65. data/app/views/spree/bids/index.html.erb +0 -0
  66. data/app/views/spree/bids/new.html.erb +0 -0
  67. data/app/views/spree/products/_cart_form.html.erb +65 -0
  68. data/app/views/spree/products/_promotions.html.erb +19 -0
  69. data/app/views/spree/products/_properties.html.erb +15 -0
  70. data/app/views/spree/products/_taxons.html.erb +14 -0
  71. data/app/views/spree/products/_thumbnails.html.erb +19 -0
  72. data/app/views/spree/products/index.html.erb +15 -0
  73. data/app/views/spree/products/show.html.erb +51 -0
  74. data/app/views/spree/shared/_auction_order_link.html.erb +9 -0
  75. data/app/views/spree/shared/_auctions.html.erb +39 -0
  76. data/app/views/spree/shared/_auctions_link.html.erb +7 -0
  77. data/app/views/spree/shared/_auctions_table_show.html.erb +93 -0
  78. data/app/views/spree/shared/_ends_in.html.erb +14 -0
  79. data/app/views/spree/shared/_image.html.erb +12 -0
  80. data/app/views/spree/shared/_line_item_delete.html.erb +5 -0
  81. data/app/views/spree/shared/_line_item_link_to.erb +22 -0
  82. data/app/views/spree/shared/_line_item_number_field_disabled.erb +9 -0
  83. data/app/views/spree/shared/_order_item_description.html.erb +15 -0
  84. data/app/views/spree/shared/_starts_in.html.erb +14 -0
  85. data/app/views/spree/shared/_stock_item_name.html.erb +5 -0
  86. data/app/views/spree/shared/_time_in_words_display.html.erb +11 -0
  87. data/app/views/spree/shared/_variant_row_disable.html.erb +21 -0
  88. data/app/views/spree/shared/_variant_stock_item_disable.html.erb +62 -0
  89. data/app/views/spree/shared/_votes.html.erb +12 -0
  90. data/app/views/spree/votes/index.html.erb +13 -0
  91. data/config/locales/en.yml +76 -0
  92. data/config/routes.rb +17 -0
  93. data/db/migrate/20180225234309_create_auctions.rb +25 -0
  94. data/db/migrate/20180225235226_create_bids.rb +13 -0
  95. data/db/migrate/20180316051158_add_deleted_to_spree_auction.rb +5 -0
  96. data/db/migrate/20180320010358_change_auction_reserve_price_column_to_big_decimal.rb +8 -0
  97. data/db/migrate/20180321203019_add_time_zone_to_spree_user.rb +5 -0
  98. data/db/migrate/20180322014713_add_default_to_datetimes.rb +7 -0
  99. data/db/migrate/20180328233438_add_variant_id_to_auction.rb +5 -0
  100. data/db/migrate/20180410025053_acts_as_votable_migration.rb +22 -0
  101. data/db/migrate/20180410031333_add_cached_votes_to_spree_auctions.rb +13 -0
  102. data/lib/assets/javascripts/src/local-time/calendar_date.coffee +37 -0
  103. data/lib/assets/javascripts/src/local-time/config/i18n.coffee +74 -0
  104. data/lib/assets/javascripts/src/local-time/config/locale.coffee +2 -0
  105. data/lib/assets/javascripts/src/local-time/config/timer.coffee +1 -0
  106. data/lib/assets/javascripts/src/local-time/controller.coffee +59 -0
  107. data/lib/assets/javascripts/src/local-time/helpers/date_parse.coffee +15 -0
  108. data/lib/assets/javascripts/src/local-time/helpers/dom.coffee +11 -0
  109. data/lib/assets/javascripts/src/local-time/helpers/i18n.coffee +24 -0
  110. data/lib/assets/javascripts/src/local-time/helpers/strftime.coffee +55 -0
  111. data/lib/assets/javascripts/src/local-time/index.coffee +20 -0
  112. data/lib/assets/javascripts/src/local-time/page_observer.coffee +43 -0
  113. data/lib/assets/javascripts/src/local-time/relative_time.coffee +72 -0
  114. data/lib/assets/javascripts/src/local-time/start.coffee +25 -0
  115. data/lib/generators/solidus_auction/install/install_generator.rb +30 -0
  116. data/lib/local_time.rb +0 -0
  117. data/lib/solidus_auction.rb +3 -0
  118. data/lib/solidus_auction/configuration.rb +8 -0
  119. data/lib/solidus_auction/engine.rb +29 -0
  120. data/lib/solidus_auction/factories.rb +19 -0
  121. data/lib/solidus_auction/version.rb +3 -0
  122. metadata +388 -0
@@ -0,0 +1,19 @@
1
+ <% promotions = @product.possible_promotions %>
2
+ <% if promotions.any? %>
3
+ <div id="promotions">
4
+ <h3><%= t('spree.promotions') %></h3>
5
+ <% promotions.each do |promotion| %>
6
+ <div>
7
+ <h4><%= promotion.name %></h4>
8
+ <p><%= promotion.description %></p>
9
+ <% if promotion.products.any? %>
10
+ <ul>
11
+ <% promotion.products.each do |product| %>
12
+ <li><%= link_to product.name, product_path(product) %></li>
13
+ <% end %>
14
+ </ul>
15
+ <% end %>
16
+ </div>
17
+ <% end %>
18
+ </div>
19
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <% unless @product_properties.empty? %>
2
+ <h6 class="product-section-title"><%= t('spree.properties')%></h6>
3
+ <table id="product-properties" class="table-display" data-hook>
4
+ <tbody>
5
+ <% @product_properties.each do |product_property| %>
6
+ <% css_class = cycle('even', 'odd', name: "properties") %>
7
+ <tr class="<%= css_class %>">
8
+ <td><strong><%= product_property.property.presentation %></strong></td>
9
+ <td><%= product_property.value %></td>
10
+ </tr>
11
+ <% end %>
12
+ <% reset_cycle('properties') %>
13
+ </tbody>
14
+ </table>
15
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <% if !@product.taxons.blank? %>
2
+ <div id="taxon-crumbs" data-hook class="alpha columns five omega">
3
+ <h6 class="product-section-title"><%= t('spree.look_for_similar_items') %></h6>
4
+
5
+ <div data-hook="product_taxons">
6
+ <ul id="similar_items_by_taxon" data-hook>
7
+ <% @product.taxons.each do |taxon| %>
8
+ <li><%= link_to taxon.name, seo_url(taxon) %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+
13
+ </div>
14
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <%# no need for thumbnails unless there is more than one image %>
2
+ <% if (@product.images + @product.variant_images).uniq.size > 1 %>
3
+ <ul id="product-thumbnails" class="thumbnails inline" data-hook>
4
+ <% @product.images.each do |i| %>
5
+ <li class='tmb-all tmb-<%= i.viewable.id %>'>
6
+ <%= link_to(image_tag(i.attachment.url(:mini)), i.attachment.url(:product)) %>
7
+ </li>
8
+ <% end %>
9
+
10
+ <% if @product.has_variants? %>
11
+ <% @product.variant_images.each do |i| %>
12
+ <% next if @product.images.include?(i) %>
13
+ <li class='vtmb tmb-<%= i.viewable.id %>'>
14
+ <%= link_to(image_tag(i.attachment.url(:mini)), i.attachment.url(:product)) %>
15
+ </li>
16
+ <% end %>
17
+ <% end %>
18
+ </ul>
19
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <% if params[:keywords] %>
2
+ <div data-hook="search_results">
3
+ <% if @auctions.empty? %>
4
+ <h6 class="search-results-title"><%= t('spree.no_auctions_found') %></h6>
5
+ <% else %>
6
+ <%= render partial: 'spree/shared/auctions', locals: { auctions: @auctions, taxon: @taxon } %>
7
+ <% end %>
8
+ </div>
9
+
10
+ <% else %>
11
+
12
+ <div data-hook="homepage_auctions">
13
+ <%= render partial: 'spree/shared/auctions', locals: { auctions: @auctions, taxon: @taxon } %>
14
+ </div>
15
+ <% end %>
@@ -0,0 +1,51 @@
1
+ <% cache [I18n.locale, current_pricing_options, @product] do %>
2
+ <div data-hook="product_show" itemscope itemtype="http://schema.org/Product">
3
+ <% @body_id = 'product-details' %>
4
+
5
+ <div class="columns six alpha" data-hook="product_left_part">
6
+ <div class="row" data-hook="product_left_part_wrap">
7
+
8
+ <div id="product-images" data-hook="product_images">
9
+ <div id="main-image" data-hook>
10
+ <%= render partial: 'image' %>
11
+ </div>
12
+ <div id="thumbnails" data-hook>
13
+ <%= render partial: 'thumbnails' %>
14
+ </div>
15
+ </div>
16
+
17
+ <div data-hook="product_properties">
18
+ <%= render partial: 'properties' %>
19
+ </div>
20
+
21
+ <div data-hook="promotions">
22
+ <%= render partial: 'promotions' %>
23
+ </div>
24
+
25
+ </div>
26
+ </div>
27
+
28
+ <div class="columns ten omega" data-hook="product_right_part">
29
+ <div class="row" data-hook="product_right_part_wrap">
30
+
31
+ <div id="product-description" data-hook="product_description">
32
+
33
+ <h1 class="product-title" itemprop="name"><%= @product.name %></h1>
34
+
35
+ <div itemprop="description" data-hook="description">
36
+ <%= product_description(@product) rescue t('spree.product_has_no_description') %>
37
+ </div>
38
+
39
+ <div id="cart-form" data-hook="cart_form">
40
+ <%= render partial: 'cart_form' %>
41
+ </div>
42
+
43
+ </div>
44
+
45
+ <%= render partial: 'taxons' %>
46
+
47
+ </div>
48
+ </div>
49
+
50
+ </div>
51
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <% highest_bidder = auction.highest_bidder_id == spree_current_user.id %>
2
+ <% if auction.complete && highest_bidder %>
3
+ <% order = auction.order %>
4
+ <% if order.complete? %>
5
+ <%= link_to order.number, order %>
6
+ <% else %>
7
+ <%= link_to order.number, cart_path %>
8
+ <% end %>
9
+ <% end %>
@@ -0,0 +1,39 @@
1
+ <% if auctions.any? %>
2
+ <ul id="auctions" class="inline auction-listing" data-hook="auctions-index">
3
+ <% auctions.each do |auction| %>
4
+ <% product = auction.product %>
5
+ <% url = spree.auction_path(auction) %>
6
+ <li id="auction_<%= auction.id %>" class="columns three <%= cycle("alpha", "secondary", "", "omega secondary", name: "classes") %>" data-hook="auctions_list_item" itemscope>
7
+ <div class="auction-image">
8
+ <%= link_to(render('spree/shared/image', image: product.display_image, size: :small, itemprop: "image"), url, itemprop: 'url') %>
9
+ </div>
10
+ <%= link_to truncate(auction.title, length: 50), url, class: 'info', itemprop: "title", title: auction.title %>
11
+ <div>
12
+ <span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
13
+ <span class="price selling" itemprop="price" content="<%= auction.display_current_price %>">
14
+ <%= auction.display_current_price %>
15
+ </span>
16
+ </span>
17
+ </div>
18
+ <%= render partial: 'spree/shared/time_in_words_display', locals: { auction: auction } %>
19
+ <div>
20
+ <span class="bold">
21
+ <%= bid_count = auction.visible_bids.count %>
22
+ <% if bid_count == 1 %>
23
+ <%= Spree.t("spree.bid") %>
24
+ <% else %>
25
+ <%= Spree.t("spree.bids") %>
26
+ <% end %>
27
+ </span>
28
+ </div>
29
+ <%= render partial: 'spree/shared/votes', locals: { auction: auction } %>
30
+ <% if auction.in_progress? %>
31
+ <div>
32
+ <%= link_to Spree.t("bid"), url, class: "button button-primary" %>
33
+ </div>
34
+ <% end %>
35
+ </li>
36
+ <% end %>
37
+ <% reset_cycle("classes") %>
38
+ </ul>
39
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <%= link_to Spree.t("current_auctions"), auctions_path %>
2
+ <%= link_to Spree.t("starting_soon"), starting_soon_path %>
3
+ <%= link_to Spree.t("ending_soon"), ending_soon_path %>
4
+ <%= link_to Spree.t("recently_completed"), recently_completed_path %>
5
+ <% if spree_current_user %>
6
+ <%= link_to "#{Spree.t('watching')} (#{spree_current_user.find_up_voted_items.count})", votes_path %>
7
+ <% end %>
@@ -0,0 +1,93 @@
1
+ <% @auctions = spree_current_user.auctions.current_end_datetime_descending.uniq %>
2
+
3
+ <div data-hook="account_my_auctions" class="account-my-auctions">
4
+
5
+ <h3><%= Spree.t(:my_auctions) %></h3>
6
+ <% if @auctions.any? %>
7
+ <table class="table table-striped order-summary">
8
+ <thead class="active">
9
+ <tr>
10
+ <th><%= Spree.t("title") %></th>
11
+ <th><%= Spree.t("current_price") %></th>
12
+ <th><%= Spree.t("winning?") %></th>
13
+ <th><%= Spree.t("bids") %></th>
14
+ <th><%= Spree.t("current_end_datetime") %></th>
15
+ <th><%= Spree.t("time_remaining") %></th>
16
+ <th><%= Spree.t("order") %></th>
17
+ </tr>
18
+ </thead>
19
+ <tbody>
20
+ <% @auctions.each do |auction| %>
21
+ <% highest_bidder = auction.highest_bidder_id == spree_current_user.id %>
22
+ <tr class="<%= cycle('even', 'odd') %>">
23
+ <td>
24
+ <span class="bold">
25
+ <%= link_to auction.title, auction %>
26
+ </span>
27
+ </td>
28
+ <td>
29
+ <% if highest_bidder %>
30
+ <span class="green">
31
+ <%= auction.display_current_price %>
32
+ <% highest_bid = auction.highest_bid %>
33
+ <% if highest_bid.is_autobid? %>
34
+ (<%= highest_bid.display_amount %>)
35
+ <% end %>
36
+ </span>
37
+ <% else %>
38
+ <span class="red">
39
+ <%= auction.display_current_price %>
40
+ </span>
41
+ <% end %>
42
+ </td>
43
+ <td>
44
+ <% if highest_bidder %>
45
+ <i class="fa fa-thumbs-up green" aria-hidden="true"></i>
46
+ <% else %>
47
+ <i class="fa fa-thumbs-down red" aria-hidden="true"></i>
48
+ <% end %>
49
+ </td>
50
+ <td>
51
+ <span class="bold">
52
+ <%= auction.visible_bids.count %>
53
+ </span>
54
+ </td>
55
+ <td><%= local_time(auction.current_end_datetime) %></td>
56
+ <td>
57
+ <% if auction.complete %>
58
+ <span class="green">
59
+ <%= Spree.t("complete") %>
60
+ </span>
61
+ <% elsif auction.in_progress? %>
62
+ <%= render partial: 'spree/shared/ends_in', locals: { auction: auction } %>
63
+ <% end %>
64
+ </td>
65
+ <td>
66
+ <% if auction.complete && highest_bidder %>
67
+ <%= render partial: 'spree/shared/auction_order_link', locals: { auction: auction } %>
68
+ <% elsif auction.complete %>
69
+ <span class="red">
70
+ <i class="fa fa-frown-o" aria-hidden="true"></i>
71
+ </span>
72
+ <% else %>
73
+ <span class="red">
74
+ <%= Spree.t("na") %>
75
+ </span>
76
+ <% end %>
77
+ </td>
78
+ </tr>
79
+ <% end %>
80
+ </tbody>
81
+ </table>
82
+ <% else %>
83
+ <div class="alert alert-info">
84
+ <p>
85
+ <%= Spree.t(:you_have_not_participated_in_an_auction_yet) %>
86
+ <%= Spree.t(:check_some_out_here) %>:
87
+ <%= link_to Spree.t(:auctions), auctions_path %>
88
+ </p>
89
+ </div>
90
+ <% end %>
91
+ <br />
92
+
93
+ </div>
@@ -0,0 +1,14 @@
1
+ <% if auction.current_end_datetime %>
2
+ <span>
3
+ <%= Spree.t("ends_in") %>
4
+ </span>
5
+ <span class="ends-in red" data-auction-end-datetime=<%= auction.current_end_datetime_as_float%> data-auction-starting-datetime=<%= auction.starting_datetime_as_float%>>
6
+ <% if auction.complete %>
7
+ <span class="green">
8
+ COMPLETE
9
+ </span>
10
+ <% else %>
11
+ <%= distance_of_time_in_words_to_now(auction.current_end_datetime) %>
12
+ <% end %>
13
+ </span>
14
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <% size ||= :mini %>
2
+ <% itemprop ||= nil %>
3
+
4
+ <% if image && image.attachment? %>
5
+ <% if itemprop %>
6
+ <%= image_tag image.attachment(size), itemprop: itemprop %>
7
+ <% else %>
8
+ <%= image_tag image.attachment(size) %>
9
+ <% end %>
10
+ <% else %>
11
+ <span class="image-placeholder <%= size %>"></span>
12
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% if variant.option_values.any? || variant.is_master?%>
2
+ <td class="cart-item-delete" data-hook="">
3
+ <%= link_to image_tag('icons/delete.png'), '#', class: 'delete', id: "delete_#{dom_id(line_item)}" %>
4
+ </td>
5
+ <% end %>
@@ -0,0 +1,22 @@
1
+ <% if variant.option_values.any? || variant.is_master?%>
2
+ <td class="cart-item-description" data-hook="cart_item_description">
3
+ <h4><%= link_to line_item.name, product_path(variant.product) %></h4>
4
+ <%= variant.options_text %>
5
+ <% if line_item.insufficient_stock? %>
6
+ <span class="out-of-stock">
7
+ <%= t('spree.out_of_stock') %>&nbsp;&nbsp;<br />
8
+ </span>
9
+ <% end %>
10
+ <span class="line-item-description" data-hook="line_item_description">
11
+ <%= line_item_description_text(line_item.description) %>
12
+ </span>
13
+ </td>
14
+ <% else %>
15
+ <% auction = variant.auction %>
16
+ <td class="cart-item-description" data-hook="cart_item_description">
17
+ <h4><%= link_to auction.title, auction %></h4>
18
+ <span class="line-item-description" data-hook="line_item_description">
19
+ <%= auction.description %>
20
+ </span>
21
+ </td>
22
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <% if variant.option_values.any? || variant.is_master?%>
2
+ <td class="cart-item-quantity" data-hook="cart_item_quantity">
3
+ <%= item_form.number_field :quantity, min: 0, class: "line_item_quantity", size: 5 %>
4
+ </td>
5
+ <% else %>
6
+ <td class="cart-item-quantity" data-hook="cart_item_quantity">
7
+ <%= item_form.number_field :quantity, min: 0, class: "line_item_quantity", size: 5, disabled: true %>
8
+ </td>
9
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <% if item.variant.option_values.any? || item.variant.is_master?%>
2
+ <td data-hook="order_item_description">
3
+ <h4><%= item.variant.product.name %></h4>
4
+ <%= truncated_product_description(item.variant.product) %>
5
+ <%= "(" + item.variant.options_text + ")" unless item.variant.option_values.empty? %>
6
+ </td>
7
+ <% else %>
8
+ <td data-hook="order_item_description">
9
+ <% auction = item.variant.auction %>
10
+ <h4>
11
+ <%= link_to auction.title, auction %>
12
+ </h4>
13
+ <%= truncate_html(auction.description) %>
14
+ </td>
15
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <% if auction.starting_datetime %>
2
+ <span>
3
+ <%= Spree.t("starts_in") %>
4
+ </span>
5
+ <span class="starts-in green" data-auction-end-datetime=<%= auction.current_end_datetime_as_float%> data-auction-starting-datetime=<%= auction.starting_datetime_as_float%>>
6
+ <% if auction.complete %>
7
+ <span class="green">
8
+ COMPLETE
9
+ </span>
10
+ <% else %>
11
+ <%= distance_of_time_in_words_to_now(auction.starting_datetime) %>
12
+ <% end %>
13
+ </span>
14
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% if item.variant.option_values.any? || item.variant.is_master?%>
2
+ <td class="item-name"><%= item.variant.name %></td>
3
+ <% else %>
4
+ <td class="item-name"><%= item.variant.auction.title %></td>
5
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <div>
2
+ <% if auction.in_progress? %>
3
+ <%= render partial: 'spree/shared/ends_in', locals: { auction: auction } %>
4
+ <% elsif auction.complete %>
5
+ <span class="green">
6
+ <%= Spree.t("complete") %>
7
+ </span>
8
+ <% else %>
9
+ <%= render partial: 'spree/shared/starts_in', locals: { auction: auction } %>
10
+ <% end %>
11
+ </div>
@@ -0,0 +1,21 @@
1
+ <% if variant.option_values.any? || variant.is_master?%>
2
+ <tr id="<%= spree_dom_id variant %>" data-hook="variants_row" class="<%= "deleted" if variant.deleted? %>">
3
+ <td>
4
+ <% if can? :update_positions, Spree::Variant %>
5
+ <span class="handle"></span>
6
+ <% end %>
7
+ </td>
8
+ <td><%= variant.options_text %></td>
9
+ <td><%= variant.display_price.to_html %></td>
10
+ <td><%= variant.sku %></td>
11
+ <td class="actions">
12
+ <% if can?(:update, variant) %>
13
+ <%= link_to_edit(variant, no_text: true) unless variant.deleted? %>
14
+ <% end %>
15
+ <% if can?(:destroy, variant) %>
16
+ &nbsp;
17
+ <%= link_to_delete(variant, no_text: true) unless variant.deleted? %>
18
+ <% end %>
19
+ </td>
20
+ </tr>
21
+ <% end %>
@@ -0,0 +1,62 @@
1
+ <% if variant.option_values.any? || variant.is_master?%>
2
+ <tbody class="variant-stock-items">
3
+ <tr id="<%= spree_dom_id variant %>">
4
+ <td class="no-padding" rowspan="<%= row_count %>">
5
+ <div class='variant-container'>
6
+ <div class='variant-image'>
7
+ <%= render 'spree/admin/shared/image', image: variant.display_image(fallback: false), size: :small %>
8
+ </div>
9
+ <div class='variant-details'>
10
+ <table class='stock-variant-field-table'>
11
+ <tbody>
12
+ <% @variant_display_attributes.each do |display_attribute| %>
13
+ <tr>
14
+ <td><%= t(display_attribute[:translation_key], scope: 'spree') %></td>
15
+ <td class="fullwidth">
16
+ <%= variant.send(display_attribute[:attr_name]) %>
17
+ </td>
18
+ </tr>
19
+ <% end %>
20
+ </tbody>
21
+ </table>
22
+ </div>
23
+ </div>
24
+ </td>
25
+ <td rowspan="<%= row_count %>">
26
+ <table class='stock-variant-field-table'>
27
+ <% variant.option_values.sort_by(&:option_type_name).each do |option_value| %>
28
+ <tr>
29
+ <td>
30
+ <%= option_value.option_type_presentation %>
31
+ </td>
32
+ <td><%= option_value.presentation %></td>
33
+ </tr>
34
+ <% end %>
35
+ </table>
36
+ </td>
37
+ </tr>
38
+ <% variant.stock_items.each do |item| %>
39
+ <% if @stock_item_stock_locations.include?(item.stock_location) %>
40
+ <tr class="js-edit-stock-item stock-item-edit-row" data-variant-id="<%= variant.id %>" data-stock-item="<%= item.to_json %>" data-stock-location-name="<%= item.stock_location.name %>">
41
+ <%# This is rendered in JS %>
42
+ </tr>
43
+ <% end %>
44
+ <% end %>
45
+ <% if display_add_row %>
46
+ <tr class="js-add-stock-item stock-item-edit-row" data-variant-id="<%= variant.id %>">
47
+ <td class='location-name-cell'>
48
+ <%= select_tag :stock_location_id, options_from_collection_for_select(locations_without_items, :id, :name), { include_blank: true, class: 'custom-select', "data-placeholder" => t('spree.add_to_stock_location'), id: "variant-stock-location-#{variant.id}" } %>
49
+ </td>
50
+ <td class="align-center">
51
+ <%= check_box_tag :backorderable, 'backorderable', false, id: "variant-backorderable-#{variant.id}" %>
52
+ </td>
53
+ <td class="align-center">
54
+ <%= number_field_tag :count_on_hand, "", class: 'fullwidth', id: "variant-count-on-hand-#{variant.id}" %>
55
+ </td>
56
+ <td class="actions">
57
+ <%= link_to_with_icon 'plus', t('spree.actions.create'), '#', no_text: true, data: { action: 'add' }, class: "submit" %>
58
+ </td>
59
+ </tr>
60
+ <% end %>
61
+ </tbody>
62
+ <% end %>