Sha256: d3778c1e593f185ea0b2b8d1a9d1253253f5d28bb322d29e1393519111819cac

Contents?: true

Size: 988 Bytes

Versions: 1

Compression:

Stored size: 988 Bytes

Contents

class Lanes.Components.ToggleField extends Lanes.React.Component
    mixins: [ Lanes.Components.Form.FieldMixin ]

    formGroupClass: 'toggle'

    renderDisplayValue: ->
        <Lanes.Vendor.ReactToggle
            defaultChecked={!!@props.model[@props.name]}
            checked={!!@props.model[@props.name]}
            disabled={true}
        />

    handleToggleChange: (ev) ->
        @props.model[@props.name] = ev.target.checked
        null

    renderEdit: (label) ->
        props = _.omit(@props, 'label')
        toggle = <Lanes.Vendor.ReactToggle
            onChange={@handleToggleChange}
            checked={!!@props.model[@props.name]}
            defaultChecked={!!@props.model[@props.name]}
            />
        if @props.unstyled
            toggle
        else
            <LC.FormGroup
                {...props}
                className={@formGroupClassNames()}
                label={label}
            >
                {toggle}
            </LC.FormGroup>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lanes-0.3.0 client/lanes/components/shared/ToggleField.cjsx