Move Save button to top of edit view

This commit is contained in:
Maciej Ziarkowski 2019-10-02 19:16:55 +01:00
parent d408978165
commit 8eb0923098
2 changed files with 19 additions and 19 deletions

View File

@ -211,7 +211,6 @@ const withCopyEdit = (WrappedComponent) => {
action={`/edit/${this.props.slug}/${this.props.building.building_id}`} action={`/edit/${this.props.slug}/${this.props.building.building_id}`}
method="POST" method="POST"
onSubmit={this.handleSubmit}> onSubmit={this.handleSubmit}>
<ErrorBox msg={this.state.error} />
{ {
(this.props.inactive) ? (this.props.inactive) ?
<InfoBox <InfoBox
@ -219,6 +218,24 @@ const withCopyEdit = (WrappedComponent) => {
/> />
: null : null
} }
{
(this.props.mode === 'edit' && !this.props.inactive) ?
<Fragment>
<ErrorBox msg={this.state.error} />
{
this.props.slug === 'like' ? // special-case for likes
null :
<div className="buttons-container with-space">
<button
type="submit"
className="btn btn-primary">
Save
</button>
</div>
}
</Fragment>
: null
}
<WrappedComponent <WrappedComponent
building={this.state.building} building={this.state.building}
building_like={this.props.building_like} building_like={this.props.building_like}
@ -229,23 +246,6 @@ const withCopyEdit = (WrappedComponent) => {
onLike={this.handleLike} onLike={this.handleLike}
onUpdate={this.handleUpdate} onUpdate={this.handleUpdate}
/> />
{
(this.props.mode === 'edit' && !this.props.inactive) ?
<Fragment>
{
this.props.slug === 'like' ? // special-case for likes
null :
<div className="buttons-container">
<button
type="submit"
className="btn btn-primary">
Save
</button>
</div>
}
</Fragment>
: null
}
</form> </form>
: :
<form> <form>

View File

@ -28,7 +28,7 @@ label {
} }
.buttons-container.with-space { .buttons-container.with-space {
margin-top: 1rem; margin-top: 1rem;
padding: 0 0.75rem; /* padding: 0 0.75rem; */
} }
.buttons-container .btn { .buttons-container .btn {
margin-bottom: 0.25rem; margin-bottom: 0.25rem;