From c78e734dee5f69a2c6ce21e53571a734f3e0c4d1 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Thu, 12 May 2022 14:41:41 +0200 Subject: [PATCH] Initialize with submitted value `on_hand` --- app/controllers/spree/admin/products_controller.rb | 2 ++ app/views/spree/admin/products/new.html.haml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/spree/admin/products_controller.rb b/app/controllers/spree/admin/products_controller.rb index 9aae19e015..7f1f9e63f4 100644 --- a/app/controllers/spree/admin/products_controller.rb +++ b/app/controllers/spree/admin/products_controller.rb @@ -36,6 +36,8 @@ module Spree redirect_to spree.admin_products_path end else + # Re-fill the form with deleted params on product + @on_hand = request.params[:product][:on_hand] render :new end end diff --git a/app/views/spree/admin/products/new.html.haml b/app/views/spree/admin/products/new.html.haml index 28adb4b815..154793f6cb 100644 --- a/app/views/spree/admin/products/new.html.haml +++ b/app/views/spree/admin/products/new.html.haml @@ -77,7 +77,7 @@ = f.field_container :on_hand do = f.label :on_hand, t(".on_hand") %br/ - = f.text_field :on_hand, class: 'fullwidth' + = f.text_field :on_hand, class: 'fullwidth', value: @on_hand = f.error_message_on :on_hand .three.columns.omega = f.field_container :on_demand do