Add strict locals for some products V3 templates

Rails now allows you to define which local a template is expecting:
https://edgeguides.rubyonrails.org/7_1_release_notes.html#allow-templates-to-set-strict-locals
This commit is contained in:
Gaetan Craig-Riou
2025-10-22 14:59:55 +11:00
parent 94bda6d0f8
commit 61f8b5c7f4
5 changed files with 5 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
-# locals: (products:, pagy:, search_term:, producer_options:, producer_id:, category_options:, category_id:, tax_category_options:, available_tags:, tags:, flashes:, display_search_filter:)
%turbo-frame#products-content{ target: "_top", refresh: "morph" }
.spinner-overlay{ "data-controller": "loading", "data-products-target": "loading", class: "hidden" }
.spinner-container

View File

@@ -1,3 +1,4 @@
-# locals: (form:, product:, product_index:, producer_options:, category_options:, tax_category_options:)
= form.fields_for("products", product, index: product_index) do |product_form|
%tbody.relaxed{ id: dom_id(product), data: { 'record-id': product_form.object.id,
controller: "nested-form product",

View File

@@ -1,3 +1,4 @@
-# locals: (products:, producer_options:, category_options:, tax_category_options:)
= form_with url: admin_products_bulk_update_path, method: :post, id: "products-form",
builder: BulkFormBuilder,
html: { data: { 'turbo-frame': "_self",

View File

@@ -1,3 +1,4 @@
-# locals: (variant:, f:, category_options:, tax_category_options:, producer_options:)
- method_on_demand, method_on_hand = variant.new_record? ? [:on_demand_desired, :on_hand_desired ]: [:on_demand, :on_hand]
%td.col-image
-# empty

View File

@@ -1,3 +1,4 @@
-# locals: (producers:, categories:, tax_category_options:, available_tags:, flash:)
- content_for :page_title do
= t('.header.title')
- content_for :page_actions do