From 353d6fbc5fa3aadeacce6d411036a74bcb5b2e65 Mon Sep 17 00:00:00 2001 From: Hugo Daniel Date: Wed, 24 Jul 2019 16:36:15 +0200 Subject: [PATCH] Import variants/index from spree_backend to ofn and convert to Haml --- .../replace_options_text.html.haml.deface | 3 -- .../spree/admin/variants/index.html.haml | 54 +++++++++++++++++++ 2 files changed, 54 insertions(+), 3 deletions(-) delete mode 100644 app/overrides/spree/admin/variants/index/replace_options_text.html.haml.deface create mode 100644 app/views/spree/admin/variants/index.html.haml diff --git a/app/overrides/spree/admin/variants/index/replace_options_text.html.haml.deface b/app/overrides/spree/admin/variants/index/replace_options_text.html.haml.deface deleted file mode 100644 index 5b76f19fa6..0000000000 --- a/app/overrides/spree/admin/variants/index/replace_options_text.html.haml.deface +++ /dev/null @@ -1,3 +0,0 @@ -/ replace "code[erb-loud]:contains('variant.options_text')" - -= variant.full_name diff --git a/app/views/spree/admin/variants/index.html.haml b/app/views/spree/admin/variants/index.html.haml new file mode 100644 index 0000000000..a676e92de3 --- /dev/null +++ b/app/views/spree/admin/variants/index.html.haml @@ -0,0 +1,54 @@ += render partial: 'spree/admin/shared/product_sub_menu' + += render partial: 'spree/admin/shared/product_tabs', locals: {current: 'Variants'} + +#new_variant +- if @variants.any? + %table.index.sortable{"data-sortable-link" => update_positions_admin_product_variants_path(@product)} + %colgroup + %col{style: "width: 5%"}/ + %col{style: "width: 25%"}/ + %col{style: "width: 20%"}/ + %col{style: "width: 20%"}/ + %col{style: "width: 15%"}/ + %col{style: "width: 15%"}/ + %thead{"data-hook" => "variants_header"} + %tr + %th{colspan: "2"}= Spree.t(:options) + %th= Spree.t(:price) + %th= Spree.t(:sku) + %th.actions + %tbody + - @variants.each do |variant| + %tr{id: spree_dom_id(variant), "data-hook" => "variants_row", class: cycle('odd', 'even'), style: "#{"color:red;" if variant.deleted? }" } + %td.no-border + %span.handle + %td= variant.full_name + %td.align-center= variant.display_price.to_html + %td.align-center= variant.sku + %td.actions + = link_to_edit(variant, no_text: true) unless variant.deleted? + = link_to_delete(variant, no_text: true) unless variant.deleted? + - unless @product.has_variants? + %tr + %td{colspan: "5"}= Spree.t(:none) + +- else + .alpha.twelve.columns.no-objects-found + = Spree.t(:no_results) + \. + +- if @product.empty_option_values? + %p.first_add_option_types.no-objects-found{"data-hook" => "first_add_option_types"} + = Spree.t(:to_add_variants_you_must_first_define) + = link_to Spree.t(:option_types), admin_product_url(@product) + = Spree.t(:and) + = link_to Spree.t(:option_values), admin_option_types_url + +- else + - content_for :page_actions do + %ul.inline-menu{"data-hook" => "toolbar"} + %li#new_var_link{"data-hook" => ""} + = link_to_with_icon('icon-plus', Spree.t(:new_variant), new_admin_product_variant_url(@product), remote: true, 'data-update' => 'new_variant', class: 'button') + + %li= link_to_with_icon('icon-filter', @deleted.blank? ? Spree.t(:show_deleted) : Spree.t(:show_active), admin_product_variants_url(@product, deleted: @deleted.blank? ? "on" : "off"), class: 'button')