diff --git a/app/assets/javascripts/darkswarm/directives/shipping_type_selector.js.coffee b/app/assets/javascripts/darkswarm/directives/shipping_type_selector.js.coffee index b7ffe71eb9..bf89254298 100644 --- a/app/assets/javascripts/darkswarm/directives/shipping_type_selector.js.coffee +++ b/app/assets/javascripts/darkswarm/directives/shipping_type_selector.js.coffee @@ -1,8 +1,6 @@ angular.module('Darkswarm').directive "shippingTypeSelector", -> # Builds selector for shipping types - restrict: 'E' - replace: true - templateUrl: 'shipping_type_selector.html' + restrict: 'C' link: (scope, elem, attr)-> scope.shippingTypes = pickup: false diff --git a/app/assets/javascripts/darkswarm/directives/shop_variant.js.coffee b/app/assets/javascripts/darkswarm/directives/shop_variant.js.coffee deleted file mode 100644 index 372a92b69d..0000000000 --- a/app/assets/javascripts/darkswarm/directives/shop_variant.js.coffee +++ /dev/null @@ -1,7 +0,0 @@ -angular.module('Darkswarm').directive "shopVariant", -> - restrict: 'E' - replace: true - templateUrl: 'shop_variant.html' - scope: - variant: '=' - controller: 'ShopVariantCtrl' diff --git a/app/assets/javascripts/templates/shipping_type_selector.html.haml b/app/assets/javascripts/templates/shipping_type_selector.html.haml deleted file mode 100644 index 45f35911d4..0000000000 --- a/app/assets/javascripts/templates/shipping_type_selector.html.haml +++ /dev/null @@ -1,4 +0,0 @@ -%ul.small-block-grid-2.medium-block-grid-4.large-block-grid-2 - %active-selector{"ng-repeat" => "(name, selector) in selectors"} - %i{"ng-class" => "selector.icon"} - {{ selector.translation_key | t | capitalize }} \ No newline at end of file diff --git a/app/assets/javascripts/templates/shop_variant.html.haml b/app/assets/javascripts/templates/shop_variant.html.haml deleted file mode 100644 index 382839712d..0000000000 --- a/app/assets/javascripts/templates/shop_variant.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -.variants.row - .small-4.medium-4.large-5.columns.variant-name - .inline{"ng-if" => "::variant.display_name"} {{ ::variant.display_name }} - .variant-unit {{ ::variant.unit_to_display }} - .small-3.medium-3.large-2.columns.variant-price - %price-breakdown{"price-breakdown" => "_", variant: "variant", - "price-breakdown-append-to-body" => "true", - "price-breakdown-placement" => "bottom", - "price-breakdown-animation" => true} - {{ variant.price_with_fees | localizeCurrency }} - .unit-price.variant-unit-price - %question-mark-with-tooltip{"question-mark-with-tooltip" => "_", - "question-mark-with-tooltip-append-to-body" => "true", - "question-mark-with-tooltip-placement" => "top", - "question-mark-with-tooltip-animation" => true, - key: "'js.shopfront.unit_price_tooltip'"} - {{ variant.unit_price_price | localizeCurrency }} / {{ variant.unit_price_unit }} - - .medium-2.large-2.columns.total-price - %span{"ng-class" => "{filled: variant.line_item.total_price}"} - {{ variant.line_item.total_price | localizeCurrency }} - %ng-include{src: "'partials/shop_variant_no_group_buy.html'"} - %ng-include{src: "'partials/shop_variant_with_group_buy.html'"} diff --git a/app/views/shop/products/_form.html.haml b/app/views/shop/products/_form.html.haml index bccaf6e334..18471ead25 100644 --- a/app/views/shop/products/_form.html.haml +++ b/app/views/shop/products/_form.html.haml @@ -13,7 +13,8 @@ %product.animate-repeat{"ng-controller" => "ProductNodeCtrl", "ng-repeat" => "product in Products.products track by product.id", "id" => "product-{{ product.id }}"} = render "shop/products/summary" .shop-variants - %shop-variant{variant: 'variant', "ng-repeat" => "variant in product.variants | orderBy: ['name_to_display','unit_value'] track by variant.id", "id" => "variant-{{ variant.id }}", "ng-class" => "{'out-of-stock': !variant.on_demand && variant.on_hand == 0}"} + .variants.row{"ng-controller": "ShopVariantCtrl", variant: 'variant', "ng-repeat" => "variant in product.variants | orderBy: ['name_to_display','unit_value'] track by variant.id", "id" => "variant-{{ variant.id }}", "ng-class" => "{'out-of-stock': !variant.on_demand && variant.on_hand == 0}"} + = render "shop/products/shop_variant" %product{"ng-show" => "Products.loading"} .summary .small-12.columns.text-center diff --git a/app/views/shop/products/_shop_variant.html.haml b/app/views/shop/products/_shop_variant.html.haml new file mode 100644 index 0000000000..63d5f05090 --- /dev/null +++ b/app/views/shop/products/_shop_variant.html.haml @@ -0,0 +1,22 @@ +.small-4.medium-4.large-5.columns.variant-name + .inline{"ng-if" => "::variant.display_name"} {{ ::variant.display_name }} + .variant-unit {{ ::variant.unit_to_display }} +.small-3.medium-3.large-2.columns.variant-price + %price-breakdown{"price-breakdown" => "_", variant: "variant", + "price-breakdown-append-to-body" => "true", + "price-breakdown-placement" => "bottom", + "price-breakdown-animation" => true} + {{ variant.price_with_fees | localizeCurrency }} + .unit-price.variant-unit-price + %question-mark-with-tooltip{"question-mark-with-tooltip" => "_", + "question-mark-with-tooltip-append-to-body" => "true", + "question-mark-with-tooltip-placement" => "top", + "question-mark-with-tooltip-animation" => true, + key: "'js.shopfront.unit_price_tooltip'"} + {{ variant.unit_price_price | localizeCurrency }} / {{ variant.unit_price_unit }} + +.medium-2.large-2.columns.total-price + %span{"ng-class" => "{filled: variant.line_item.total_price}"} + {{ variant.line_item.total_price | localizeCurrency }} += render partial: "shop/products/shop_variant_no_group_buy" += render partial: "shop/products/shop_variant_with_group_buy" diff --git a/app/assets/javascripts/templates/partials/shop_variant_no_group_buy.html.haml b/app/views/shop/products/_shop_variant_no_group_buy.html.haml similarity index 100% rename from app/assets/javascripts/templates/partials/shop_variant_no_group_buy.html.haml rename to app/views/shop/products/_shop_variant_no_group_buy.html.haml diff --git a/app/assets/javascripts/templates/partials/shop_variant_with_group_buy.html.haml b/app/views/shop/products/_shop_variant_with_group_buy.html.haml similarity index 100% rename from app/assets/javascripts/templates/partials/shop_variant_with_group_buy.html.haml rename to app/views/shop/products/_shop_variant_with_group_buy.html.haml diff --git a/app/views/shops/_filters.html.haml b/app/views/shops/_filters.html.haml index 1e62405be3..f3011a0a25 100644 --- a/app/views/shops/_filters.html.haml +++ b/app/views/shops/_filters.html.haml @@ -19,7 +19,7 @@ .light = t :hubs_filter_by = t :hubs_filter_delivery - %shipping-type-selector + = render "shops/shipping_type_selector" .small-12.large-12.columns %h5.tdhead diff --git a/app/views/shops/_shipping_type_selector.html.haml b/app/views/shops/_shipping_type_selector.html.haml new file mode 100644 index 0000000000..db7c8319c7 --- /dev/null +++ b/app/views/shops/_shipping_type_selector.html.haml @@ -0,0 +1,4 @@ +%ul.shipping-type-selector.small-block-grid-2.medium-block-grid-4.large-block-grid-2 + %active-selector{"ng-repeat" => "(name, selector) in selectors"} + %i{"ng-class" => "selector.icon"} + {{ selector.translation_key | t | capitalize }}