blob: 7e0bd5bbe8fb00676519b666e2d7bb156d2b9384 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
import React, { PropTypes, Component } from 'react'
export default class SaveButton extends Component{
constructor(props){
super(props)
}
btnDisabled(){
return !this.props.status.fetchSuccess || this.props.status.isFetching
}
btnClass(){
let className = ['btn btn-default']
if(this.btnDisabled()){
className.push('disabled')
}
return className.join(' ')
}
render() {
if (!this.hasPolicy()) {
return false
}else{
return (
<div className='row mt-md'>
<div className='col-lg-12 text-right'>
<form className={this.formClassName() + ' formSubmitr ml-xs'} onSubmit={e => {e.preventDefault()}}>
<div className="btn-group sticky-actions">
<button
className={this.btnClass()}
type='button'
disabled={this.btnDisabled()}
onClick={e => {
e.preventDefault()
this.props.editMode ? this.submitForm() : this.props.onEnterEditMode()
}}
>
{this.props.editMode ? "Valider" : "Editer"}
</button>
</div>
</form>
</div>
</div>
)
}
}
}
|