Merge pull request #11187 from jibees/10975-white-label-remember-custom-tab-activation-after-error-message

Admin, White Label: check the custom tab checkbox if any errors on custom tab (ie. title is blank)
This commit is contained in:
Filipe
2023-07-13 16:43:18 +01:00
committed by GitHub
2 changed files with 7 additions and 1 deletions

View File

@@ -46,7 +46,8 @@
= label_tag :custom_tab, t('.create_custom_tab')
.thirteen.columns
= hidden_field_tag :custom_tab, "false" # submit `true` if checkbox is checked, `false` otherwise
= check_box_tag :custom_tab, "true", @object.custom_tab&.title.present?, { "data-controller": "checkbox-display", "data-checkbox-display-target-id-value": "custom_tab_form" }
- checked = @object.custom_tab&.title.present? || @object.errors["custom_tab.title"].present?
= check_box_tag :custom_tab, "true", checked, { "data-controller": "checkbox-display", "data-checkbox-display-target-id-value": "custom_tab_form" }
%div{id: "custom_tab_form"}
= f.fields_for :custom_tab, @object.custom_tab do |custom_tab_form|

View File

@@ -760,6 +760,11 @@ describe '
click_button 'Update'
expect(page).to have_content("Custom tab title can't be blank")
expect(distributor1.reload.custom_tab).to be_nil
within(".side_menu") do
click_link "White Label"
end
expect(page).to have_checked_field "Create custom tab in shopfront"
end
it "can't save custom tab fields if title is too long" do