Skip to content

refactor: make add year form more compact #1457

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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 26 additions & 25 deletions src/main/frontend/src/components/AddReleaseYearForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,19 @@ class AddReleaseYearFormView extends React.PureComponent {
const rangeOfYears = this.generateRange(sinceYear, tillYear);

return (
<div className="col-sm-12 form-group">
<form id="add-release-year-form" className={ `form-horizontal ${hasValidationErrors ? 'has-error' : ''}` }
onSubmit={ handleSubmit }>
<div
id="add-release-year-failed-msg"
className={ `alert alert-danger text-center col-sm-8 col-sm-offset-2 ${hasServerError ? '' : 'hidden' }` }>
{ l10n['t_server_error'] || 'Server error' }
</div>
<div className="form-group form-group-sm">
<div className="row">
<div id="add-release-year-failed-msg"
className={ `alert alert-danger text-center col-sm-8 col-sm-offset-2 ${hasServerError ? '' : 'hidden'}` }>
{ l10n['t_server_error'] || 'Server error' }
</div>
<div className="col-sm-12">
<form id="add-release-year-form"
className={`form-horizontal ${hasValidationErrors ? 'has-error' : ''}`}
onSubmit={ handleSubmit }>
<label htmlFor="release-year" className="control-label col-sm-3">
{ l10n['t_year'] || 'Year' }
</label>
<div className="col-sm-6">
<div className="form-group form-group-sm col-sm-5">
<select
id="release-year"
name="release-year"
Expand All @@ -128,22 +128,23 @@ class AddReleaseYearFormView extends React.PureComponent {
<option key={year.toString()} value={year}>{ year }</option>
))}
</select>
<span
id="release-year.errors"
className={ `help-block ${hasValidationErrors ? '' : 'hidden'}` }>
{ validationErrors.join(', ') }
</span>
</div>
</div>
<div className="col-sm-offset-3 col-sm-4">
<span
id="release-year.errors"
className={ `help-block ${hasValidationErrors ? '' : 'hidden'}` }>
{ validationErrors.join(', ') }
</span>
<button
type="submit"
className="btn btn-primary btn-sm"
disabled={ isDisabled }>
{ l10n['t_add'] || 'Add' }
</button>
</div>
</form>
<div className="form-group form-group-sm">
<button type="submit"
className="btn btn-primary btn-sm"
disabled={ isDisabled }>
{ l10n['t_add'] || 'Add' }
</button>

</div>

</form>
</div>
</div>
);
}
Expand Down