Closed Mikael-Lenander closed 6 months ago
Related issue: apluslms/a-plus#1143
I looked into this in more detail and turns out that there is no need for an additional option in the FreeText class. The placeholder can be added to the :extra: option and it renders nicely. However, the placeholder is not added to form_i18n dictionary for some reason, so translations don't work.
Hey,
I got the placeholder FreeText option working for multilingual courses, it required some changes in MOOC-Grader too. I will be finishing a pull request on it and you can then test it.
I believe I still need to do similar changes to MOOC-Jutut as I did to MOOC-Grader to get the placeholder to display in Jutut exercises too. I'll see if I can figure it out.
@Mikael-Lenander I got the placeholder :extra: option working more easily, since it was already somewhat supported by MOOC-Jutut. I had to make some changes in MOOC-Grader to get the translations working in both MOOC-Jutut questionnaires and normal MOOC-Grader questionnaires.
Could you test the PR and tell me if it fulfills your needs? https://github.com/apluslms/mooc-grader/pull/157
I will close this PR now, since we don't need a new :placeholder: option after all.
Description
What?
Add placeholder option for freetext directive. Placeholder is a text that is shown in an empty input field.
Why?
Specify units etc.
How?
Adds a new option_spec to FreeText class.
Testing
Remember to add or update unit tests for new features and changes.
What type of test did you run?
Compiled rst code. The placeholder attributes appeared in html files in _build folder.
Did you test the changes in
Think of what is affected by these changes and could become broken
Translation
Programming style
Have you updated the README or other relevant documentation?
Is it Done?
Clean up your git commit history before submitting the pull request!