Ensure label reaches to edge of table cell

Best viewed with whitespace ignored
This commit is contained in:
David Cook
2025-02-20 11:43:09 +11:00
parent b370b207b5
commit 57fb855147
3 changed files with 44 additions and 31 deletions

View File

@@ -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")

View File

@@ -133,3 +133,4 @@
@import "terms_of_service_banner"; // admin_v3
@import "pages/product_preview"; // admin_v3
@import "pages/dfc_product_imports"; // admin_v3

View File

@@ -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;
}
}