Switch to edit pane if rich text field validation fails
Allows the "Please fill out this field" message to be visible.
This commit is contained in:
parent
7cd7db5718
commit
8498d0d6a8
2 changed files with 20 additions and 0 deletions
|
@ -8,6 +8,10 @@ $(document).ready(function () {
|
||||||
var container = $(this).closest(".richtext_container");
|
var container = $(this).closest(".richtext_container");
|
||||||
|
|
||||||
container.find(".tab-pane[id$='_preview']").empty();
|
container.find(".tab-pane[id$='_preview']").empty();
|
||||||
|
}).on("invalid", function () {
|
||||||
|
var container = $(this).closest(".richtext_container");
|
||||||
|
|
||||||
|
container.find("button[data-bs-target$='_edit']").tab("show");
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
16
test/system/rich_text_test.rb
Normal file
16
test/system/rich_text_test.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
require "application_system_test_case"
|
||||||
|
|
||||||
|
class RichTextSystemTest < ApplicationSystemTestCase
|
||||||
|
def setup
|
||||||
|
create(:language, :code => "en")
|
||||||
|
end
|
||||||
|
|
||||||
|
test "switches to edit pane on validation failure" do
|
||||||
|
sign_in_as create(:user)
|
||||||
|
visit new_diary_entry_path
|
||||||
|
fill_in "Subject", :with => "My Diary Entry Title"
|
||||||
|
click_on "Preview"
|
||||||
|
click_on "Publish"
|
||||||
|
assert_field "Body"
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue