Sha256: 69923ed77d5a2cfd50482bf7dbc8c6f528444ac9abf4e304bd076e0f5dd6cc48

Contents?: true

Size: 827 Bytes

Versions: 5

Compression:

Stored size: 827 Bytes

Contents

import React from 'react';

export class FakeInputEvent {
    constructor(value) {
        this.target = {value};
    }
    isDefaultPrevented() { return false; }
}


export class RadioField extends React.Component {
    static mixins = [
        Hippo.Components.Form.FieldMixin
    ];
    handleRadioChange(ev) {
        if (ev.target.checked) {
            return (
                this.fieldMixinSetValue( new FakeInputEvent(this.props.value) )
            );
        }
    }

    renderEdit(props, handlers) {
        return (
            <BS.FormControl
                {...props}
                {...handlers}
                type="radio"
                checked={(this.props.checked != null) || (this.props.value === this.model[this.props.name])}
                onChange={this.handleRadioChange} />
        );
    }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hippo-fw-0.9.5 client/hippo/components/shared/RadioField.jsx
hippo-fw-0.9.4 client/hippo/components/shared/RadioField.jsx
hippo-fw-0.9.3 client/hippo/components/shared/RadioField.jsx
hippo-fw-0.9.2 client/hippo/components/shared/RadioField.jsx
hippo-fw-0.9.1 client/hippo/components/shared/RadioField.jsx