Fix bug candidates of forms on Bootstrap Grid system (EE)
For EE specific content of gitlab-foss#57189 (closed) (gitlab-foss!24885 (merged))
Summary
As Rails-based forms on Bootstrap Grid system will cause breaking HTML on validation errors, some of them, which were introduced in gitlab-foss!18232 (merged), should be fixed.
A proof of concept of this issue was already verified in gitlab-foss#56764 (closed) (gitlab-foss!24614 (merged)).
Example
.form-group.row
= f.label :user_id, class: 'col-sm-2 col-form-label'
.col-sm-10
= text_field_tag :user_name, name, class: "form-control", readonly: true
will generate on create:
<div class="form-group row">
<label class="col-sm-2 col-form-label">user</label>
<div class="col-sm-10">
but on a validation error it will generate:
<div class="form-group row">
<div class="field_with_errors">
<label class="col-sm-2 col-form-label">user</label>
</div>
<div class="col-sm-10">
While not sure it is a Rails' bug (Rails 5.0.x), on validation error(s) we have to generate as either of follows:
<div class="form-group row">
<div class="field_with_errors col-sm-2 col-form-label">
<label>user</label>
</div>
<div class="col-sm-10">
<div class="form-group row">
<div class="col-sm-2 col-form-label">
<div class="field_with_errors">
<label>user</label>
</div>
</div>
<div class="col-sm-10">
Current situation
On gitlab-ee, we have 9 f.label.*col-
occurrences in its HAML files even after gitlab-foss#57189 (closed) was applied to ee.
Edited by Takuya Noguchi