Sha256: d855f0ecd6cc8bbb477176aac4c7213e8c6a2989c7503ba95a051289c9691f03

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

class Skr.Components.LocationChooser extends Lanes.React.Component

    propTypes:
        onModelSet: React.PropTypes.func
        name:       React.PropTypes.string

    getDefaultProps: ->
        label: 'Location', name: 'location'

    dataObjects:
        query: ->
            new Lanes.Models.Query({
                autoRetrieve: true
                syncOptions: Lanes.Models.Query.mergedSyncOptions(
                    @props.syncOptions, { include: [ 'address' ] }
                )
                src: Skr.Models.Location, fields: [
                    {id:'id', visible: false}
                    { id: 'code', fixedWidth: 130 }
                    'name'
                ]
            })

    render: ->
        props = _.clone(@props)
        if props.displayFinder
            <LC.RecordFinder ref="finder" sm=3 autoFocus
                commands={@state.commands}
                collection={Skr.Models.Location.all}
                query={@query}
                {...props} />
        else
            <LC.SelectField
                {...props}
                choices={Skr.Models.Location.all.models}
                labelField='code'
                model={@props.model} />

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stockor-0.2 client/skr/components/LocationChooser.cjsx