-
-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix question form errors not being displayed (#3046)
* Remove unused attribute * Avoid the need to pass the template id I'll be using proper form builder helpers for the inputs of these forms so that proper error messages can be displayed around each one. In order to do that, each template must have different base input names to be able to distinguish which question each answer option belongs to. So we render a separate template next to each "add field" button, and we can locate it from the input button itself without needing any ids. * Stop caring about the position of the placeholder In later commits nested templates could go through several interpolations and the placeholder won't always be in the middle, so stop caring about its position. This allows us to extract an utility method since the replacement is consistently done in the same way. * Prefer an empty form to an `OpenStruct` For consistency with the `blank_question` method. * Use rectify's default of integer id's * Simplify unique nested field id generation I think this is "more unique" and it also generates an integer, which will be handy later. * Pass placeholder id directly So that the generate unique key is actually an integer. This will be useful later when will use this id as the id for our rectify form. * Remove OpenStruct weirdness from SurveyQuestion Instead, create a different virtual attribute at the form level and do proper mapping in there. * Minor reordering in specs I think it reads slightly better like this. * A few more spec readability improvements * Closer match to `fiels_for` naming * Fix error messages not displayed on question error We now use proper form builder methods that wrap actual objects, so we get full error messages, required attribute detection, and so on.
- Loading branch information
1 parent
d02571c
commit ed4fa90
Showing
14 changed files
with
166 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.