Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MBS-9219: Fix editing known languages field in user profile form #472

Merged
merged 3 commits into from Feb 20, 2017

Conversation

yvanzo
Copy link
Contributor

@yvanzo yvanzo commented Feb 19, 2017

y-van-z added 2 commits February 19, 2017 20:23
In user profile editing form, template for adding a known language
caused to systematically save an unwanted `[Multiple languages]`
additional entry.

This is solved by moving the template out of the <form> element.
Properly number and replace `id` and `name` template properties for
added known languages in user profile editing form.
[% r.select(extra_field.field('language_id'), id => 'fluency-template', class => 'language_id',) %]
[% r.select(extra_field.field('fluency'), class => 'fluency') %]
[% r.select(extra_field.field('language_id'), id => 'id-language-id-template', class => 'language_id', name => 'language-id-template') %]
[% r.select(extra_field.field('fluency'), id => 'id-fluency-template', class => 'fluency', name => 'fluency-template') %]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something I'm wondering is, are these id and name attributes actually needed? It seems they aren't used anywhere and are just overridden in the script below, so we can just remove them.

Copy link
Contributor Author

@yvanzo yvanzo Feb 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed ids are of no use. They had to be unique, hence the override, but removal is even better. Only names are needed for form submission. And yes, template’s name is worthless. Cleaned up in 547b27e

Copy link
Member

@mwiencek mwiencek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks good, but I'm wondering what the purpose of those attributes is.

- Remove unused `id` and `name` attributes from template `<select>`
- Set `name` attribute only to added language input
@yvanzo
Copy link
Contributor Author

yvanzo commented Feb 20, 2017

Cleaned up in 547b27e (to be squashed with previous commit)

@mwiencek mwiencek merged commit d8ebdbb into metabrainz:master Feb 20, 2017
@yvanzo yvanzo deleted the mbs-9219-fix-profile-editing branch April 2, 2017 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants