From 57fb85514773575f28e2e0aec3c5195a9cdcf2b2 Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 20 Feb 2025 11:43:09 +1100 Subject: [PATCH] Ensure label reaches to edge of table cell Best viewed with whitespace ignored --- .../admin/dfc_product_imports/index.html.haml | 63 ++++++++++--------- app/webpacker/css/admin_v3/all.scss | 1 + .../admin_v3/pages/dfc_product_imports.scss | 11 ++++ 3 files changed, 44 insertions(+), 31 deletions(-) create mode 100644 app/webpacker/css/admin_v3/pages/dfc_product_imports.scss diff --git a/app/views/admin/dfc_product_imports/index.html.haml b/app/views/admin/dfc_product_imports/index.html.haml index f4182b55fc..80f780cff2 100644 --- a/app/views/admin/dfc_product_imports/index.html.haml +++ b/app/views/admin/dfc_product_imports/index.html.haml @@ -1,36 +1,37 @@ - content_for :page_title do #{t(".title")} -= render partial: 'spree/admin/shared/product_sub_menu' - -%p= t('.catalog_url', count: @items.count, catalog_url: @catalog_url) -%p= t('.enterprise', enterprise_name: @enterprise.name) -%br - -= form_with url: main_app.import_admin_dfc_product_imports_path do |form| - -# This is a very inefficient way of holding a json blob. Maybe base64 encode or store as a temporary file - = form.hidden_field :enterprise_id, value: @enterprise.id - = form.hidden_field :catalog_json, value: @catalog_json - - %table{"data-controller": "checked" } - %thead - %tr - %th - %input{ type: 'checkbox', title: t('.select_all'), 'aria-label': t('.select_all'), 'data-checked-target': "all" } - %th - %tbody - - @items.each do |supplied_product, existing_product| - %tr{id: supplied_product.semanticId } - %td - %label - = form.check_box 'semanticIds[]', { checked: true, 'data-checked-target': "checkbox" }, supplied_product.semanticId, "" - = supplied_product.name - %td - - if existing_product.present? - = t(".update") - = link_to(existing_product.id, edit_admin_product_path(existing_product)) - - else - = t(".new") +#dfc_product_imports + = render partial: 'spree/admin/shared/product_sub_menu' + %p= t('.catalog_url', count: @items.count, catalog_url: @catalog_url) + %p= t('.enterprise', enterprise_name: @enterprise.name) %br - = form.submit t(".import") + + = form_with url: main_app.import_admin_dfc_product_imports_path do |form| + -# This is a very inefficient way of holding a json blob. Maybe base64 encode or store as a temporary file + = form.hidden_field :enterprise_id, value: @enterprise.id + = form.hidden_field :catalog_json, value: @catalog_json + + %table{"data-controller": "checked" } + %thead + %tr + %th + %input{ type: 'checkbox', title: t('.select_all'), 'aria-label': t('.select_all'), 'data-checked-target': "all" } + %th + %tbody + - @items.each do |supplied_product, existing_product| + %tr{id: supplied_product.semanticId } + %td + %label + = form.check_box 'semanticIds[]', { checked: true, 'data-checked-target': "checkbox" }, supplied_product.semanticId, "" + = supplied_product.name + %td + - if existing_product.present? + = t(".update") + = link_to(existing_product.id, edit_admin_product_path(existing_product)) + - else + = t(".new") + + %br + = form.submit t(".import") diff --git a/app/webpacker/css/admin_v3/all.scss b/app/webpacker/css/admin_v3/all.scss index 32eba7ddde..a339a20457 100644 --- a/app/webpacker/css/admin_v3/all.scss +++ b/app/webpacker/css/admin_v3/all.scss @@ -133,3 +133,4 @@ @import "terms_of_service_banner"; // admin_v3 @import "pages/product_preview"; // admin_v3 +@import "pages/dfc_product_imports"; // admin_v3 diff --git a/app/webpacker/css/admin_v3/pages/dfc_product_imports.scss b/app/webpacker/css/admin_v3/pages/dfc_product_imports.scss new file mode 100644 index 0000000000..dabcb805d7 --- /dev/null +++ b/app/webpacker/css/admin_v3/pages/dfc_product_imports.scss @@ -0,0 +1,11 @@ + +#dfc_product_imports { + // Ensure label reaches to edge of table cell + td:has(> label) { + padding: 0; + } + td > label { + display: block; + padding: 7px 5px; + } +} \ No newline at end of file