diff --git a/app/assets/stylesheets/store/openfoodweb.css.scss b/app/assets/stylesheets/store/openfoodweb.css.scss index 6d377df06a..89affd418f 100644 --- a/app/assets/stylesheets/store/openfoodweb.css.scss +++ b/app/assets/stylesheets/store/openfoodweb.css.scss @@ -34,6 +34,7 @@ nav#filters { } } + /* Style the product source on the product details page in the * same manner as the product properties table above it. */ @@ -43,3 +44,57 @@ nav#filters { #product-properties td, #product-source td { width: 50%; } + + +/* Apply Spree's ul#products style to ul.product-listing. When viewing products + * split by distributor, a separate product listing is displayed for local and + * remote products, so the #products id is removed to avoid its duplication. + */ +ul.product-listing { + &:after { + content: " "; + display: block; + clear: both; + visibility: hidden; + line-height: 0; + height: 0; + } + + li { + text-align: center; + font-weight: bold; + margin-bottom: 20px; + + a { + display: block; + + &.info { + height: 35px; + margin-top: 5px; + font-size: $product_list_name_font_size; + color: $product_link_text_color; + border-bottom: 1px solid lighten($body_text_color, 60); + overflow: hidden; + } + } + + .product-image { + border: 1px solid lighten($body_text_color, 60); + padding: 5px; + min-height: 110px; + background-color: $product_background_color; + + &:hover { + border-color: $link_text_color; + } + + } + + .price { + color: $link_text_color; + font-size: $product_list_price_font_size; + padding-top: 5px; + display: block; + } + } +} diff --git a/app/overrides/split_products_by_distributor.rb b/app/overrides/split_products_by_distributor.rb new file mode 100644 index 0000000000..7f78d1eb3a --- /dev/null +++ b/app/overrides/split_products_by_distributor.rb @@ -0,0 +1,4 @@ +Deface::Override.new(:virtual_path => "spree/home/index", + :replace => "[data-hook='homepage_products']", + :partial => "spree/shared/products_by_distributor", + :name => "products") diff --git a/app/views/spree/shared/_products.html.erb b/app/views/spree/shared/_products.html.erb new file mode 100644 index 0000000000..0d633e7415 --- /dev/null +++ b/app/views/spree/shared/_products.html.erb @@ -0,0 +1,31 @@ +<% + paginated_products = @searcher.retrieve_products if params.key?(:keywords) + paginated_products ||= products +%> +<% if products.empty? %> + <%= t(:no_products_found) %> +<% elsif params.key?(:keywords) %> +