Fix broken translated field after form errors#3026
Merged
Conversation
So the template can assume its locals are consistently the same type.
Reuse the logic to construct the base id for the attributes' id construction.
So "calculation" is straightforward and we don't need helper methods.
It'll have already been replaced with a proper value by then.
The placeholder variable "${tabsId}" that is interpolated by this
library is causing errors when you submit a form with a freshly created
translated field and it has errors. The field will be rerendered with
the "${tabsId}" placeholder in the field tabs link destinations and that
will make foundation-tabs crash. That will make it impossible to further
switch tabs in that field.
This library has not been updated for 4 years anyways and new
alternatives are now recommended.
Codecov Report
@@ Coverage Diff @@
## master #3026 +/- ##
==========================================
+ Coverage 98.67% 98.67% +<.01%
==========================================
Files 1699 1699
Lines 40568 40582 +14
==========================================
+ Hits 40032 40046 +14
Misses 536 536 |
mrcasals
approved these changes
Mar 19, 2018
Contributor
mrcasals
left a comment
There was a problem hiding this comment.
Code looks good to me, I don't see anything that raises suspicions, so it's a go for me!
oriolgual
approved these changes
Mar 19, 2018
rbngzlv
added a commit
that referenced
this pull request
Mar 21, 2018
* master: [RFC] Use cells for meeting m cards (#3022) Do not force Postgresql user to be admin when enabling trigram extension (#3053) Make organization reference_prefix required (#3056) admin can duplicate/copy meetings (#3051) Fix question form errors not being displayed (#3046) Erb whitespace cutting (#3047) Show debates statistics on space show and homepage (#3016) Fix broken translated field after form errors (#3026) Move decidim executable to "exe" folder (#3028) Friendlier buttons (#3027) Feedback needed after Endorsing when user has no user_groups (#2998) Fix seeding error on generator specs (#3021) fix spelling error in threshold (#3019) Migration plus seeds (#2933)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎩 What? Why?
When working on some features for surveys, I noticed a small bug:
I started fixing it, but the
jquery-tmpllibrary was giving me some trouble:${tabsId}) that it uses was being included in the href of the translated field tabs, and that was makingfoundation-tabscrash and preventing the tabs from being enabled.I couldn't really figure out an easy way to fix that other that not using those interpolation placeholders at all.
jquery-tmplwas not really doing much and it seems like an abandoned library that hasn't been updated for 4 years. So I removed its usage and replaced it with some similar custom code.I'm not sure about the last commit, initially I was globally replacing the "placeholder string" with a unique value, but I was paranoid about someone creating a question like this:
and unintentionally replacing actual content that I don't want to replace...
📌 Related Issues
None.
📋 Subtasks
CHANGELOGentry📷 Screenshots (optional)
Before
After